[jboss-jira] [JBoss JIRA] (DROOLS-1445) Mask should reflect properties accessed in other nodes join constraints

Mario Fusco (JIRA) issues at jboss.org
Fri Feb 24 03:10:00 EST 2017


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

Mario Fusco resolved DROOLS-1445.
---------------------------------
    Fix Version/s: 7.0.0.CR1
       Resolution: Done


Fixed by https://github.com/droolsjbpm/drools/commit/ff8d793b248c42029d0571742c9d0c7c284e3590

> Mask should reflect properties accessed in other nodes join constraints
> -----------------------------------------------------------------------
>
>                 Key: DROOLS-1445
>                 URL: https://issues.jboss.org/browse/DROOLS-1445
>             Project: Drools
>          Issue Type: Bug
>          Components: core engine
>            Reporter: Matteo Mortari
>            Assignee: Mario Fusco
>             Fix For: 7.0.0.CR1
>
>
> The following test exhibit a failing and a working test:
> {code:java}
>     @Test()
>     public void testAbis_NotWorking() {
>         // DROOLS-644
>         String drl =
>                 "import " + Person.class.getCanonicalName() + ";\n" +
>                 "global java.util.List list;\n" +
>                 "rule R when\n" +
>                 "    $p1 : Person( name == \"Mario\" ) \n" +
>                 "    $p2 : Person( age > $p1.age ) \n" +
>                 "then\n" +
>                 "    list.add(\"t0\");\n" +
>                 "end\n" +
>                 "rule Z when\n" +
>                 "    $p1 : Person( name == \"Mario\" ) \n" +
>                 "then\n" +
>                 "    modify($p1) { setAge(35); } \n" +
>                 "end\n" 
>                 ;
>         
>         // making the default explicit:
>         KieSession ksession = new KieHelper(PropertySpecificOption.ALWAYS).addContent(drl, ResourceType.DRL)
>                 .build()
>                 .newKieSession();
>         ksession.addEventListener(new DebugAgendaEventListener());
>         System.out.println(drl);
>         ReteDumper.dumpRete(ksession);
>         List<String> list = new ArrayList<String>();
>         ksession.setGlobal("list", list);
>         Person mario = new Person("Mario", 40);
>         Person mark = new Person("Mark", 37);
>         FactHandle fh_mario = ksession.insert(mario);
>         ksession.insert(mark);
>         int x = ksession.fireAllRules();
>         assertEquals(1, list.size());
>         assertEquals("t0", list.get(0));
>     }
>     
>     @Test()
>     public void testAbis_Working() {
>         // DROOLS-644
>         String drl =
>                 "import " + Person.class.getCanonicalName() + ";\n" +
>                 "global java.util.List list;\n" +
>                 "rule R when\n" +
>                 "    $p1 : Person( name == \"Mario\", $a1: age) \n" +
>                 "    $p2 : Person( age > $a1 ) \n" +
>                 "then\n" +
>                 "    list.add(\"t0\");\n" +
>                 "end\n" +
>                 "rule Z when\n" +
>                 "    $p1 : Person( name == \"Mario\" ) \n" +
>                 "then\n" +
>                 "    modify($p1) { setAge(35); } \n" +
>                 "end\n" 
>                 ;
>         // making the default explicit:
>         KieSession ksession = new KieHelper(PropertySpecificOption.ALWAYS).addContent(drl, ResourceType.DRL)
>                 .build()
>                 .newKieSession();
>         
>         System.out.println(drl);
>         ReteDumper.dumpRete(ksession);
>         List<String> list = new ArrayList<String>();
>         ksession.setGlobal("list", list);
>         Person mario = new Person("Mario", 40);
>         Person mark = new Person("Mark", 37);
>         FactHandle fh_mario = ksession.insert(mario);
>         ksession.insert(mark);
>         int x = ksession.fireAllRules();
>         assertEquals(1, list.size());
>         assertEquals("t0", list.get(0));
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list