p1.getChildColumns().add( c1 );
dt.getConditions().add( p1 );
BRLConditionColumn brlCondition = new BRLConditionColumn();
FactPattern fp1 = new FactPattern( "Driver" );
fp1.setBoundName( "$brl1" );
SingleFieldConstraint sfc1 = new SingleFieldConstraint();
sfc1.setFieldBinding( "$sfc1" );
sfc1.setOperator( "==" );
sfc1.setFactType( "Driver" );
sfc1.setFieldName( "name" );
sfc1.setFieldType( DataType.TYPE_STRING );
fp1.addConstraint( sfc1 );
brlCondition.getDefinition().add( fp1 );
dt.getConditions().add( brlCondition );
//Setup RuleModel columns (existing BRLConditionColumn being edited)
BRLRuleModel model = new BRLRuleModel( dt );
FactPattern fp2 = new FactPattern( "Driver" );
fp2.setBoundName( "$brl1" );
SingleFieldConstraint sfc2 = new SingleFieldConstraint();
sfc2.setFieldBinding( "$sfc1" );
sfc2.setOperator( "==" );
sfc2.setFactType( "Driver" );
sfc2.setFieldName( "name" );
sfc2.setFieldType( DataType.TYPE_STRING );
fp2.addConstraint( sfc2 );
model.addLhsItem( fp2 );
//Checks
assertNotNull( model.getLHSBoundFacts() );
assertEquals( 2,
model.getLHSBoundFacts().size() );
assertTrue( model.getLHSBoundFacts().contains( "$p1" ) );
assertTrue( model.getLHSBoundFacts().contains( "$brl1" ) );
assertNotNull( model.getLHSBindingType( "$p1" ) );
assertEquals( "Driver",
model.getLHSBindingType( "$p1" ) );
assertNotNull( model.getLHSBindingType( "$brl1" ) );
assertEquals( "Driver",
model.getLHSBindingType( "$brl1" ) );
FactPattern r1 = model.getLHSBoundFact( "$p1" );
assertNotNull( r1 );
assertTrue( r1 instanceof Pattern52FactPatternAdaptor );
Pattern52FactPatternAdaptor raif1 = (Pattern52FactPatternAdaptor) r1;
assertEquals( "Driver",
raif1.getFactType() );
FactPattern r2 = model.getLHSBoundFact( "$brl1" );
assertNotNull( r2 );
assertEquals( "Driver",
r2.getFactType() );
}