From 79ff6594344a550ee871fcc2ac893069a0960112 Mon Sep 17 00:00:00 2001 From: Abhiram Gundala <164050036+Abhitocode@users.noreply.github.com> Date: Mon, 16 Sep 2024 13:42:36 -0400 Subject: [PATCH 1/2] [incubator-kie-issues-1131] v7 migration to code generation --- .../java/org/jbpm/bpmn2/ActivityTest.java | 36 ++++++++++++------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ActivityTest.java b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ActivityTest.java index 4a8cca632c9..09b9d9a715f 100755 --- a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ActivityTest.java +++ b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ActivityTest.java @@ -119,6 +119,9 @@ import org.jbpm.bpmn2.subprocess.CallActivityWithBoundaryEventProcess; import org.jbpm.bpmn2.subprocess.CallActivityWithIOexpressionModel; import org.jbpm.bpmn2.subprocess.CallActivityWithIOexpressionProcess; +import org.jbpm.bpmn2.subprocess.ErrorsBetweenProcessModel; +import org.jbpm.bpmn2.subprocess.ErrorsBetweenProcessProcess; +import org.jbpm.bpmn2.subprocess.ErrorsBetweenSubProcessProcess; import org.jbpm.bpmn2.subprocess.InputMappingUsingValueModel; import org.jbpm.bpmn2.subprocess.InputMappingUsingValueProcess; import org.jbpm.bpmn2.subprocess.MainGroupAssignmentModel; @@ -176,6 +179,7 @@ import org.kie.api.definition.process.NodeContainer; import org.kie.api.definition.process.Process; import org.kie.api.definition.process.WorkflowElementIdentifier; +import org.kie.api.event.process.ProcessCompletedEvent; import org.kie.api.event.process.ProcessNodeEvent; import org.kie.api.event.process.ProcessNodeTriggeredEvent; import org.kie.api.event.process.ProcessStartedEvent; @@ -1497,20 +1501,26 @@ public void testServiceTaskWithMvelJaxbTransformation() throws Exception { } @Test - public void testErrorBetweenProcessesProcess() throws Exception { - kruntime = createKogitoProcessRuntime("org/jbpm/bpmn2/subprocess/BPMN2-ErrorsBetweenProcess.bpmn2", - "org/jbpm/bpmn2/subprocess/BPMN2-ErrorsBetweenSubProcess.bpmn2"); - - Map variables = new HashMap<>(); - - variables.put("tipoEvento", "error"); - variables.put("pasoVariable", 3); - KogitoProcessInstance processInstance = kruntime.startProcess("ErrorsBetweenProcess", variables); - - assertProcessInstanceCompleted(processInstance.getStringId(), kruntime); - assertProcessInstanceAborted(processInstance.getStringId() + 1, kruntime); + public void testErrorBetweenProcessesProcess() { + Application app = ProcessTestHelper.newApplication(); + ProcessTestHelper.registerProcessEventListener(app, new DefaultKogitoProcessEventListener() { + @Override + public void afterProcessCompleted(ProcessCompletedEvent event) { + if ("ErrorsBetweenSubProcess".equals(event.getProcessInstance().getProcessId())) { + assertThat(event.getProcessInstance().getState()).isEqualTo(ProcessInstance.STATE_ABORTED); + } + } + }); + ErrorsBetweenSubProcessProcess.newProcess(app); + org.kie.kogito.process.Process process = ErrorsBetweenProcessProcess.newProcess(app); + ErrorsBetweenProcessModel model = process.createModel(); + model.setTipoEvento("error"); + model.setPasoVariable(3); + ProcessInstance processInstance = process.createInstance(model); + processInstance.start(); + assertThat(processInstance.status()).isEqualTo(ProcessInstance.STATE_COMPLETED); - assertProcessVarValue(processInstance, "event", "error desde Subproceso"); + Assertions.assertEquals("error desde Subproceso", processInstance.variables().getEvent()); } @Test From 2d14130376a5778f40389d7bc050a67ed3cca37a Mon Sep 17 00:00:00 2001 From: Abhiram Gundala <164050036+Abhitocode@users.noreply.github.com> Date: Sun, 15 Dec 2024 22:17:59 -0500 Subject: [PATCH 2/2] incubator-kie-issues-1131 --- jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ActivityTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ActivityTest.java b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ActivityTest.java index 09b9d9a715f..4058c91904a 100755 --- a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ActivityTest.java +++ b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ActivityTest.java @@ -1520,7 +1520,7 @@ public void afterProcessCompleted(ProcessCompletedEvent event) { processInstance.start(); assertThat(processInstance.status()).isEqualTo(ProcessInstance.STATE_COMPLETED); - Assertions.assertEquals("error desde Subproceso", processInstance.variables().getEvent()); + assertThat(processInstance.variables().getEvent()).isEqualTo("error desde Subproceso"); } @Test