FactPattern p = new FactPattern( "Person" );
m.addLhsItem( p );
final CompositeFieldConstraint cfc1 = new CompositeFieldConstraint();
cfc1.setCompositeJunctionType( CompositeFieldConstraint.COMPOSITE_TYPE_OR );
p.addConstraint( cfc1 );
final SingleFieldConstraint cfc1sfc1 = new SingleFieldConstraint();
cfc1sfc1.setFieldName( "field1" );
cfc1sfc1.setFieldType( DataType.TYPE_STRING );
cfc1sfc1.setConstraintValueType( SingleFieldConstraint.TYPE_TEMPLATE );
cfc1sfc1.setValue( "$f1" );
cfc1sfc1.setOperator( "==" );
cfc1.addConstraint( cfc1sfc1 );
final SingleFieldConstraint cfc1sfc2 = new SingleFieldConstraint();
cfc1sfc2.setFieldName( "field2" );
cfc1sfc2.setFieldType( DataType.TYPE_STRING );
cfc1sfc2.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
cfc1sfc2.setValue( "v2" );
cfc1sfc2.setOperator( "==" );
cfc1.addConstraint( cfc1sfc2 );
final CompositeFieldConstraint cfc2 = new CompositeFieldConstraint();
cfc2.setCompositeJunctionType( CompositeFieldConstraint.COMPOSITE_TYPE_OR );
p.addConstraint( cfc2 );
final SingleFieldConstraint cfc2sfc1 = new SingleFieldConstraint();
cfc2sfc1.setFieldName( "field3" );
cfc2sfc1.setFieldType( DataType.TYPE_STRING );
cfc2sfc1.setConstraintValueType( SingleFieldConstraint.TYPE_TEMPLATE );
cfc2sfc1.setValue( "$f3" );
cfc2sfc1.setOperator( "==" );
cfc2.addConstraint( cfc2sfc1 );
final SingleFieldConstraint cfc2sfc2 = new SingleFieldConstraint();
cfc2sfc2.setFieldName( "field4" );
cfc2sfc2.setFieldType( DataType.TYPE_STRING );
cfc2sfc2.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
cfc2sfc2.setValue( "v4" );
cfc2sfc2.setOperator( "==" );
cfc2.addConstraint( cfc2sfc2 );
final CompositeFieldConstraint cfc3 = new CompositeFieldConstraint();
cfc3.setCompositeJunctionType( CompositeFieldConstraint.COMPOSITE_TYPE_OR );
p.addConstraint( cfc3 );
final SingleFieldConstraint cfc3sfc1 = new SingleFieldConstraint();
cfc3sfc1.setFieldName( "field5" );
cfc3sfc1.setFieldType( DataType.TYPE_STRING );
cfc3sfc1.setConstraintValueType( SingleFieldConstraint.TYPE_TEMPLATE );
cfc3sfc1.setValue( "$f5" );
cfc3sfc1.setOperator( "==" );
cfc3.addConstraint( cfc3sfc1 );
final SingleFieldConstraint cfc3sfc2 = new SingleFieldConstraint();
cfc3sfc2.setFieldName( "field6" );
cfc3sfc2.setFieldType( DataType.TYPE_STRING );
cfc3sfc2.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
cfc3sfc2.setValue( "v6" );
cfc3sfc2.setOperator( "==" );
cfc3.addConstraint( cfc3sfc2 );
String expected = "rule \"t1_0\"\n" +
"dialect \"mvel\"\n" +
"when\n" +
"Person( field1 == \"v1\" || field2 == \"v2\", field3 == \"v3\" || field4 == \"v4\", field5 == \"v5\" || field6 == \"v6\" )\n" +