use of org.kie.internal.runtime.StatefulKnowledgeSession in project jbpm by kiegroup.
the class IntermediateEventTest method testSignalBoundaryEventOnSubprocessTakingDifferentPaths.
@Test
public void testSignalBoundaryEventOnSubprocessTakingDifferentPaths() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-SignalBoundaryOnSubProcess.bpmn");
StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
ProcessInstance processInstance = ksession.startProcess("jbpm.testing.signal");
assertProcessInstanceActive(processInstance);
ksession.signalEvent("continue", null, processInstance.getId());
assertProcessInstanceFinished(processInstance, ksession);
ksession.dispose();
ksession = createKnowledgeSession(kbase);
processInstance = ksession.startProcess("jbpm.testing.signal");
assertProcessInstanceActive(processInstance);
ksession.signalEvent("forward", null);
assertProcessInstanceFinished(processInstance, ksession);
ksession.dispose();
}
use of org.kie.internal.runtime.StatefulKnowledgeSession in project jbpm by kiegroup.
the class IntermediateEventTest method testSignalBoundaryEvent.
/*
* TESTS!
*/
@Test
public void testSignalBoundaryEvent() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-BoundarySignalEventOnTaskbpmn2.bpmn", "BPMN2-IntermediateThrowEventSignal.bpmn2");
StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
TestWorkItemHandler handler = new TestWorkItemHandler();
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler);
ProcessInstance processInstance = ksession.startProcess("BoundarySignalOnTask");
ProcessInstance processInstance2 = ksession.startProcess("SignalIntermediateEvent");
assertProcessInstanceFinished(processInstance2, ksession);
assertProcessInstanceFinished(processInstance, ksession);
}
use of org.kie.internal.runtime.StatefulKnowledgeSession in project jbpm by kiegroup.
the class IntermediateEventTest method testSignalBetweenProcesses.
@Test
public void testSignalBetweenProcesses() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-IntermediateCatchSignalSingle.bpmn2", "BPMN2-IntermediateThrowEventSignal.bpmn2");
StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
TestWorkItemHandler handler = new TestWorkItemHandler();
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler);
ProcessInstance processInstance = ksession.startProcess("BPMN2-IntermediateCatchSignalSingle");
ksession.getWorkItemManager().completeWorkItem(handler.getWorkItem().getId(), null);
ProcessInstance processInstance2 = ksession.startProcess("SignalIntermediateEvent");
assertProcessInstanceFinished(processInstance2, ksession);
assertProcessInstanceFinished(processInstance, ksession);
}
use of org.kie.internal.runtime.StatefulKnowledgeSession in project jbpm by kiegroup.
the class IntermediateEventTest method testSignalBoundaryEventOnMultiInstanceSubprocess.
@Test
public void testSignalBoundaryEventOnMultiInstanceSubprocess() throws Exception {
KieBase kbase = createKnowledgeBase("subprocess/BPMN2-MultiInstanceSubprocessWithBoundarySignal.bpmn2");
StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
TestWorkItemHandler handler = new TestWorkItemHandler();
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler);
Map<String, Object> params = new HashMap<String, Object>();
List<String> approvers = new ArrayList<String>();
approvers.add("john");
approvers.add("john");
params.put("approvers", approvers);
ProcessInstance processInstance = ksession.startProcess("boundary-catch-error-event", params);
assertProcessInstanceActive(processInstance);
List<WorkItem> workItems = handler.getWorkItems();
assertThat(workItems).isNotNull();
assertThat(workItems.size()).isEqualTo(2);
ksession.signalEvent("Outside", null, processInstance.getId());
assertProcessInstanceFinished(processInstance, ksession);
ksession.dispose();
}
use of org.kie.internal.runtime.StatefulKnowledgeSession in project jbpm by kiegroup.
the class IntermediateEventTest method testSignalIntermediateThrowEventWithTransformation.
@Test
public void testSignalIntermediateThrowEventWithTransformation() throws Exception {
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-BoundarySignalEventOnTaskbpmn2.bpmn", "BPMN2-IntermediateThrowEventSignalWithTransformation.bpmn2");
StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
TestWorkItemHandler handler = new TestWorkItemHandler();
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler);
Map<String, Object> params = new HashMap<String, Object>();
params.put("x", "john");
ProcessInstance processInstance = ksession.startProcess("BoundarySignalOnTask");
ProcessInstance processInstance2 = ksession.startProcess("SignalIntermediateEvent", params);
assertProcessInstanceFinished(processInstance2, ksession);
assertProcessInstanceFinished(processInstance, ksession);
String var = getProcessVarValue(processInstance, "x");
assertThat(var).isEqualTo("JOHN");
}
Aggregations