Package org.drools.common

Examples of org.drools.common.PropagationContextImpl


                       cheese2 );
    }

    @Test
    public void testRestract() {
        final PropagationContext context = new PropagationContextImpl( 0,
                                                                       PropagationContext.ASSERTION,
                                                                       null,
                                                                       null,
                                                                       null );
        final ReteooWorkingMemory workingMemory = new ReteooWorkingMemory( 1,
View Full Code Here


        assertNull( memory.betaMemory.getRightTupleMemory() );
    }
   
    @Test
    public void testAssignable() {
        final PropagationContext context = new PropagationContextImpl( 0,
                                                                       PropagationContext.ASSERTION,
                                                                       null,
                                                                       null,
                                                                       null );
        final ReteooWorkingMemory workingMemory = new ReteooWorkingMemory( 1,
View Full Code Here

            out.writeObject( leftTuple );
        }

        public void execute(InternalWorkingMemory workingMemory) {

            final PropagationContext context = new PropagationContextImpl( workingMemory.getNextPropagationIdCounter(),
                                                                           PropagationContext.ASSERTION,
                                                                           this.ruleOrigin,
                                                                           this.leftTuple,
                                                                           this.factHandle );
            ReteooRuleBase ruleBase = (ReteooRuleBase) workingMemory.getRuleBase();
View Full Code Here

        }

        public void execute(InternalWorkingMemory workingMemory) {
            if ( this.factHandle.isValid() ) {
                // if the fact is still in the working memory (since it may have been previously retracted already
                final PropagationContext context = new PropagationContextImpl( workingMemory.getNextPropagationIdCounter(),
                                                                               PropagationContext.EXPIRATION,
                                                                               null,
                                                                               null,
                                                                               this.factHandle );
                ((EventFactHandle) factHandle).setExpired( true );
View Full Code Here

     * @see junit.framework.TestCase#setUp()
     */
    @Before
    public void setUp() throws Exception {
        this.rule = new Rule( "test-rule" );
        this.context = new PropagationContextImpl( 0,
                                                   PropagationContext.ASSERTION,
                                                   null,
                                                   null,
                                                   null );

View Full Code Here

                                this.context,
                                this.workingMemory );

        // assert tuple, should not add to left memory, since we are in sequential mode
        this.node.assertLeftTuple( tuple0,
                                   new PropagationContextImpl( 0,
                                                               PropagationContext.ASSERTION,
                                                               null,
                                                               null,
                                                               f0 ),
                                   this.workingMemory );
        // check memories
        assertNull( this.memory.getLeftTupleMemory() );
        assertEquals( 2,
                      this.memory.getRightTupleMemory().size() );
        assertEquals( "Wrong number of elements in matching objects list ",
                             2,
                             this.accumulator.getMatchingObjects().size() );

        // assert tuple, should not add left memory
        final LeftTupleImpl tuple1 = new LeftTupleImpl( f1,
                                                null,
                                                true );
        this.node.assertLeftTuple( tuple1,
                                   new PropagationContextImpl( 0,
                                                               PropagationContext.ASSERTION,
                                                               null,
                                                               null,
                                                               f1 ),
                                   this.workingMemory );
View Full Code Here

    public void setUp() {
        this.ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        this.buildContext = new BuildContext( ruleBase,
                                              ((ReteooRuleBase) ruleBase).getReteooBuilder().getIdGenerator() );

        this.context = new PropagationContextImpl( 0,
                                                   PropagationContext.ASSERTION,
                                                   null,
                                                   null,
                                                   null );
View Full Code Here

        final ContextEntry c = mock( ContextEntry.class );

        when( constraint.createContextEntry() ).thenReturn( c );

        this.rule = new Rule( "test-rule" );
        this.context = new PropagationContextImpl( 0,
                                                   PropagationContext.ASSERTION, null, null, null );
        this.workingMemory = new ReteooWorkingMemory( 1,
                                                      (ReteooRuleBase) RuleBaseFactory.newRuleBase() );

        this.tupleSource = new MockTupleSource( 4 );
View Full Code Here

        final DefaultFactHandle f0 = new DefaultFactHandle( 0, "cheese" );
        final LeftTupleImpl tuple0 = new LeftTupleImpl( f0, this.node, true );

        this.node.assertObject( f0,
                                new PropagationContextImpl( 0,
                                                            PropagationContext.ASSERTION, null, null, f0 ),
                                this.workingMemory );

        // assert tuple
        this.node.assertLeftTuple( tuple0,
                                   new PropagationContextImpl( 0,
                                                               PropagationContext.ASSERTION, null, null, f0 ),
                                   this.workingMemory );

        assertEquals( 1,
                      this.sink.getAsserted().size() );
View Full Code Here

                      sink2.getAsserted() );
    }

    @Test
    public void testSlotSpecific() {
        PropagationContext contextPassAll = new PropagationContextImpl(0,
                PropagationContext.ASSERTION, null, null, null, 0, 0, EntryPoint.DEFAULT, Long.MAX_VALUE);
        PropagationContext contextPassNothing = new PropagationContextImpl(0,
                PropagationContext.ASSERTION, null, null, null, 0, 0, EntryPoint.DEFAULT, 0);
        PropagationContext contextPass2And3 = new PropagationContextImpl(0,
                PropagationContext.ASSERTION, null, null, null, 0, 0, EntryPoint.DEFAULT, 6);

        when( constraint.isAllowedCachedLeft(any(ContextEntry.class), any(InternalFactHandle.class))).thenReturn(true);
        when( constraint.isAllowedCachedRight(any(LeftTupleImpl.class), any(ContextEntry.class))).thenReturn(true);
View Full Code Here

TOP

Related Classes of org.drools.common.PropagationContextImpl

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.