[jboss-jira] [JBoss JIRA] (DROOLS-870) Nested properties get hashed even if they shouldn't

Mario Fusco (JIRA) issues at jboss.org
Mon Aug 3 13:19:02 EDT 2015


Mario Fusco created DROOLS-870:
----------------------------------

             Summary: Nested properties get hashed even if they shouldn't
                 Key: DROOLS-870
                 URL: https://issues.jboss.org/browse/DROOLS-870
             Project: Drools
          Issue Type: Bug
            Reporter: Mario Fusco
            Assignee: Mario Fusco


In some cases nested properties get hashed by the CompositeObjectSinkAdapter even if they shouldn't

The following test case demonstrates this problem:

{code}
    public class A1 {
        public B1 b = new B1();
    }

    public class B1 {
        public int b1 = 1;
        public int b2 = 2;
        public int b3 = 3;
    }

    @Test
    public void testSkipHashingOfNestedProperties() {
        String drl =
                "import " + A1.class.getCanonicalName() + "\n" +
                "global java.util.List list\n" +
                "rule One when\n" +
                "  A1(b.b1 == 1)\n" +
                "then\n" +
                "  list.add(\"One\");\n" +
                "end\n" +
                "\n" +
                "rule \"Two\" when\n" +
                "  A1(b.b2 == 2)\n" +
                "then\n" +
                "  list.add(\"Two\");\n" +
                "end\n" +
                "\n" +
                "rule \"Three\" when\n" +
                "  A1(b.b3 == 3)\n" +
                "then\n" +
                "  list.add(\"Three\");\n" +
                "end\n";

        KieSession ksession = new KieHelper().addContent( drl, ResourceType.DRL )
                                             .build()
                                             .newKieSession();

        List<Object> list = new ArrayList<Object>();
        ksession.setGlobal( "list", list );

        ksession.insert( new A1() );
        ksession.fireAllRules();

        assertEquals( 3, list.size() );
    }
{code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


More information about the jboss-jira mailing list