StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
for ( int i = 0; i < 5; i++ ) {
ksession.insert( new String( "" + i ) );
}
ActivationIterator it = ActivationIterator.iterator( ksession );
List list = new ArrayList();
for ( Match act = (Match) it.next(); act != null; act = (Match) it.next() ) {
list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s" ) + ":" + act.isActive() );
}
assertContains( new String[]{"rule0:0:true", "rule0:1:true", "rule0:2:true", "rule0:3:true", "rule0:4:true",
"rule1:0:true", "rule1:1:true", "rule1:2:true", "rule2:0:true", "rule2:1:true", "rule2:2:true",
"rule3:3:true", "rule3:4:true",
"rule3:4:true"},
list );
ksession.fireAllRules();
it = ActivationIterator.iterator( ksession );
list = new ArrayList();
for ( Match act = (Match) it.next(); act != null; act = (Match) it.next() ) {
list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s" ) + ":" + act.isActive() );
}
assertContains( new String[]{"rule0:0:false", "rule0:1:false", "rule0:2:false", "rule0:3:false", "rule0:4:false",
"rule1:0:false", "rule1:1:false", "rule1:2:false", "rule2:0:false", "rule2:1:false", "rule2:2:false",
"rule3:3:false", "rule3:4:false",