assertEquals( "$cities",
restr.getIdentifier() );
}
public void testInOperator() throws Exception {
final RuleDescr rule = parseResource( "in_operator_test.drl" ).rule();
assertFalse( this.parser.getErrors().toString(),
this.parser.hasErrors() );
assertNotNull( rule );
assertEqualsIgnoreWhitespace( "consequence();",
(String) rule.getConsequence() );
assertEquals( "simple_rule",
rule.getName() );
assertEquals( 2,
rule.getLhs().getDescrs().size() );
//The first pattern, with 2 restrictions on a single field (plus a connective)
PatternDescr pattern = (PatternDescr) rule.getLhs().getDescrs().get( 0 );
assertEquals( "Person",
pattern.getObjectType() );
assertEquals( 1,
pattern.getConstraint().getDescrs().size() );
FieldConstraintDescr fld = (FieldConstraintDescr) pattern.getConstraint().getDescrs().get( 0 );
assertEquals( RestrictionConnectiveDescr.AND,
fld.getRestriction().getConnective() );
assertEquals( 2,
fld.getRestrictions().size() );
assertEquals( "age",
fld.getFieldName() );
LiteralRestrictionDescr lit = (LiteralRestrictionDescr) fld.getRestrictions().get( 0 );
assertEquals( ">",
lit.getEvaluator() );
assertEquals( "30",
lit.getText() );
lit = (LiteralRestrictionDescr) fld.getRestrictions().get( 1 );
assertEquals( "<",
lit.getEvaluator() );
assertEquals( "40",
lit.getText() );
//the second col, with 2 fields, the first with 2 restrictions, the second field with one
pattern = (PatternDescr) rule.getLhs().getDescrs().get( 1 );
assertEquals( "Vehicle",
pattern.getObjectType() );
assertEquals( 2,
pattern.getConstraint().getDescrs().size() );