]
Tibor Zimányi updated DROOLS-1413:
----------------------------------
Labels: oopath (was: )
OOPath constraint bug2
----------------------
Key: DROOLS-1413
URL:
https://issues.jboss.org/browse/DROOLS-1413
Project: Drools
Issue Type: Sub-task
Reporter: Matteo Mortari
Assignee: Mario Fusco
Labels: oopath
Fix For: 7.0.0.Beta7
{code:java}
@Test
public void testWronglyMatchAlsoEqualsBis() {
String drl =
"import org.drools.compiler.xpath.*;\n" +
"global java.util.Set duplicateNames; \n" +
"\n" +
"rule DIFF_FILES_BUT_WITH_SAME_FILENAME when\n" +
" $dir1 : TMFileSet( $ic1 : /files, $ic2 : /files{name ==
$ic1.name}, $ic1 != $ic2 )\n" +
"then\n" +
" System.out.println( $dir1 + \".: \" + $ic1 + \"
\" + $ic2 );\n" +
" duplicateNames.add( $ic1.getName() );\n" +
"end\n";
KieSession ksession = new KieHelper().addContent( drl, ResourceType.DRL )
.build()
.newKieSession();
Set duplicateNames = new HashSet();
ksession.setGlobal("duplicateNames", duplicateNames);
TMFileSet x = new TMFileSet("X");
TMFile file0 = new TMFile("File0", 47);
TMFile file1 = new TMFile("File1", 47);
TMFile file2 = new TMFile("File0", 47);
x.getFiles().addAll(Arrays.asList(new TMFile[]{file0, file1, file2}));
ksession.insert(x);
ksession.fireAllRules();
assertTrue( duplicateNames.contains("File0") );
assertFalse( duplicateNames.contains("File1") );
}
{code}