use of org.drools.compiler.lang.descr.ForallDescr in project drools by kiegroup.
the class RuleParserTest method testForallWithFrom.
@Test
public void testForallWithFrom() throws Exception {
final PackageDescr pkg = (PackageDescr) parseResource("compilationUnit", "forallwithfrom.drl");
assertEquals(1, pkg.getRules().size());
final RuleDescr rule = (RuleDescr) pkg.getRules().get(0);
assertEquals(1, rule.getLhs().getDescrs().size());
final ForallDescr forall = (ForallDescr) rule.getLhs().getDescrs().get(0);
assertEquals(2, forall.getDescrs().size());
final PatternDescr pattern = forall.getBasePattern();
assertEquals("Person", pattern.getObjectType());
assertEquals("$village", ((FromDescr) pattern.getSource()).getDataSource().toString());
final List<BaseDescr> remaining = forall.getRemainingPatterns();
assertEquals(1, remaining.size());
final PatternDescr cheese = (PatternDescr) remaining.get(0);
assertEquals("Cheese", cheese.getObjectType());
assertEquals("$cheesery", ((FromDescr) cheese.getSource()).getDataSource().toString());
}
Aggregations