//When using a TemplateDataProvider the assumption is that we
//have a "complete" decision table including AnalysisCol52
allColumns.add( new AnalysisCol52() );
TemplateDataProvider rowDataProvider0 = new GuidedDTTemplateDataProvider( allColumns,
rowDTModel0 );
p.doConditions( allColumns,
allPatterns,
rowDataProvider0,
rowDTModel0,
DataUtilities.makeDataLists( data ),
rm );
String drl0 = RuleModelDRLPersistenceImpl.getInstance().marshal( rm );
assertEquals( 2,
rm.lhs.length );
assertEquals( "Person",
( (FactPattern) rm.lhs[ 0 ] ).getFactType() );
assertEquals( "p1",
( (FactPattern) rm.lhs[ 0 ] ).getBoundName() );
assertEquals( "Person",
( (FactPattern) rm.lhs[ 1 ] ).getFactType() );
assertEquals( "p2",
( (FactPattern) rm.lhs[ 1 ] ).getBoundName() );
assertTrue( drl0.indexOf( "p1 : Person( dateOfBirth == \"01-Jan-1980\" )" ) > 0 );
assertTrue( drl0.indexOf( "p2 : Person( dateOfBirth != \"20-Jun-1985\" )" ) > 0 );
TemplateDataProvider rowDataProvider1 = new GuidedDTTemplateDataProvider( allColumns,
rowDTModel1 );
p.doConditions( allColumns,
allPatterns,
rowDataProvider1,
rowDTModel1,
DataUtilities.makeDataLists( data ),
rm );
String drl1 = RuleModelDRLPersistenceImpl.getInstance().marshal( rm );
assertEquals( 2,
rm.lhs.length );
assertEquals( "Person",
( (FactPattern) rm.lhs[ 0 ] ).getFactType() );
assertEquals( "p1",
( (FactPattern) rm.lhs[ 0 ] ).getBoundName() );
assertEquals( "Person",
( (FactPattern) rm.lhs[ 1 ] ).getFactType() );
assertEquals( "p2",
( (FactPattern) rm.lhs[ 1 ] ).getBoundName() );
assertTrue( drl1.indexOf( "p1 : Person( dateOfBirth == \"01-Feb-1981\" )" ) > 0 );
assertTrue( drl1.indexOf( "p2 : Person( dateOfBirth != \"21-Jun-1986\" )" ) > 0 );
TemplateDataProvider rowDataProvider2 = new GuidedDTTemplateDataProvider( allColumns,
rowDTModel2 );
p.doConditions( allColumns,
allPatterns,
rowDataProvider2,