[jboss-jira] [JBoss JIRA] Updated: (JBRULES-3046) regression: spurious rule firing for exists(...) or not(...)

Wolfgang Laun (JIRA) jira-events at lists.jboss.org
Mon May 23 03:55:01 EDT 2011


     [ https://issues.jboss.org/browse/JBRULES-3046?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wolfgang Laun updated JBRULES-3046:
-----------------------------------

    Steps to Reproduce: 
    @Test
    public void testExistsIterativeModifyBug() {
        // JBRULES-3046
        // Rule should only fire once

        String str = "";

        str += "declare Fact x : int; y : int end ";

        str += "rule ins when then insert( new Fact( 1, 10 ) ); insert( new Fact( 2, 20 ) ); end ";

        str += "rule exornot ";
        str += "when ";
        str += "  exists Fact( x == 1 ) ";
        str += "  or ";
        str += "  not Fact( x == 2, y == 20 ) ";
        str += "then ";
        str += "  System.out.println( "SUCCESS" ); ";
        str += "end";

        KnowledgeBase kbase = loadKnowledgeBaseFromString( str );

        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
        int fired = ksession.fireAllRules();
        assertEquals( 1, fired ); 
        ksession.dispose();
    }



> regression: spurious rule firing for exists(...) or not(...)
> ------------------------------------------------------------
>
>                 Key: JBRULES-3046
>                 URL: https://issues.jboss.org/browse/JBRULES-3046
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-compiler (expert)
>    Affects Versions: 5.2.0.M2
>            Reporter: Wolfgang Laun
>            Assignee: Mark Proctor
>            Priority: Blocker
>             Fix For: 5.2.0.CR1
>
>
> The DRL code below results in TWO firings of rule exornot. (5.1.1: Only one firing) 
> declare Fact
>   x : int
>   y : int
> end
> rule ins
> when
> then
>     insert( new Fact( 1, 10 ) );
>     insert( new Fact( 2, 20 ) );
> end
> rule  exornot
> when
>     exists Fact( x == 1 )
>     or
>     not Fact( x == 2, y == 20 )
> then
>     System.out.println( "SUCCESS" );
> end
> NOTE: If field 'y' is removed from 'Fact' and the rule patterns, the rule fires still twice in 5.3.0, but also twice in 5.1.1.

--
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