[jboss-jira] [JBoss JIRA] (DROOLS-4884) When a variable is reassigned in a consequence the property reactivity for the correspondent fact should be ignored
Mario Fusco (Jira)
issues at jboss.org
Fri Jan 3 09:29:00 EST 2020
[ https://issues.redhat.com/browse/DROOLS-4884?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mario Fusco resolved DROOLS-4884.
---------------------------------
Resolution: Done
Fixed by https://github.com/kiegroup/drools/commit/0ad536175a8ad36628040cbec63431b7d608a8bf
> 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}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
More information about the jboss-jira
mailing list