+ "when\n"
+ "( Person( age == 42 ) or Person( age == 43 || age == 44) )\n"
+ "then\n"
+ "end";
RuleModel m = new RuleModel();
m.name = "rule1";
//LHS Pattern
CompositeFactPattern cfp = new CompositeFactPattern();
cfp.setType( CompositeFactPattern.COMPOSITE_TYPE_OR );
//LHS sub-patterns
FactPattern fp1 = new FactPattern();
fp1.setFactType( "Person" );
SingleFieldConstraint fp1_sfp1 = new SingleFieldConstraint();
fp1_sfp1.setFactType( "Person" );
fp1_sfp1.setFieldName( "age" );
fp1_sfp1.setOperator( "==" );
fp1_sfp1.setValue( "42" );
fp1_sfp1.setFieldType( DataType.TYPE_NUMERIC_INTEGER );
fp1_sfp1.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
fp1.addConstraint( fp1_sfp1 );
FactPattern fp2 = new FactPattern();
fp2.setFactType( "Person" );
CompositeFieldConstraint fp2_cfp = new CompositeFieldConstraint();
fp2_cfp.setCompositeJunctionType( CompositeFieldConstraint.COMPOSITE_TYPE_OR );
fp2.addConstraint( fp2_cfp );
SingleFieldConstraint fp2_sfp1 = new SingleFieldConstraint();
fp2_sfp1.setFactType( "Person" );
fp2_sfp1.setFieldName( "age" );
fp2_sfp1.setOperator( "==" );
fp2_sfp1.setValue( "43" );
fp2_sfp1.setFieldType( DataType.TYPE_NUMERIC_INTEGER );
fp2_sfp1.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
fp2_cfp.addConstraint( fp2_sfp1 );
SingleFieldConstraint fp2_sfp2 = new SingleFieldConstraint();
fp2_sfp2.setFactType( "Person" );
fp2_sfp2.setFieldName( "age" );
fp2_sfp2.setOperator( "==" );
fp2_sfp2.setValue( "44" );
fp2_sfp2.setFieldType( DataType.TYPE_NUMERIC_INTEGER );
fp2_sfp2.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
fp2_cfp.addConstraint( fp2_sfp2 );
cfp.addFactPattern( fp1 );
cfp.addFactPattern( fp2 );
m.addLhsItem( cfp );
String actualDrl = RuleModelDRLPersistenceImpl.getInstance().marshal( m );
assertEqualsIgnoreWhitespace( drl,
actualDrl );
}