This is an automated email from the ASF dual-hosted git repository.
fjtiradosarti pushed a commit to branch main
in repository
https://gitbox.apache.org/repos/asf/incubator-kie-kogito-runtimes.git
The following commit(s) were added to refs/heads/main by this push:
new 6d32cc4e66 Fixing status flaky test (#3777)
6d32cc4e66 is described below
commit 6d32cc4e66f3dec8a0ecaeb18992f6133af99675
Author: Francisco Javier Tirado Sarti
<[email protected]>
AuthorDate: Fri Nov 15 15:24:00 2024 +0100
Fixing status flaky test (#3777)
* Fixing status flaky test
There is a chance that status is invoked over a process instance that
has been finished, but the container kogito process instance does not
know yet, even if processcompleted listener has been executed (and thats
the issue)
Although this can be fixed by altering the order in which the different
listener are invoked (which might probably have other undesired effect),
I do not see a reason why status should not be read from underlying
process instance, if present.
Probably processInstance field should be embedded into an atomic
reference, but volatile might have the same effect with few code
changes.
* Try changing order of listeners
---
.../org/jbpm/workflow/instance/impl/WorkflowProcessInstanceImpl.java | 4 ++--
.../src/test/java/org/jbpm/bpmn2/StandaloneBPMNProcessTest.java | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
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 e185f6d019..27a67f296e 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 abstract class WorkflowProcessInstanceImpl extends
ProcessInstanceImpl im
removeEventListeners();
processRuntime.getProcessInstanceManager().removeProcessInstance(this);
-
processRuntime.getProcessEventSupport().fireAfterProcessCompleted(this,
kruntime);
-
if (isSignalCompletion()) {
List<KogitoEventListener> listeners =
eventListeners.get("processInstanceCompleted:" + getStringId());
@@ -455,6 +453,8 @@ public abstract class WorkflowProcessInstanceImpl extends
ProcessInstanceImpl im
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 de8df91a30..e77cbfa99a 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 class StandaloneBPMNProcessTest extends
JbpmBpmn2TestCase {
org.kie.kogito.process.ProcessInstance<EventBasedSplit2Model>
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);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]