Package org.drools.common

Examples of org.drools.common.PropagationContextImpl


                    map.get( objectType ) );
    }

    @Test
    public void testAssertObject() throws Exception {
        final PropagationContext context = new PropagationContextImpl( 0,
                                                                       PropagationContext.ASSERTION,
                                                                       null,
                                                                       null,
                                                                       null );
View Full Code Here


        assertTrue( memory.memory.contains( handle1 ) );
    }
   
    @Test
    public void testAssertObjectSequentialMode() {
        final PropagationContext context = new PropagationContextImpl( 0,
                                                                       PropagationContext.ASSERTION,
                                                                       null,
                                                                       null,
                                                                       null );
View Full Code Here

    @Test
    public void testRetractObject() throws Exception {
        ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        IdGenerator idGenerator = ruleBase.getReteooBuilder().getIdGenerator();
        final PropagationContext context = new PropagationContextImpl( 0,
                                                                       PropagationContext.ASSERTION,
                                                                       null,
                                                                       null,
                                                                       null );
View Full Code Here

    @Test
    public void testUpdateSink() throws FactException {
        // Tests that when new child is added only the last added child is
        // updated
        // When the attachingNewNode flag is set
        final PropagationContext context = new PropagationContextImpl( 0,
                                                                       PropagationContext.ASSERTION,
                                                                       null,
                                                                       null,
                                                                       null );
        final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
        final ReteooWorkingMemory workingMemory = new ReteooWorkingMemory( 1,
                                                                           (ReteooRuleBase) ruleBase );

        final Rete source = new Rete( (InternalRuleBase)ruleBase);

        final ObjectTypeNode objectTypeNode = new ObjectTypeNode( 1,
                                                                  this.entryPoint,
                                                                  new ClassObjectType( String.class ),
                                                                  buildContext );

        final MockObjectSink sink1 = new MockObjectSink();
        objectTypeNode.addObjectSink( sink1 );

        final Object string1 = "cheese";

        final Object string2 = "bread";

        final DefaultFactHandle handle1 = new DefaultFactHandle( 1,
                                                                 string1 );
        final DefaultFactHandle handle2 = new DefaultFactHandle( 2,
                                                                 string2 );

        objectTypeNode.assertObject( handle1,
                                     context,
                                     workingMemory );

        objectTypeNode.assertObject( handle2,
                                     context,
                                     workingMemory );

        assertEquals( 2,
                      sink1.getAsserted().size() );

        final MockObjectSink sink2 = new MockObjectSink();
        objectTypeNode.addObjectSink( sink2 );

        assertEquals( 0,
                      sink2.getAsserted().size() );

        objectTypeNode.updateSink( sink2,
                                   new PropagationContextImpl(),
                                   workingMemory );

        assertEquals( 2,
                      sink2.getAsserted().size() );
View Full Code Here

        assertTrue( memory.memory.contains( handle1 ) );
    }

    @Test
    public void testAssertObjectWithShadowEnabledNoDefaultConstr() throws Exception {
        final PropagationContext context = new PropagationContextImpl( 0,
                                                                       PropagationContext.ASSERTION,
                                                                       null,
                                                                       null,
                                                                       null );
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

        this.memory = (BetaMemory) this.workingMemory.getNodeMemory(this.node);

        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());

        assertNull(this.memory.getLeftTupleMemory());
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

     *
     * @throws Exception
     */
    @Test
    public void testAssertObjectWithoutMemory() throws Exception {
        final PropagationContext pcontext = new PropagationContextImpl( 0,
                                                                       PropagationContext.ASSERTION,
                                                                       null,
                                                                       null,
                                                                       null );
       
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.