StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
for ( int i = 0; i < 2; 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() ) {
if ( act.getRule().getName().equals( "rule3" ) ) {
list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s1" ) + ":" + act.getDeclarationValue( "$s2" ) + ":" + act.getDeclarationValue( "$s3" ) + ":" + act.isActive() );
} else if ( act.getRule().getName().equals( "rule1" ) ) {
list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s1" ) + ":" + act.getDeclarationValue( "$s2" ) + ":" + act.isActive() );
} else if ( act.getRule().getName().equals( "rule2" ) ) {
list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s1" ) + ":" + act.isActive() );
}
}
assertContains( new String[]{"rule1:0:0:true", "rule1:0:1:true", "rule1:1:0:true", "rule1:1:1:true",
"rule2:1:true", "rule2:0:true",
"rule3:0:0:0:true", "rule3:0:0:1:true", "rule3:1:0:0:true", "rule3:1:0:1:true", "rule3:0:1:0:true", "rule3:0:1:1:true", "rule3:1:1:0:true", "rule3:1:1:1:true"},
list );
ksession.fireAllRules();
it = ActivationIterator.iterator( ksession );
list = new ArrayList();
for ( Match act = (Match) it.next(); act != null; act = (Match) it.next() ) {
if ( act.getRule().getName().equals( "rule3" ) ) {
list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s1" ) + ":" + act.getDeclarationValue( "$s2" ) + ":" + act.getDeclarationValue( "$s3" ) + ":" + act.isActive() );
} else if ( act.getRule().getName().equals( "rule1" ) ) {
list.add( act.getRule().getName() + ":" + act.getDeclarationValue( "$s1" ) + ":" + act.getDeclarationValue( "$s2" ) + ":" + act.isActive() );
} else if ( act.getRule().getName().equals( "rule2" ) ) {