final Package pkg = builder.getPackage();
RuleBase ruleBase = getSinglethreadRuleBase();
ruleBase.addPackage( pkg );
ruleBase = SerializationHelper.serializeObject(ruleBase);
final WorkingMemory workingMemory = ruleBase.newStatefulSession();
final List list = new ArrayList();
workingMemory.setGlobal( "results",
list );
final Order order1 = new Order( 1,
"bob" );
final OrderItem item11 = new OrderItem( order1,
1 );
final OrderItem item12 = new OrderItem( order1,
2 );
final Order order2 = new Order( 2,
"mark" );
final OrderItem item21 = new OrderItem( order2,
1 );
final OrderItem item22 = new OrderItem( order2,
2 );
workingMemory.insert( order1 );
workingMemory.insert( item11 );
workingMemory.insert( item12 );
workingMemory.insert( order2 );
workingMemory.insert( item21 );
workingMemory.insert( item22 );
workingMemory.fireAllRules();
int index = 0;
assertEquals( 8,
list.size() );
assertSame( order1,