]
Mario Fusco resolved DROOLS-4884.
---------------------------------
Resolution: Done
Fixed by
When a variable is reassigned in a consequence the property
reactivity for the correspondent fact should be ignored
-------------------------------------------------------------------------------------------------------------------
Key: DROOLS-4884
URL:
https://issues.redhat.com/browse/DROOLS-4884
Project: Drools
Issue Type: Bug
Reporter: Mario Fusco
Assignee: Mario Fusco
Priority: Major
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.
{code}
@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) );
}
{code}