assertEqualsIgnoreWhitespace( drlExpected,
drlActual );
}
private RuleModel getComplexModel( boolean useDsl ) {
final RuleModel m = new RuleModel();
m.name = "Complex Rule";
m.addAttribute( new RuleAttribute( "no-loop",
"true" ) );
m.addAttribute( new RuleAttribute( "salience",
"-10" ) );
m.addAttribute( new RuleAttribute( "agenda-group",
"aGroup" ) );
final FactPattern pat = new FactPattern( "Person" );
pat.setBoundName( "p1" );
final SingleFieldConstraint con = new SingleFieldConstraint();
con.setFieldBinding( "f1" );
con.setFieldName( "age" );
con.setOperator( "<" );
con.setValue( "42" );
pat.addConstraint( con );
m.addLhsItem( pat );
final CompositeFactPattern comp = new CompositeFactPattern( "not" );
comp.addFactPattern( new FactPattern( "Cancel" ) );
m.addLhsItem( comp );
final ActionUpdateField set = new ActionUpdateField();
set.setVariable( "p1" );
set.addFieldValue( new ActionFieldValue( "status",
"rejected",
DataType.TYPE_STRING ) );
m.addRhsItem( set );
final ActionRetractFact ret = new ActionRetractFact( "p1" );
m.addRhsItem( ret );
if ( useDsl ) {
final DSLSentence sen = new DSLSentence();
sen.setDefinition( "Send an email to {administrator}" );
m.addRhsItem( sen );
}
return m;
}