use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class StandaloneBPMNProcessTest method testEventBasedSplit2.
@Test(timeout = 10000)
public void testEventBasedSplit2() throws Exception {
NodeLeftCountDownProcessEventListener countDownListener = new NodeLeftCountDownProcessEventListener("timer", 2);
KieBase kbase = createKnowledgeBase("BPMN2-EventBasedSplit2.bpmn2");
KieSession ksession = createKnowledgeSession(kbase);
ksession.addEventListener(countDownListener);
ksession.getWorkItemManager().registerWorkItemHandler("Email1", new SystemOutWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("Email2", new SystemOutWorkItemHandler());
// Yes
ProcessInstance processInstance = ksession.startProcess("com.sample.test");
assertThat(processInstance.getState()).isEqualTo(ProcessInstance.STATE_ACTIVE);
ksession = restoreSession(ksession, true);
ksession.addEventListener(countDownListener);
ksession.getWorkItemManager().registerWorkItemHandler("Email1", new SystemOutWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("Email2", new SystemOutWorkItemHandler());
ksession.signalEvent("Yes", "YesValue", processInstance.getId());
assertProcessInstanceCompleted(processInstance.getId(), ksession);
ksession = restoreSession(ksession, true);
ksession.addEventListener(countDownListener);
ksession.getWorkItemManager().registerWorkItemHandler("Email1", new SystemOutWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("Email2", new SystemOutWorkItemHandler());
ksession = restoreSession(ksession, true);
ksession.addEventListener(countDownListener);
ksession.getWorkItemManager().registerWorkItemHandler("Email1", new SystemOutWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("Email2", new SystemOutWorkItemHandler());
// Timer
processInstance = ksession.startProcess("com.sample.test");
assertThat(processInstance.getState()).isEqualTo(ProcessInstance.STATE_ACTIVE);
countDownListener.waitTillCompleted();
ksession = restoreSession(ksession, true);
ksession.addEventListener(countDownListener);
ksession.getWorkItemManager().registerWorkItemHandler("Email1", new SystemOutWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("Email2", new SystemOutWorkItemHandler());
assertProcessInstanceCompleted(processInstance.getId(), ksession);
}
use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class StandaloneBPMNProcessTest method testExclusiveSplit.
@Test
public void testExclusiveSplit() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-ExclusiveSplit.bpmn2");
KieSession ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Email", new SystemOutWorkItemHandler());
Map<String, Object> params = new HashMap<String, Object>();
params.put("x", "First");
params.put("y", "Second");
ProcessInstance processInstance = ksession.startProcess("com.sample.test", params);
assertThat(processInstance.getState()).isEqualTo(ProcessInstance.STATE_COMPLETED);
}
use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class StandaloneBPMNProcessTest method testEventBasedSplitAfter.
@Test
public void testEventBasedSplitAfter() throws Exception {
// signaling the other alternative after one has been selected should
// have no effect
KieBase kbase = createKnowledgeBase("BPMN2-EventBasedSplit.bpmn2");
KieSession ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Email1", new SystemOutWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("Email2", new DoNothingWorkItemHandler());
// Yes
ProcessInstance processInstance = ksession.startProcess("com.sample.test");
assertThat(processInstance.getState()).isEqualTo(ProcessInstance.STATE_ACTIVE);
ksession = restoreSession(ksession, true);
ksession.getWorkItemManager().registerWorkItemHandler("Email1", new SystemOutWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("Email2", new DoNothingWorkItemHandler());
ksession.signalEvent("Yes", "YesValue", processInstance.getId());
assertThat(processInstance.getState()).isEqualTo(ProcessInstance.STATE_ACTIVE);
ksession = restoreSession(ksession, true);
ksession.getWorkItemManager().registerWorkItemHandler("Email1", new SystemOutWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("Email2", new DoNothingWorkItemHandler());
// No
ksession.signalEvent("No", "NoValue", processInstance.getId());
}
use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class DataTest method testEvaluationProcess2.
@Test
public void testEvaluationProcess2() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-EvaluationProcess2.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
Map<String, Object> params = new HashMap<String, Object>();
params.put("employee", "UserId-12345");
ProcessInstance processInstance = ksession.startProcess("com.sample.evaluation", params);
assertProcessInstanceCompleted(processInstance);
}
use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class DataTest method testEvaluationProcess.
@Test
public void testEvaluationProcess() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-EvaluationProcess.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("RegisterRequest", new SystemOutWorkItemHandler());
Map<String, Object> params = new HashMap<String, Object>();
params.put("employee", "UserId-12345");
ProcessInstance processInstance = ksession.startProcess("Evaluation", params);
assertProcessInstanceCompleted(processInstance);
}
Aggregations