[jboss-jira] [JBoss JIRA] Created: (JBRULES-1204) Problem with memberOf and/or eval used in collect statement

Chris West (JIRA) jira-events at lists.jboss.org
Tue Sep 18 15:20:11 EDT 2007


Problem with memberOf and/or eval used in collect statement
-----------------------------------------------------------

                 Key: JBRULES-1204
                 URL: http://jira.jboss.com/jira/browse/JBRULES-1204
             Project: JBoss Rules
          Issue Type: Bug
      Security Level: Public (Everyone can see)
    Affects Versions: 4.0.1,  4.0.0.GA
            Reporter: Chris West
         Assigned To: Mark Proctor
         Attachments: TestMemberOfWithCollect.zip

I'm having a problem using memberOf combined with a collect statement.  My test includes 3 rules each written to output the same results (I think), but I get different results (depending on which version of Drools I use).

The rules are:


rule "TestMemberOf"
    salience 10
    when
        $messages: ArrayList() from collect (Message(status == 100))
        $wrappers: ArrayList() from collect (Wrapper(message memberOf $messages))
    then
        System.out.println("TestMemberOf: " + $wrappers.size());
end

rule "TestEval1"
    salience 9
    when
        $messages: ArrayList() from collect (Message(status == 100))
        $wrappers: ArrayList() from collect (Wrapper($message: message, eval($messages.contains($message))))
    then
        System.out.println("TestEval1: " + $wrappers.size());
end

rule "TestEval2"
    salience 8
    when
        $wrappers: ArrayList() from collect (Wrapper($message: message, eval($message.getStatus() == 100)))
    then
        System.out.println("TestEval2: " + $wrappers.size());
end



The output is (by version):

4.0.0

TestMemberOf: 0
TestEval1: 0
TestEval2: 2

4.0.1

TestMemberOf: 0
TestEval1: 2
TestEval2: 2

4.0.2.SNAPSHOT (taken 9/18/07)

TestMemberOf: 0
TestEval1: 2
TestEval2: 2


The correct output should be:

TestMemberOf: 2
TestEval1: 2
TestEval2: 2





-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list