try {
System.setProperty( "drools.dateformat",
"dd-MMM-yyyy" );
RuleModel m = new RuleModel();
m.name = "RHS SetMethodCallsMethod";
m.addAttribute( new RuleAttribute( "dialect",
"java" ) );
FactPattern p = new FactPattern( "Person" );
p.setBoundName( "$p" );
m.addLhsItem( p );
ActionCallMethod acm = new ActionCallMethod();
acm.setMethodName( "method" );
acm.setVariable( "$p" );
acm.addFieldValue( new ActionFieldFunction( "f1",
"String",
DataType.TYPE_STRING ) );
acm.addFieldValue( new ActionFieldFunction( "f2",
"true",
DataType.TYPE_BOOLEAN ) );
acm.addFieldValue( new ActionFieldFunction( "f3",
"31-Jan-2012",
DataType.TYPE_DATE ) );
acm.addFieldValue( new ActionFieldFunction( "f4",
"100",
DataType.TYPE_NUMERIC_INTEGER ) );
acm.addFieldValue( new ActionFieldFunction( "f5",
"100",
DataType.TYPE_NUMERIC_BIGDECIMAL ) );
m.addRhsItem( acm );
String result = BRDRLPersistence.getInstance().marshal( m );
assertTrue( result.indexOf( "java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(\"dd-MMM-yyyy\");" ) != -1 );
assertTrue( result.indexOf( "$p.method( \"String\", true, sdf.parse(\"31-Jan-2012\"), 100, new java.math.BigDecimal(\"100\") );" ) != -1 );