Examples of BuildContext


Examples of org.drools.core.reteoo.builder.BuildContext

    @Test
    public void testUpdateSinkWithoutMemory() throws FactException,
                                             IntrospectionException {
        // An AlphaNode should try and repropagate from its source
        ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        BuildContext buildContext = new BuildContext( ruleBase,
                                                      ((ReteooRuleBase) ruleBase).getReteooBuilder().getIdGenerator() );
        AbstractWorkingMemory workingMemory = (AbstractWorkingMemory) ruleBase.newStatefulSession();

        final Rule rule = new Rule( "test-rule" );
        PropagationContextFactory pctxFactory = ruleBase.getConfiguration().getComponentFactory().getPropagationContextFactory();
        final PropagationContext context = pctxFactory.createPropagationContext(0, PropagationContext.INSERTION, null, null, null);

        final MockObjectSource source = new MockObjectSource( buildContext.getNextId() );

        final InternalReadAccessor extractor = store.getReader( Cheese.class,
                                                                "type",
                                                                getClass().getClassLoader() );

        final FieldValue field = FieldFactory.getInstance().getFieldValue( "cheddar" );

        final MvelConstraint constraint = new MvelConstraintTestUtil("type == \"cheddar\"", field, extractor);

        final AlphaNode alphaNode = new AlphaNode( buildContext.getNextId(),
                                                   constraint,
                                                   source,
                                                   buildContext ); // no memory

        alphaNode.attach();
View Full Code Here

Examples of org.drools.core.reteoo.builder.BuildContext

    public void setUp(int type) {
        KieBaseConfiguration kconf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
        kconf.setOption( RuleEngineOption.PHREAK );
        ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase((RuleBaseConfiguration) kconf);
        buildContext = new BuildContext( ruleBase, ruleBase.getReteooBuilder().getIdGenerator() );

        PropagationContextFactory pctxFactory = ruleBase.getConfiguration().getComponentFactory().getPropagationContextFactory();
        context = pctxFactory.createPropagationContext(0, PropagationContext.INSERTION, null, null, null);

        ObjectTypeNode otn = new ObjectTypeNode( 4, null, new ClassObjectType( String.class ), buildContext );
View Full Code Here

Examples of org.drools.core.reteoo.builder.BuildContext

    @Before
    public void setUp() throws Exception {
        this.ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        this.pctxFactory = ruleBase.getConfiguration().getComponentFactory().getPropagationContextFactory();
        this.buildContext = new BuildContext(ruleBase,
                                             ((ReteooRuleBase) ruleBase).getReteooBuilder().getIdGenerator());
        this.entryPoint = new EntryPointNode(0,
                                             this.ruleBase.getRete(),
                                             buildContext);
        this.entryPoint.attach(buildContext);
View Full Code Here

Examples of org.drools.core.reteoo.builder.BuildContext

        Properties properties = new Properties();
        properties.setProperty("drools.shadowProxyExcludes",
                               "org.drools.core.test.model.Cheese");
        RuleBaseConfiguration conf = new RuleBaseConfiguration(properties);
        final ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase(conf);
        buildContext = new BuildContext(ruleBase,
                                        ((ReteooRuleBase) ruleBase).getReteooBuilder().getIdGenerator());
        final AbstractWorkingMemory workingMemory = new AbstractWorkingMemory(1,
                                                                              ruleBase);

        // Create a Rete network with ObjectTypeNodes for List, Collection and ArrayList
View Full Code Here

Examples of org.drools.core.reteoo.builder.BuildContext

        /*
         * create a RuleBase with a single ObjectTypeNode we attach a
         * MockObjectSink so we can detect assertions and retractions
         */
        final ReteooRuleBase ruleBase = ( ReteooRuleBase ) RuleBaseFactory.newRuleBase();
        BuildContext context = new BuildContext(ruleBase, ruleBase.getReteooBuilder().getIdGenerator() );

        NodeFactory nFacotry = ((ReteooRuleBase) ruleBase).getConfiguration().getComponentFactory().getNodeFactoryService();
        final EntryPointNode entryPoint = nFacotry.buildEntryPointNode( -1, ruleBase.getRete(), context );
        entryPoint.attach(context);
                       
View Full Code Here

Examples of org.drools.core.reteoo.builder.BuildContext

        this.workingMemory = new AbstractWorkingMemory(1, rbase);

        final RuleBaseConfiguration configuration = new RuleBaseConfiguration();

        ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        BuildContext buildContext = new BuildContext(ruleBase,
                                                     ruleBase.getReteooBuilder().getIdGenerator());

        this.objectSource = new MockObjectSource(155);
        this.tupleSource = new MockTupleSource(60);
View Full Code Here

Examples of org.drools.core.reteoo.builder.BuildContext

        when( constraint.isAllowedCachedRight( any( LeftTupleImpl.class ), any( ContextEntry.class ) )).thenReturn(true);

        final BetaConstraints nullConstraints = EmptyBetaConstraints.getInstance();

        ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        BuildContext buildContext = new BuildContext( ruleBase,
                                                      ruleBase.getReteooBuilder().getIdGenerator() );

        final NotNode notNode = new NotNode( 1,
                                             this.tupleSource,
                                             this.objectSource,
View Full Code Here

Examples of org.drools.core.reteoo.builder.BuildContext

        ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase( conf );

        this.workingMemory = new AbstractWorkingMemory( 1,
                                                      ruleBase );

        BuildContext buildContext = new BuildContext( ruleBase,
                                                      ruleBase.getReteooBuilder().getIdGenerator() );

        buildContext.setTupleMemoryEnabled( false );
        buildContext.setObjectTypeNodeMemoryEnabled( false );

        // override setup, so its working in sequential mode
        this.node = new NotNode( 15,
                                 this.tupleSource,
                                 this.objectSource,
View Full Code Here

Examples of org.drools.core.reteoo.builder.BuildContext

    private BuildContext buildContext;
   
    @Before
    public void setUp() throws Exception {
        this.ruleBase = ( ReteooRuleBase ) RuleBaseFactory.newRuleBase();
        this.buildContext = new BuildContext( ruleBase, ((ReteooRuleBase)ruleBase).getReteooBuilder().getIdGenerator() );
    }
View Full Code Here

Examples of org.drools.core.reteoo.builder.BuildContext

    }
   
    @Test
   
    public void testLeftInputAdapterNode() {
        BuildContext context = new BuildContext(ruleBase, ruleBase.getReteooBuilder().getIdGenerator() );
        final EntryPointNode entryPoint = new EntryPointNode( -1,
                                                              ruleBase.getRete(),
                                                              context );
        entryPoint.attach(context);
                       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.