[jboss-jira] [JBoss JIRA] Commented: (JBRULES-2971) update "swipes" fact from entry-point

Mark Proctor (JIRA) jira-events at lists.jboss.org
Thu May 26 01:24:01 EDT 2011


    [ https://issues.jboss.org/browse/JBRULES-2971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12604502#comment-12604502 ] 

Mark Proctor commented on JBRULES-2971:
---------------------------------------

{code}
    @Test
    public void testDifferentEntryPointsOnSameFact() {
        //JBRULES-2971
        
        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        ReteooRuleBase rbase = ( ReteooRuleBase ) ((KnowledgeBaseImpl)kbase).getRuleBase();
        Rete rete = rbase.getRete();
        EntryPointNode epn = new EntryPointNode( rbase.getReteooBuilder().getIdGenerator().getNextId(),
                                                 RuleBasePartitionId.MAIN_PARTITION,
                                                 rbase.getConfig().isMultithreadEvaluation(),
                                                 rete,
                                                 new EntryPoint( "xxx" ) );
        
        
        rbase.getRete().addObjectSink( epn );
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
        org.drools.runtime.rule.FactHandle f1 = ksession.insert( "f1" );
        
        WorkingMemoryEntryPoint ep = ksession.getWorkingMemoryEntryPoint( "xxx" );
        try {
            ep.update( f1, "s1" );
            fail( "Should throw an exception" );
        } catch ( IllegalArgumentException e ) {
            
        }
       
        try {
            ep.retract( f1 );
            fail( "Should throw an exception" );
        } catch ( IllegalArgumentException e ) {
            
        }   
        
        ksession.update( f1, "s1" );
        assertNotNull( ksession.getObject( f1 ) );
        ksession.retract( f1 );
        
        ksession.retract( f1 );
        assertNull( ksession.getObject( f1 ) );
    }
{code}

> update "swipes" fact from entry-point
> -------------------------------------
>
>                 Key: JBRULES-2971
>                 URL: https://issues.jboss.org/browse/JBRULES-2971
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-core
>    Affects Versions: 5.2.0.M2
>            Reporter: Wolfgang Laun
>            Assignee: Mark Proctor
>             Fix For: 5.2.0.CR1
>
>
> After this code, the inserted Sale fact does not match
>    Sale() from entry-point "cash"
> as it does when line x is removed. 
>  ,  StatefulKnowledgeSession kSession = this.getSession();
>     WorkingMemoryEntryPoint wmeep = kSession.getWorkingMemoryEntryPoint( "cash" );
>     FactHandle fh;
>     Sale s = new Sale(...);
>     fh = wmeep.insert( s );
>     kSession.update( fh, s ); // x - this swipes the fact from entry-point "cash"
> If this is the intended behaviour (which would be very strange) it isn't documented.
>     

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list