diff --git a/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/WorkflowProcessInstanceImpl.java b/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/WorkflowProcessInstanceImpl.java index e185f6d0197..27a67f296e1 100755 --- a/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/WorkflowProcessInstanceImpl.java +++ b/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/WorkflowProcessInstanceImpl.java @@ -442,8 +442,6 @@ public void setState(final int state, String outcome) { removeEventListeners(); processRuntime.getProcessInstanceManager().removeProcessInstance(this); - processRuntime.getProcessEventSupport().fireAfterProcessCompleted(this, kruntime); - if (isSignalCompletion()) { List listeners = eventListeners.get("processInstanceCompleted:" + getStringId()); @@ -455,6 +453,8 @@ public void setState(final int state, String outcome) { processRuntime.getSignalManager().signalEvent("processInstanceCompleted:" + getStringId(), this); } + processRuntime.getProcessEventSupport().fireAfterProcessCompleted(this, kruntime); + } else { super.setState(state, outcome); } diff --git a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/StandaloneBPMNProcessTest.java b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/StandaloneBPMNProcessTest.java index de8df91a30c..e77cbfa99a8 100755 --- a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/StandaloneBPMNProcessTest.java +++ b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/StandaloneBPMNProcessTest.java @@ -400,8 +400,7 @@ public void testEventBasedSplit2() throws Exception { org.kie.kogito.process.ProcessInstance instanceTimer = processDefinition.createInstance(modelTimer); instanceTimer.start(); assertThat(instanceTimer.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_ACTIVE); - assertThat(countDownListener.waitTillCompleted(15000)).isTrue(); - assertThat(instanceYes.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_COMPLETED); + assertThat(countDownListener.waitTillCompleted()).isTrue(); assertThat(instanceTimer.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_COMPLETED); }