[jboss-jira] [JBoss JIRA] (DROOLS-2455) Missing beta node sharing

Mario Fusco (JIRA) issues at jboss.org
Thu Apr 5 12:57:00 EDT 2018


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

Mario Fusco resolved DROOLS-2455.
---------------------------------
    Resolution: Done


Fixed by https://github.com/kiegroup/drools/commit/cf8de3f25ab97132c96cbc9a80d1d4c4f114908c

> Missing beta node sharing
> -------------------------
>
>                 Key: DROOLS-2455
>                 URL: https://issues.jboss.org/browse/DROOLS-2455
>             Project: Drools
>          Issue Type: Bug
>          Components: core engine
>            Reporter: Mario Fusco
>            Assignee: Mario Fusco
>
> The constraints of a beta node are reordered (based on their indexability) only when the node is attached to the rete network. This means that when a second not yet attached node is compared to the former one it is found not equal (and then not shared) because of the different constraints ordering as demonstrated by the following test case
> {code}
>     @Test
>     public void testShareBetaWithConstraintReordering() {
>         String str =
>                 "import " + Person.class.getCanonicalName() + ";" +
>                 "rule R1 when\n" +
>                 "  $s : String()\n" +
>                 "  $p : Person(name != $s, age == $s.length)\n" +
>                 "then\n" +
>                 "end\n" +
>                 "rule R2 when\n" +
>                 "  $s : String()\n" +
>                 "  $p : Person(name != $s, age == $s.length)\n" +
>                 "then\n" +
>                 "end";
>         KieSession ksession = getKieSession( str );
>         assertEquals( 1, ReteDumper.collectNodes( ksession ).stream().filter( BetaNode.class::isInstance ).count() );
>         EntryPointNode epn = (( InternalKnowledgeBase ) ksession.getKieBase()).getRete().getEntryPointNodes().values().iterator().next();
>         ObjectTypeNode otn = epn.getObjectTypeNodes().get( new ClassObjectType( Person.class ) );
>         assertEquals( 1, otn.getSinks().length );
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jboss-jira mailing list