StatefulSession session = ruleBase.newStatefulSession();
session.setGlobal( "results",
new ArrayList() );
session = getSerialisedStatefulSession( session );
session.insert( new Message() );
session = getSerialisedStatefulSession( session );
List results = (List) session.getGlobal( "results" );
session.insert( new Message() );
session.insert( new Message() );
session.fireAllRules();
assertEquals( 3,
((Number) results.get( 0 )).intValue() );
session = getSerialisedStatefulSession( session );
session.insert( new Message() );
session.insert( new Message() );
session = getSerialisedStatefulSession( session );
assertEquals( 1,
session.getAgenda().getActivations().length );
session.fireAllRules();