Package org.drools.smf

Examples of org.drools.smf.DefaultConfiguration


   
    public void testObjectTypeWithOutImports() throws FactoryException
    {
        RuleBaseContext ruleBaseContext = new RuleBaseContext( );

        DefaultConfiguration configuration = new DefaultConfiguration( "test1" );
        configuration.setText( "java.util.HashMap" );

        final RuleSet ruleSet = new RuleSet( "test RuleSet",
                                             ruleBaseContext );

        final Rule rule = new Rule( "Test Rule 1",
View Full Code Here


    public void testObjectTypeWithStaticImports() throws FactoryException
    {
        RuleBaseContext ruleBaseContext = new RuleBaseContext( );

        DefaultConfiguration configuration = new DefaultConfiguration( "test1" );
        configuration.setText( "HashMap" );

        final RuleSet ruleSet = new RuleSet( "test RuleSet",
                                             ruleBaseContext );

        final Rule rule = new Rule( "Test Rule 1",
View Full Code Here

    public void testObjectTypeWithDynamicImports() throws FactoryException
    {
        RuleBaseContext ruleBaseContext = new RuleBaseContext( );

        DefaultConfiguration configuration = new DefaultConfiguration( "test1" );
        configuration.setText( "HashMap" );

        final RuleSet ruleSet = new RuleSet( "test RuleSet",
                                             ruleBaseContext );

        Importer importer = new DefaultImporter( );
View Full Code Here

    public void testSemaphoreFactoryExceptions() throws Exception
    {
        RuleBaseContext ruleBaseContext = new RuleBaseContext( );

        DefaultConfiguration configuration = new DefaultConfiguration( "test1" );

        final RuleSet ruleSet = new RuleSet( "test RuleSet",
                                             ruleBaseContext );

        final Rule rule = new Rule( "Test Rule 1",
                                    ruleSet );

        Importer importer = new DefaultImporter( );
        rule.setImporter( importer );

        ObjectTypeFactory factory = new SemaphoreFactory( );

        try
        {
            ClassObjectType type = (ClassObjectType) factory.newObjectType( rule,
                                                                            ruleBaseContext,
                                                                            configuration );
            fail( "SemaphoreFactory should throw an exception as no type is specified" );
        }
        catch ( FactoryException e )
        {
            assertEquals( "no Semaphore type specified",
                          e.getMessage( ) );
        }

        configuration.setAttribute( "type",
                                    "Person" );
        try
        {
            ClassObjectType type = (ClassObjectType) factory.newObjectType( rule,
                                                                            ruleBaseContext,
                                                                            configuration );
            fail( "SemaphoreFactory should throw an exception as no identifier is specified" );
        }
        catch ( FactoryException e )
        {
            assertEquals( "no Semaphore identifier specified",
                          e.getMessage( ) );
        }

        configuration.setAttribute( "type",
                                    "NoneExistingClass" );
        configuration.setAttribute( "identifier",
                                    "state" );
        try
        {
            ClassObjectType type = (ClassObjectType) factory.newObjectType( rule,
                                                                            ruleBaseContext,
                                                                            configuration );
            fail( "SemaphoreFactory should throw an exception as class NoneExistingClass does not exist." );
        }
        catch ( FactoryException e )
        {
            assertEquals( "Unable create Semaphore for type 'NoneExistingClass'",
                          e.getMessage( ) );
        }

        configuration.setAttribute( "type",
                                    "Person" );
        configuration.setAttribute( "identifier",
                                    "state" );
        try
        {
            ClassObjectType type = (ClassObjectType) factory.newObjectType( rule,
                                                                            ruleBaseContext,
View Full Code Here

                                   Semaphore badTypeSemaphore,
                                   Semaphore badIdentifierSemaphore) throws Exception
    {
        RuleBaseContext ruleBaseContext = new RuleBaseContext( );

        DefaultConfiguration configuration = new DefaultConfiguration( "test1" );
        configuration.setAttribute( "type",
                                    typeName );
        configuration.setAttribute( "identifier",
                                    "state" );

        final RuleSet ruleSet = new RuleSet( "test RuleSet",
                                             ruleBaseContext );
View Full Code Here

TOP

Related Classes of org.drools.smf.DefaultConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.