brlAction.getDefinition().add( aif1 );
dt.getActionCols().add( brlAction );
//Setup RuleModel columns (existing BRLActionColumn being edited)
BRLRuleModel model = new BRLRuleModel( dt );
ActionInsertFact aif2 = new ActionInsertFact( "Person" );
aif2.setBoundName( "$aif" );
aif2.addFieldValue( new ActionFieldValue( "rating",
null,
DataType.TYPE_STRING ) );
aif2.getFieldValues()[ 0 ].setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
model.addRhsItem( aif2 );
//Checks
assertNotNull( model.getRHSBoundFacts() );
assertEquals( 2,
model.getRHSBoundFacts().size() );
assertTrue( model.getRHSBoundFacts().contains( "$ins" ) );
assertTrue( model.getRHSBoundFacts().contains( "$aif" ) );
ActionInsertFact r1 = model.getRHSBoundFact( "$ins" );
assertNotNull( r1 );
assertTrue( r1 instanceof ActionInsertFactCol52ActionInsertFactAdaptor );
ActionInsertFactCol52ActionInsertFactAdaptor raif1 = (ActionInsertFactCol52ActionInsertFactAdaptor) r1;
assertEquals( "Person",
raif1.getFactType() );
assertEquals( "rating",
raif1.getFieldValues()[ 0 ].getField() );
assertEquals( DataType.TYPE_STRING,
raif1.getFieldValues()[ 0 ].getType() );
assertNull( raif1.getFieldValues()[ 0 ].getValue() );
assertEquals( BaseSingleFieldConstraint.TYPE_LITERAL,
raif1.getFieldValues()[ 0 ].getNature() );
ActionInsertFact r2 = model.getRHSBoundFact( "$aif" );
assertNotNull( r2 );
assertTrue( r2 instanceof ActionInsertFact );
ActionInsertFact raif2 = (ActionInsertFact) r2;
assertEquals( "Person",
raif2.getFactType() );