use of org.jbpm.test.listener.NodeLeftCountDownProcessEventListener in project jbpm by kiegroup.
the class IntermediateEventTest method testTimerBoundaryEventInterrupting.
@Test(timeout = 10000)
public void testTimerBoundaryEventInterrupting() throws Exception {
NodeLeftCountDownProcessEventListener countDownListener = new NodeLeftCountDownProcessEventListener("TimerEvent", 1);
KieBase kbase = createKnowledgeBase("BPMN2-TimerBoundaryEventInterrupting.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("MyTask", new DoNothingWorkItemHandler());
ksession.addEventListener(countDownListener);
ProcessInstance processInstance = ksession.startProcess("TimerBoundaryEvent");
assertProcessInstanceActive(processInstance);
countDownListener.waitTillCompleted();
ksession = restoreSession(ksession, true);
logger.debug("Firing timer");
assertProcessInstanceFinished(processInstance, ksession);
}
use of org.jbpm.test.listener.NodeLeftCountDownProcessEventListener in project jbpm by kiegroup.
the class IntermediateEventTest method testIntermediateCatchEventTimerCycleISO.
@Test(timeout = 10000)
public void testIntermediateCatchEventTimerCycleISO() throws Exception {
NodeLeftCountDownProcessEventListener countDownListener = new NodeLeftCountDownProcessEventListener("timer", 5);
KieBase kbase = createKnowledgeBase("BPMN2-IntermediateCatchEventTimerCycleISO.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new DoNothingWorkItemHandler());
ksession.addEventListener(countDownListener);
ProcessInstance processInstance = ksession.startProcess("IntermediateCatchEvent");
assertProcessInstanceActive(processInstance);
countDownListener.waitTillCompleted();
assertProcessInstanceActive(processInstance);
ksession.abortProcessInstance(processInstance.getId());
}
use of org.jbpm.test.listener.NodeLeftCountDownProcessEventListener in project jbpm by kiegroup.
the class IntermediateEventTest method testIntermediateCatchEventTimerCycle2.
@Test(timeout = 10000)
public void testIntermediateCatchEventTimerCycle2() throws Exception {
NodeLeftCountDownProcessEventListener countDownListener = new NodeLeftCountDownProcessEventListener("timer", 3);
KieBase kbase = createKnowledgeBase("BPMN2-IntermediateCatchEventTimerCycle2.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new DoNothingWorkItemHandler());
ksession.addEventListener(countDownListener);
ProcessInstance processInstance = ksession.startProcess("IntermediateCatchEvent");
assertProcessInstanceActive(processInstance);
// now wait for 1 second for timer to trigger
countDownListener.waitTillCompleted();
assertProcessInstanceActive(processInstance);
ksession.abortProcessInstance(processInstance.getId());
}
use of org.jbpm.test.listener.NodeLeftCountDownProcessEventListener in project jbpm by kiegroup.
the class IntermediateEventTest method testIntermediateCatchEventTimerDateISO.
@Test(timeout = 10000)
public void testIntermediateCatchEventTimerDateISO() throws Exception {
NodeLeftCountDownProcessEventListener countDownListener = new NodeLeftCountDownProcessEventListener("timer", 1);
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-IntermediateCatchEventTimerDateISO.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new DoNothingWorkItemHandler());
ksession.addEventListener(countDownListener);
HashMap<String, Object> params = new HashMap<String, Object>();
OffsetDateTime plusTwoSeconds = OffsetDateTime.now().plusSeconds(2);
params.put("date", plusTwoSeconds.toString());
ProcessInstance processInstance = ksession.startProcess("IntermediateCatchEvent", params);
assertProcessInstanceActive(processInstance);
// now wait for 1 second for timer to trigger
countDownListener.waitTillCompleted();
assertProcessInstanceFinished(processInstance, ksession);
}
use of org.jbpm.test.listener.NodeLeftCountDownProcessEventListener in project jbpm by kiegroup.
the class IntermediateEventTest method testTimerBoundaryEventCycleISOWithPersistence.
@Test(timeout = 10000)
@RequirePersistence
public void testTimerBoundaryEventCycleISOWithPersistence() throws Exception {
NodeLeftCountDownProcessEventListener countDownListener = new NodeLeftCountDownProcessEventListener("TimerEvent", 2);
// load up the knowledge base
KieBase kbase = createKnowledgeBase("BPMN2-TimerBoundaryEventCycleISO.bpmn2");
StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
ksession.addEventListener(countDownListener);
long sessionId = ksession.getIdentifier();
Environment env = ksession.getEnvironment();
ksession.getWorkItemManager().registerWorkItemHandler("MyTask", new DoNothingWorkItemHandler());
ProcessInstance processInstance = ksession.startProcess("TimerBoundaryEvent");
assertProcessInstanceActive(processInstance);
countDownListener.waitTillCompleted();
assertProcessInstanceActive(processInstance);
logger.info("dispose");
ksession.dispose();
ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(sessionId, kbase, null, env);
ksession.addEventListener(countDownListener);
assertProcessInstanceActive(processInstance);
ksession.abortProcessInstance(processInstance.getId());
assertProcessInstanceFinished(processInstance, ksession);
}
Aggregations