[jboss-jira] [JBoss JIRA] (DROOLS-588) Constraints with same expression causes a node sharing even if they shouldn't

Mario Fusco (JIRA) issues at jboss.org
Mon Sep 1 13:01:59 EDT 2014


Mario Fusco created DROOLS-588:
----------------------------------

             Summary: Constraints with same expression causes a node sharing even if they shouldn't
                 Key: DROOLS-588
                 URL: https://issues.jboss.org/browse/DROOLS-588
             Project: Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
            Reporter: Mario Fusco
            Assignee: Mario Fusco


Reoroducer:

{code}
    @Test
    public void testWrongNodeSharing() {
        String drl1 =
                "package test1\n" +
                "import static " + Misc2Test.class.getCanonicalName() + ".parseInt;\n" +
                "global java.util.List list;\n" +
                "rule R when\n" +
                "    String( parseInt(this) == 0 )\n" +
                "then\n" +
                "    list.add(\"OK\");\n" +
                "end";

        String drl2 =
                "package test2\n" +
                "import static java.lang.Integer.parseInt;\n" +
                "global java.util.List list;\n" +
                "rule R when\n" +
                "    String( parseInt(this) == 0 )\n" +
                "then\n" +
                "    list.add(\"NOT OK\");\n" +
                "end";

        KieHelper helper = new KieHelper();
        helper.addContent( drl1, ResourceType.DRL );
        helper.addContent( drl2, ResourceType.DRL );
        KieSession kieSession = helper.build().newKieSession();

        List list = new ArrayList();
        kieSession.setGlobal( "list", list );

        kieSession.insert( "3" );
        kieSession.fireAllRules();

        assertEquals( 1, list.size() );
        assertEquals( "OK", list.get(0) );
    }

    public static int parseInt(String s) {
        return 0;
    }
{code}



--
This message was sent by Atlassian JIRA
(v6.3.1#6329)


More information about the jboss-jira mailing list