use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class IntermediateEventTest method testEventBasedSplit3.
@Test
public void testEventBasedSplit3() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-EventBasedSplit3.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Email1", new SystemOutWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("Email2", new SystemOutWorkItemHandler());
Person jack = new Person();
jack.setName("Jack");
// Yes
ProcessInstance processInstance = ksession.startProcess("com.sample.test");
assertProcessInstanceActive(processInstance);
ksession = restoreSession(ksession, true);
ksession.getWorkItemManager().registerWorkItemHandler("Email1", new SystemOutWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("Email2", new SystemOutWorkItemHandler());
ksession.signalEvent("Yes", "YesValue", processInstance.getId());
assertProcessInstanceFinished(processInstance, ksession);
// Condition
processInstance = ksession.startProcess("com.sample.test");
assertProcessInstanceActive(processInstance);
ksession = restoreSession(ksession, true);
ksession.getWorkItemManager().registerWorkItemHandler("Email1", new SystemOutWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("Email2", new SystemOutWorkItemHandler());
ksession.insert(jack);
assertProcessInstanceFinished(processInstance, ksession);
}
use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class IntermediateEventTest method testEventBasedSplit.
@Test
public void testEventBasedSplit() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-EventBasedSplit.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Email1", new SystemOutWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("Email2", new SystemOutWorkItemHandler());
// Yes
ProcessInstance processInstance = ksession.startProcess("com.sample.test");
assertProcessInstanceActive(processInstance);
ksession = restoreSession(ksession, true);
ksession.getWorkItemManager().registerWorkItemHandler("Email1", new SystemOutWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("Email2", new SystemOutWorkItemHandler());
ksession.signalEvent("Yes", "YesValue", processInstance.getId());
assertProcessInstanceFinished(processInstance, ksession);
// No
processInstance = ksession.startProcess("com.sample.test");
assertProcessInstanceActive(processInstance);
ksession = restoreSession(ksession, true);
ksession.getWorkItemManager().registerWorkItemHandler("Email1", new SystemOutWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("Email2", new SystemOutWorkItemHandler());
ksession.signalEvent("No", "NoValue", processInstance.getId());
assertProcessInstanceFinished(processInstance, ksession);
}
use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class IntermediateEventTest method testIntermediateCatchEventMessageWithTransformation.
@Test
public void testIntermediateCatchEventMessageWithTransformation() throws Exception {
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-IntermediateCatchEventMessageWithTransformation.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
ProcessInstance processInstance = ksession.startProcess("IntermediateCatchEvent");
assertProcessInstanceActive(processInstance);
ksession = restoreSession(ksession, true);
// now signal process instance
ksession.signalEvent("Message-HelloMessage", "SomeValue", processInstance.getId());
assertProcessInstanceFinished(processInstance, ksession);
String var = getProcessVarValue(processInstance, "x");
assertThat(var).isNotNull();
assertThat(var).isEqualTo("SOMEVALUE");
}
use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class IntermediateEventTest method testIntermediateCatchEventMessage.
@Test
public void testIntermediateCatchEventMessage() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-IntermediateCatchEventMessage.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
ProcessInstance processInstance = ksession.startProcess("IntermediateCatchEvent");
assertProcessInstanceActive(processInstance);
ksession = restoreSession(ksession, true);
// now signal process instance
ksession.signalEvent("Message-HelloMessage", "SomeValue", processInstance.getId());
assertProcessInstanceFinished(processInstance, ksession);
}
use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class IntermediateEventTest method testSignalIntermediateThrowWithVariable.
@Test
public void testSignalIntermediateThrowWithVariable() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-IntermediateThrowEventSignalWithVariable.bpmn2", "BPMN2-IntermediateCatchEventSignalWithVariable.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
// create catch process instance
String signalVar = "myVarSignal";
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("signalName", signalVar);
ProcessInstance processInstance = ksession.startProcess("IntermediateCatchEvent", parameters);
assertProcessInstanceActive(processInstance);
ksession = restoreSession(ksession, true);
Map<String, Object> params = new HashMap<String, Object>();
params.put("x", "MyValue");
params.put("signalName", signalVar);
ProcessInstance processInstanceThrow = ksession.startProcess("SignalIntermediateEvent", params);
assertThat(processInstanceThrow.getState()).isEqualTo(ProcessInstance.STATE_COMPLETED);
// catch process instance should now be completed
assertProcessInstanceFinished(processInstance, ksession);
}
Aggregations