str +="then\n";
str +=" System.out.println( drools.getKieRuntime() );\n";
str +="end\n";
KnowledgeBase kbase = loadKnowledgeBaseFromString(kconf, str);
StatelessKnowledgeSession ksession = createStatelessKnowledgeSession( kbase );
final List list = new ArrayList();
ksession.addEventListener( new AgendaEventListener() {
public void matchCancelled(MatchCancelledEvent event) {
assertNotNull( event.getKieRuntime() );
list.add( event );
}
public void matchCreated(MatchCreatedEvent event) {
assertNotNull( event.getKieRuntime() );
list.add( event );
}
public void afterMatchFired(AfterMatchFiredEvent event) {
assertNotNull( event.getKieRuntime() );
list.add( event );
}
public void agendaGroupPopped(AgendaGroupPoppedEvent event) {
assertNotNull( event.getKieRuntime() );
list.add( event );
}
public void agendaGroupPushed(AgendaGroupPushedEvent event) {
assertNotNull( event.getKieRuntime() );
list.add( event );
}
public void beforeMatchFired(BeforeMatchFiredEvent event) {
assertNotNull( event.getKieRuntime() );
list.add( event );
}
public void beforeRuleFlowGroupActivated(RuleFlowGroupActivatedEvent event) {
assertNotNull( event.getKieRuntime() );
list.add( event );
}
public void afterRuleFlowGroupActivated(RuleFlowGroupActivatedEvent event) {
assertNotNull( event.getKieRuntime() );
list.add( event );
}
public void beforeRuleFlowGroupDeactivated(RuleFlowGroupDeactivatedEvent event) {
assertNotNull( event.getKieRuntime() );
list.add( event );
}
public void afterRuleFlowGroupDeactivated(RuleFlowGroupDeactivatedEvent event) {
assertNotNull( event.getKieRuntime() );
list.add( event );
}
});
ksession.addEventListener( new WorkingMemoryEventListener() {
public void objectInserted(ObjectInsertedEvent event) {
assertNotNull( event.getKieRuntime() );
list.add( event );
}
public void objectDeleted(ObjectDeletedEvent event) {
assertNotNull( event.getKieRuntime() );
list.add( event );
}
public void objectUpdated(ObjectUpdatedEvent event) {
assertNotNull( event.getKieRuntime() );
list.add( event );
}
});
ksession.execute( new Message( "help" ) );
assertEquals( 4, list.size() );
}