StatefulKnowledgeSession ksession = knowledgeBase.newStatefulKnowledgeSession( ksconf, null );
List list = new ArrayList();
ksession.setGlobal( "list", list );
WorkingMemoryEntryPoint aep = ksession.getWorkingMemoryEntryPoint( "a-ep" );
aep.insert( new A() );
ksession = marsallStatefulKnowledgeSession( ksession );
aep = ksession.getWorkingMemoryEntryPoint( "a-ep" );
aep.insert( new A() );
ksession = marsallStatefulKnowledgeSession( ksession );
list.clear();
ksession.fireAllRules();
ksession = marsallStatefulKnowledgeSession( ksession );
assertEquals( 2, ((List) list.get( 0 )).size() );
aep = ksession.getWorkingMemoryEntryPoint( "a-ep" );
aep.insert( new A() );
ksession = marsallStatefulKnowledgeSession( ksession );
aep = ksession.getWorkingMemoryEntryPoint( "a-ep" );
aep.insert( new A() );
ksession = marsallStatefulKnowledgeSession( ksession );
list.clear();
ksession.fireAllRules();
ksession = marsallStatefulKnowledgeSession( ksession );