use of org.jbpm.process.instance.impl.demo.DoNothingWorkItemHandler 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.process.instance.impl.demo.DoNothingWorkItemHandler 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.process.instance.impl.demo.DoNothingWorkItemHandler 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);
}
use of org.jbpm.process.instance.impl.demo.DoNothingWorkItemHandler in project jbpm by kiegroup.
the class IntermediateEventTest method testTimerBoundaryEventDateISO.
@Test(timeout = 10000)
public void testTimerBoundaryEventDateISO() throws Exception {
NodeLeftCountDownProcessEventListener countDownListener = new NodeLeftCountDownProcessEventListener("TimerEvent", 1);
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-TimerBoundaryEventDateISO.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.addEventListener(countDownListener);
ksession.getWorkItemManager().registerWorkItemHandler("MyTask", new DoNothingWorkItemHandler());
HashMap<String, Object> params = new HashMap<String, Object>();
OffsetDateTime plusTwoSeconds = OffsetDateTime.now().plusSeconds(2);
params.put("date", plusTwoSeconds.toString());
ProcessInstance processInstance = ksession.startProcess("TimerBoundaryEvent", params);
assertProcessInstanceActive(processInstance);
countDownListener.waitTillCompleted();
ksession = restoreSession(ksession, true);
assertProcessInstanceFinished(processInstance, ksession);
}
use of org.jbpm.process.instance.impl.demo.DoNothingWorkItemHandler in project jbpm by kiegroup.
the class IntermediateEventTest method testIntermediateCatchEventTimerDurationISO.
@Test(timeout = 10000)
public void testIntermediateCatchEventTimerDurationISO() throws Exception {
NodeLeftCountDownProcessEventListener countDownListener = new NodeLeftCountDownProcessEventListener("timer", 1);
KieBase kbase = createKnowledgeBase("BPMN2-IntermediateCatchEventTimerDurationISO.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.5 second for timer to trigger
countDownListener.waitTillCompleted();
ksession = restoreSession(ksession, true);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new DoNothingWorkItemHandler());
assertProcessInstanceFinished(processInstance, ksession);
}
Aggregations