use of org.jbpm.test.listener.TrackingRuleRuntimeEventListener in project jbpm by kiegroup.
the class RuleTest method testNoOnEntryEvent.
@Test
@BZ("852095")
public void testNoOnEntryEvent() {
Map<String, ResourceType> res = new HashMap<String, ResourceType>();
res.put(ON_ENTRY_EVENT, ResourceType.BPMN2);
res.put(ON_ENTRY_EVENT_DRL, ResourceType.DRL);
KieSession ksession = createKSession(res);
List<Command<?>> commands = new ArrayList<Command<?>>();
TrackingAgendaEventListener agendaEvents = new TrackingAgendaEventListener();
TrackingProcessEventListener processEvents = new TrackingProcessEventListener();
TrackingRuleRuntimeEventListener ruleEvents = new TrackingRuleRuntimeEventListener();
ksession.addEventListener(agendaEvents);
ksession.addEventListener(processEvents);
ksession.addEventListener(ruleEvents);
commands.add(getCommands().newStartProcess(ON_ENTRY_EVENT_ID));
commands.add(getCommands().newFireAllRules());
ksession.execute(getCommands().newBatchExecution(commands, null));
Assertions.assertThat(processEvents.wasProcessStarted(ON_ENTRY_EVENT_ID)).isTrue();
Assertions.assertThat(processEvents.wasNodeTriggered("Rule")).isTrue();
Assertions.assertThat(ruleEvents.wasInserted("OnEntry")).isTrue();
Assertions.assertThat(agendaEvents.isRuleFired("dummyRule")).isTrue();
Assertions.assertThat(ruleEvents.wasInserted("OnExit")).isTrue();
Assertions.assertThat(processEvents.wasNodeLeft("Rule")).isTrue();
Assertions.assertThat(processEvents.wasProcessCompleted(ON_ENTRY_EVENT_ID)).isTrue();
}
Aggregations