Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-870

Nested properties get hashed even if they shouldn't

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 6.3.0.Final
    • None
    • None
    • None
    • NEW
    • NEW

    Description

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

      The following test case demonstrates this problem:

          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() );
          }
      

      Attachments

        Activity

          People

            mfusco@redhat.com Mario Fusco
            mfusco@redhat.com Mario Fusco
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: