Search in sources :

Example 1 with TrackingRuleRuntimeEventListener

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();
}
Also used : HashMap(java.util.HashMap) Command(org.kie.api.command.Command) TrackingAgendaEventListener(org.jbpm.test.listener.TrackingAgendaEventListener) ArrayList(java.util.ArrayList) TrackingProcessEventListener(org.jbpm.test.listener.TrackingProcessEventListener) TrackingRuleRuntimeEventListener(org.jbpm.test.listener.TrackingRuleRuntimeEventListener) ResourceType(org.kie.api.io.ResourceType) KieSession(org.kie.api.runtime.KieSession) Test(org.junit.Test) BZ(qa.tools.ikeeper.annotation.BZ)

Aggregations

ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 TrackingAgendaEventListener (org.jbpm.test.listener.TrackingAgendaEventListener)1 TrackingProcessEventListener (org.jbpm.test.listener.TrackingProcessEventListener)1 TrackingRuleRuntimeEventListener (org.jbpm.test.listener.TrackingRuleRuntimeEventListener)1 Test (org.junit.Test)1 Command (org.kie.api.command.Command)1 ResourceType (org.kie.api.io.ResourceType)1 KieSession (org.kie.api.runtime.KieSession)1 BZ (qa.tools.ikeeper.annotation.BZ)1