final Package pkg = builder.getPackage();
RuleBase ruleBase = getRuleBase();
ruleBase.addPackage( pkg );
ruleBase = SerializationHelper.serializeObject(ruleBase);
final WorkingMemory workingMemory = ruleBase.newStatefulSession();
final List list = new ArrayList();
workingMemory.setGlobal( "list", list );
final Cheese brie = new Cheese( "brie", 12 );
workingMemory.insert( brie );
DefaultAgenda agenda = (DefaultAgenda) workingMemory.getAgenda();
final ActivationGroup activationGroup0 = agenda.getActivationGroup( "activation-group-0" );
assertEquals( 2, activationGroup0.size() );
final ActivationGroup activationGroup3 = agenda.getActivationGroup( "activation-group-3" );
assertEquals( 1, activationGroup3.size() );
final AgendaGroup agendaGroup3 = agenda.getAgendaGroup( "agenda-group-3" );
assertEquals( 1, agendaGroup3.size() );
final AgendaGroup agendaGroupMain = agenda.getAgendaGroup( "MAIN" );
assertEquals( 3, agendaGroupMain.size() );
workingMemory.clearAgendaGroup( "agenda-group-3" );
assertEquals( 0, activationGroup3.size() );
assertEquals( 0, agendaGroup3.size() );
workingMemory.fireAllRules();
assertEquals( 0, activationGroup0.size() );
assertEquals( 2, list.size() );
assertEquals( "rule0", list.get( 0 ) );