public void testExecuteRulesGlobals() throws Exception {
final java.util.Map map = new HashMap();
java.util.Vector v = new java.util.Vector();
map.put( "vector",
v );
final StatelessRuleSession statelessSession = this.sessionBuilder.getStatelessRuleSession( this.bindUri_globals,
map );
final List inObjects = new ArrayList();
final Person bob = new Person( "bob" );
inObjects.add( bob );
final Person jeannie = new Person( "jeannie" );
jeannie.addSister( "rebecca" );
inObjects.add( jeannie );
final Person rebecca = new Person( "rebecca" );
rebecca.addSister( "jeannie" );
inObjects.add( rebecca );
// execute the rules
final List outList = statelessSession.executeRules( inObjects );
assertEquals( "incorrect size",
5,
outList.size() );
assertContains( outList,
bob );
assertContains( outList,
rebecca );
assertContains( outList,
jeannie );
assertContains( outList,
"rebecca and jeannie are sisters" );
assertContains( outList,
"jeannie and rebecca are sisters" );
v = (java.util.Vector) map.get( "vector" );
assertNotNull( "Global Vector null",
v );
assertContains( v,
"rebecca and jeannie are sisters" );
assertContains( v,
"jeannie and rebecca are sisters" );
assertEquals( "Vector v incorrect size",
2,
v.size() );
statelessSession.release();
}