FactPattern p = new FactPattern( "Person" );
m.addLhsItem( p );
CompositeFieldConstraint comp1 = new CompositeFieldConstraint();
comp1.setCompositeJunctionType( CompositeFieldConstraint.COMPOSITE_TYPE_OR );
final SingleFieldConstraint comp1sfc1 = new SingleFieldConstraint();
comp1sfc1.setFieldName( "field1" );
comp1sfc1.setFieldType( DataType.TYPE_STRING );
comp1sfc1.setConstraintValueType( SingleFieldConstraint.TYPE_TEMPLATE );
comp1sfc1.setValue( "$f1" );
comp1sfc1.setOperator( "==" );
comp1.addConstraint( comp1sfc1 );
final SingleFieldConstraint comp1sfc2 = new SingleFieldConstraint();
comp1sfc2.setFieldName( "field2" );
comp1sfc2.setFieldType( DataType.TYPE_STRING );
comp1sfc2.setConstraintValueType( SingleFieldConstraint.TYPE_TEMPLATE );
comp1sfc2.setValue( "$f2" );
comp1sfc2.setOperator( "==" );
comp1.addConstraint( comp1sfc2 );
p.addConstraint( comp1 );
CompositeFieldConstraint comp2 = new CompositeFieldConstraint();
comp2.setCompositeJunctionType( CompositeFieldConstraint.COMPOSITE_TYPE_OR );
final SingleFieldConstraint comp2sfc1 = new SingleFieldConstraint();
comp2sfc1.setFieldType( DataType.TYPE_STRING );
comp2sfc1.setFieldName( "field3" );
comp2sfc1.setOperator( "==" );
comp2sfc1.setValue( "$f3" );
comp2sfc1.setConstraintValueType( BaseSingleFieldConstraint.TYPE_TEMPLATE );
comp2.addConstraint( comp2sfc1 );
final SingleFieldConstraint comp2sfc2 = new SingleFieldConstraint();
comp2sfc2.setFieldName( "field4" );
comp2sfc2.setFieldType( DataType.TYPE_STRING );
comp2sfc2.setConstraintValueType( SingleFieldConstraint.TYPE_TEMPLATE );
comp2sfc2.setValue( "$f4" );
comp2sfc2.setOperator( "==" );
comp2.addConstraint( comp2sfc2 );
p.addConstraint( comp2 );
String expected = "rule \"t1_0\"\n" +
"dialect \"mvel\"\n" +