Package org.drools.core.impl

Examples of org.drools.core.impl.KnowledgeBaseImpl


   
    public BuildContext createContext() {
       
        RuleBaseConfiguration conf = new RuleBaseConfiguration();

        KnowledgeBaseImpl rbase = new KnowledgeBaseImpl( "ID",
                                                   conf );
        BuildContext buildContext = new BuildContext( rbase,
                                                      rbase.getReteooBuilder().getIdGenerator() );

        RuleImpl rule = new RuleImpl( "rule1", "org.pkg1", null );
        InternalKnowledgePackage pkg = new KnowledgePackageImpl( "org.pkg1" );
        pkg.getDialectRuntimeRegistry().setDialectData( "mvel", new MVELDialectRuntimeData() );
        pkg.addRule( rule );
View Full Code Here


    public BuildContext createContext() {
   
        RuleBaseConfiguration conf = new RuleBaseConfiguration();

        KnowledgeBaseImpl rbase = new KnowledgeBaseImpl( "ID",
                                                   conf );
        BuildContext buildContext = new BuildContext( rbase,
                                                      rbase.getReteooBuilder().getIdGenerator() );

        RuleImpl rule = new RuleImpl( "rule1", "org.pkg1", null );
        InternalKnowledgePackage pkg = new KnowledgePackageImpl( "org.pkg1" );
        pkg.getDialectRuntimeRegistry().setDialectData( "mvel", new MVELDialectRuntimeData() );
        pkg.addRule( rule );
View Full Code Here

    }

    @Test
    public void testConfiguration() {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("org/drools/container/spring/session-conf-beans.xml");
        KnowledgeBaseImpl kbase1 = (KnowledgeBaseImpl) context.getBean( "kbase1" );
        RuleBaseConfiguration rconf = kbase1.getConfiguration();
        assertTrue( rconf.isAdvancedProcessRuleIntegration() );
        assertFalse( rconf.isMultithreadEvaluation() );
        assertEquals( EventProcessingOption.STREAM,
                      rconf.getEventProcessingMode() );
        assertEquals( AssertBehaviour.IDENTITY,
                      rconf.getAssertBehaviour() );
        assertEquals( "org.drools.container.spring.MockConsequenceExceptionHandler",
                      rconf.getConsequenceExceptionHandler() );

        KnowledgeBaseImpl kbase2 = (KnowledgeBaseImpl) context.getBean( "kbase2" );
        rconf = kbase2.getConfiguration();
        assertFalse( rconf.isAdvancedProcessRuleIntegration() );
        assertFalse( rconf.isMultithreadEvaluation() );
        assertEquals( 3,
                      rconf.getMaxThreads() );
        assertEquals( EventProcessingOption.CLOUD,
View Full Code Here

            throw new RuntimeException( errors.toString() );
        }

        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );

        KnowledgeBaseImpl kbaseImpl = (KnowledgeBaseImpl) kbase;
        kbaseImpl.jaxbClasses = new ArrayList<List<String>>();
        for ( JaxbConfigurationImpl conf : xsds ) {
            kbaseImpl.jaxbClasses.add( conf.getClasses() );
        }
View Full Code Here

     * @see junit.framework.TestCase#setUp()
     */
    @Before
    public void setUp() throws Exception {
        this.builder = new ReteooRuleBuilder();
        this.rulebase = new KnowledgeBaseImpl( "default", null );
    }
View Full Code Here

        for (String[] configOption : args) {
            conf.setProperty(configOption[0], configOption[1]);
        }

        KnowledgeBaseImpl rbase = new KnowledgeBaseImpl("ID", conf);
        BuildContext buildContext = new BuildContext(rbase, rbase
                .getReteooBuilder().getIdGenerator());

        InternalWorkingMemory wm = (InternalWorkingMemory) rbase
                .newStatefulSession(true);

        // Overwrite values now taking into account the configuration options.
        context.put(BUILD_CONTEXT, buildContext);
        context.put(WORKING_MEMORY, wm);
View Full Code Here

        context.put( "TestCase",
                     testCase );

        RuleBaseConfiguration conf = new RuleBaseConfiguration();

        KnowledgeBaseImpl rbase = new KnowledgeBaseImpl( "ID",
                                                         conf );
        BuildContext buildContext = new BuildContext( rbase,
                                                      rbase.getReteooBuilder().getIdGenerator() );

        RuleImpl rule = new RuleImpl("rule1", "org.pkg1", null);
        InternalKnowledgePackage pkg = new KnowledgePackageImpl( "org.pkg1" );
        pkg.getDialectRuntimeRegistry().setDialectData( "mvel", new MVELDialectRuntimeData() );
        pkg.addRule( rule );
       
        buildContext.setRule( rule );

        pctxFactory = conf.getComponentFactory().getPropagationContextFactory();
       
        rbase.addPackage( pkg );
        context.put( BUILD_CONTEXT,
                     buildContext );
        context.put( "ClassFieldAccessorStore",
                     this.reteTesterHelper.getStore() );

        InternalWorkingMemory wm = (InternalWorkingMemory) rbase.newStatefulSession( true );
        context.put( WORKING_MEMORY,
                     wm );
        return context;
    }
View Full Code Here

public class RuleTest {

    @Test
    public void testDateEffective() {
        WorkingMemory wm = new KnowledgeBaseImpl("x", null).newStatefulSession();

        final RuleImpl rule = new RuleImpl( "myrule" );

        assertTrue( rule.isEffective(null, new RuleTerminalNode(), wm ) );
View Full Code Here

    }

    @Test
    public void testDateExpires() throws Exception {
        WorkingMemory wm = new KnowledgeBaseImpl("x", null).newStatefulSession();
       
        final RuleImpl rule = new RuleImpl( "myrule" );

        assertTrue( rule.isEffective(null, new RuleTerminalNode(), wm ) );
View Full Code Here

    }

    @Test
    public void testDateEffectiveExpires() {
        WorkingMemory wm = new KnowledgeBaseImpl("x",null).newStatefulSession();
       
        final RuleImpl rule = new RuleImpl( "myrule" );

        final Calendar past = Calendar.getInstance();
        past.setTimeInMillis( 10 );
View Full Code Here

TOP

Related Classes of org.drools.core.impl.KnowledgeBaseImpl

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.