diff --git a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/EscalationEventTest.java b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/EscalationEventTest.java index 5193317975b..f6568f8df9a 100755 --- a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/EscalationEventTest.java +++ b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/EscalationEventTest.java @@ -20,14 +20,22 @@ import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; +import org.jbpm.bpmn2.escalation.EscalationBoundaryEventModel; +import org.jbpm.bpmn2.escalation.EscalationBoundaryEventProcess; import org.jbpm.bpmn2.escalation.EscalationBoundaryEventWithTaskModel; import org.jbpm.bpmn2.escalation.EscalationBoundaryEventWithTaskProcess; +import org.jbpm.bpmn2.escalation.EscalationEndEventHandlingModel; +import org.jbpm.bpmn2.escalation.EscalationEndEventHandlingProcess; +import org.jbpm.bpmn2.escalation.EscalationEndEventModel; +import org.jbpm.bpmn2.escalation.EscalationEndEventProcess; +import org.jbpm.bpmn2.escalation.EscalationWithDataMappingModel; +import org.jbpm.bpmn2.escalation.EscalationWithDataMappingProcess; import org.jbpm.bpmn2.escalation.EventSubprocessEscalationModel; import org.jbpm.bpmn2.escalation.EventSubprocessEscalationProcess; +import org.jbpm.bpmn2.escalation.IntermediateThrowEventEscalationModel; +import org.jbpm.bpmn2.escalation.IntermediateThrowEventEscalationProcess; import org.jbpm.bpmn2.escalation.MultiEscalationModel; import org.jbpm.bpmn2.escalation.MultiEscalationProcess; import org.jbpm.bpmn2.escalation.TopLevelEscalationModel; @@ -162,10 +170,14 @@ public void afterNodeLeft(ProcessNodeLeftEvent event) { } @Test - public void testEscalationBoundaryEvent() throws Exception { - kruntime = createKogitoProcessRuntime("org/jbpm/bpmn2/escalation/BPMN2-EscalationBoundaryEvent.bpmn2"); - KogitoProcessInstance processInstance = kruntime.startProcess("EscalationBoundaryEvent"); - assertProcessInstanceCompleted(processInstance); + public void testEscalationBoundaryEvent() { + Application app = ProcessTestHelper.newApplication(); + org.kie.kogito.process.Process processDefinition = EscalationBoundaryEventProcess.newProcess(app); + + EscalationBoundaryEventModel model = processDefinition.createModel(); + org.kie.kogito.process.ProcessInstance instance = processDefinition.createInstance(model); + instance.start(); + assertThat(instance.status()).isEqualTo(ProcessInstance.STATE_COMPLETED); } @Test @@ -192,10 +204,13 @@ public void testEscalationBoundaryEventInterruptsTask() throws Exception { } @Test - public void testEscalationIntermediateThrowEventProcess() throws Exception { - kruntime = createKogitoProcessRuntime("org/jbpm/bpmn2/escalation/BPMN2-IntermediateThrowEventEscalation.bpmn2"); - KogitoProcessInstance processInstance = kruntime.startProcess("IntermediateThrowEventEscalation"); - assertProcessInstanceAborted(processInstance); + public void testEscalationIntermediateThrowEventProcess() { + Application app = ProcessTestHelper.newApplication(); + org.kie.kogito.process.Process processDefinition = IntermediateThrowEventEscalationProcess.newProcess(app); + IntermediateThrowEventEscalationModel model = processDefinition.createModel(); + org.kie.kogito.process.ProcessInstance instance = processDefinition.createInstance(model); + instance.start(); + assertThat(instance.status()).isEqualTo(ProcessInstance.STATE_ABORTED); } @Test @@ -268,29 +283,37 @@ public void testNonInterruptingEscalationBoundaryEventOnTask() throws Exception } @Test - public void testEscalationEndEventProcess() throws Exception { - kruntime = createKogitoProcessRuntime("org/jbpm/bpmn2/escalation/BPMN2-EscalationEndEvent.bpmn2"); - KogitoProcessInstance processInstance = kruntime.startProcess("EscalationEndEvent"); - assertProcessInstanceAborted(processInstance.getStringId(), kruntime); + public void testEscalationEndEventProcess() { + Application app = ProcessTestHelper.newApplication(); + org.kie.kogito.process.Process processDefinition = EscalationEndEventProcess.newProcess(app); + EscalationEndEventModel model = processDefinition.createModel(); + org.kie.kogito.process.ProcessInstance instance = processDefinition.createInstance(model); + instance.start(); + assertThat(instance.status()).isEqualTo(ProcessInstance.STATE_ABORTED); } @Test - public void testEscalationBoundaryEventAndIntermediate() throws Exception { - kruntime = createKogitoProcessRuntime("org/jbpm/bpmn2/escalation/BPMN2-EscalationWithDataMapping.bpmn2"); - Map sessionArgs = new HashMap<>(); - sessionArgs.put("Property_2", new java.lang.RuntimeException()); - KogitoProcessInstance processInstance = kruntime.startProcess("EscalationWithDataMapping", sessionArgs); - assertProcessInstanceCompleted(processInstance); - assertProcessVarValue(processInstance, "Property_3", "java.lang.RuntimeException"); + public void testEscalationBoundaryEventAndIntermediate() { + Application app = ProcessTestHelper.newApplication(); + org.kie.kogito.process.Process processDefinition = EscalationWithDataMappingProcess.newProcess(app); + EscalationWithDataMappingModel model = processDefinition.createModel(); + model.setProperty_2("java.lang.RuntimeException"); + org.kie.kogito.process.ProcessInstance instance = processDefinition.createInstance(model); + instance.start(); + assertThat(instance.status()).isEqualTo(ProcessInstance.STATE_COMPLETED); + assertThat(instance.variables().getProperty_3()).isEqualTo("java.lang.RuntimeException"); } @Test - public void testHandledEscalationEndEventProcess() throws Exception { - kruntime = createKogitoProcessRuntime("org/jbpm/bpmn2/escalation/BPMN2-EscalationEndEventHandling.bpmn2"); + public void testHandledEscalationEndEventProcess() { + Application app = ProcessTestHelper.newApplication(); - Map parameters = new HashMap<>(); - parameters.put("hello", 70); - KogitoProcessInstance processInstance = kruntime.startProcess("EscalationEndEventHandling", parameters); - assertProcessInstanceFinished(processInstance, kruntime); + org.kie.kogito.process.Process processDefinition = EscalationEndEventHandlingProcess.newProcess(app); + EscalationEndEventHandlingModel model = processDefinition.createModel(); + model.setHello(70); + + org.kie.kogito.process.ProcessInstance instance = processDefinition.createInstance(model); + instance.start(); + assertThat(instance.status()).isEqualTo(ProcessInstance.STATE_COMPLETED); } }