drl );
}
@Test
public void testCompositeOrConstraints() {
RuleModel m = new RuleModel();
m.name = "or composite";
FactPattern p = new FactPattern( "Goober" );
m.addLhsItem( p );
CompositeFieldConstraint comp = new CompositeFieldConstraint();
comp.compositeJunctionType = CompositeFieldConstraint.COMPOSITE_TYPE_OR;
p.addConstraint( comp );
final SingleFieldConstraint sfc1 = new SingleFieldConstraint();
sfc1.setFieldName( "gooField" );
sfc1.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
sfc1.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
sfc1.setValue( "gooValue" );
sfc1.setOperator( "==" );
comp.addConstraint( sfc1 );
final SingleFieldConstraint sfc2 = new SingleFieldConstraint();
sfc2.setFieldName( "fooField" );
sfc2.setFieldType( SuggestionCompletionEngine.TYPE_OBJECT );
sfc2.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
sfc2.setOperator( "!= null" );
comp.addConstraint( sfc2 );
final SingleFieldConstraint sfc3 = new SingleFieldConstraint();
sfc3.setFieldName( "Foo.barField" );
sfc3.setParent( sfc2 );
sfc3.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
sfc3.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
sfc3.setValue( "barValue" );
sfc3.setOperator( "==" );
comp.addConstraint( sfc3 );
ActionInsertFact ass = new ActionInsertFact( "Whee" );
m.addRhsItem( ass );
String actual = BRDRLPersistence.getInstance().marshal( m );
String expected = "rule \"or composite\""
+ "dialect \"mvel\"\n"
+ "when\n"