[jboss-jira] [JBoss JIRA] (DROOLS-1302) OOPath ReactiveList remove cases
Matteo Mortari (JIRA)
issues at jboss.org
Thu Oct 20 06:25:00 EDT 2016
[ https://issues.jboss.org/browse/DROOLS-1302?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matteo Mortari reopened DROOLS-1302:
------------------------------------
Assignee: Mario Fusco (was: Matteo Mortari)
As discussed in presence the previous solution in ReactiveList :
{code:java}
@Override
public boolean add(T t) {
boolean result = list.add(t);
ReactiveObjectUtil.notifyModification(t, getLeftTuples(), ModificationType.ADD);
if (t instanceof ReactiveObject) {
for (Tuple lts : getLeftTuples()) {
((ReactiveObject) t).addLeftTuple(lts);
}
}
return result;
}
{code}
is not really ideal as this case fails by creating twice the match:
{code:java}
@Test
public void testMatteo2() {
String drl =
"import org.drools.compiler.xpath.*;\n" +
"global java.util.List list\n" +
"\n" +
"rule R when\n" +
" Man( $usage: /wife/children{age > 10}/toys/usage{level > 10} )\n" +
"then\n" +
" list.add( $usage );\n" +
"end\n";
KieBase kbase = new KieHelper().addContent( drl, ResourceType.DRL ).build();
KieSession ksession = kbase.newKieSession();
List<String> list = new ArrayList<String>();
ksession.setGlobal( "list", list );
Woman alice = new Woman( "Alice", 38 );
Man bob = new Man( "Bob", 40 );
bob.setWife( alice );
ksession.insert( bob );
ksession.fireAllRules();
list.clear();
Child eleonor = new Child( "Eleonor", 10 );
alice.addChild( eleonor );
Toy toy = new Toy( "eleonor toy 1" );
eleonor.addToy( toy );
Usage usage = new Usage();
toy.setUsage(usage);
usage.setLevel(99);
eleonor.setAge(11);
ksession.fireAllRules();
System.out.println(list);
usage.setLevel(99);
ksession.fireAllRules();
System.out.println(list);
}
{code}
> OOPath ReactiveList remove cases
> --------------------------------
>
> Key: DROOLS-1302
> URL: https://issues.jboss.org/browse/DROOLS-1302
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Affects Versions: 6.5.0.CR2
> Reporter: Matteo Mortari
> Assignee: Mario Fusco
> Priority: Minor
> Fix For: 7.0.0.Beta2
>
>
> * Removing element from ReactiveList is not covered
> * Ensure removing from 1 out of many ReactiveList does affect only the relevant lists when issuing modification to a ReactiveObject
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the jboss-jira
mailing list