-
Bug
-
Resolution: Done
-
Major
-
None
-
None
-
None
-
None
-
2020 Week 01-03 (from Dec 30)
-
NEW
-
NEW
When a variable is reassigned in a consequence (not a good practice in general) the property reactivity for the correspondent fact should be ignored. In other word the following test should succeed.
@Test
public void testReassignment() {
final String str1 =
"package com.example\n" +
"\n" +
"declare Counter\n" +
" value1: int\n" +
" value2: int\n" +
"end\n" +
"\n" +
"rule \"Init\" when\n" +
" not Counter()\n" +
"then\n" +
" drools.insert(new Counter(0, 0));\n" +
"end\n" +
"\n" +
"rule \"Loop\"\n" +
"when\n" +
" $c: Counter( value1 == 0 )\n" +
"then\n" +
" $c = new Counter(0, 0);\n" +
" $c.setValue2(1);\n" +
" update($c);\n" +
"end\n\n";
final KieSession ksession = new KieHelper().addContent( str1, ResourceType.DRL )
.build()
.newKieSession();
assertEquals( 5, ksession.fireAllRules(5) );
}