martinweiler commented on code in PR #3815:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3815#discussion_r1894305700
##########
jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/FlowTest.java:
##########
@@ -857,30 +857,32 @@ public void beforeNodeTriggered(ProcessNodeTriggeredEvent
event) {
}
});
+
TestWorkItemHandler handler = new TestWorkItemHandler();
TestWorkItemHandler handler2 = new TestWorkItemHandler();
- kruntime.getKogitoWorkItemManager().registerWorkItemHandler("testWI",
handler);
- kruntime.getKogitoWorkItemManager().registerWorkItemHandler("testWI2",
handler2);
- Map<String, Object> params = new HashMap<>();
- params.put("x", -1);
- KogitoProcessInstance processInstance =
kruntime.startProcess("Process_1", params);
+ ProcessTestHelper.registerHandler(app, "testWI", handler);
+ ProcessTestHelper.registerHandler(app, "testWI2", handler2);
- assertProcessInstanceActive(processInstance);
+ Process<InclusiveGatewayWithLoopInsideSubprocessModel> process =
InclusiveGatewayWithLoopInsideSubprocessProcess.newProcess(app);
+ InclusiveGatewayWithLoopInsideSubprocessModel model =
process.createModel();
+ model.setX(-1);
+ ProcessInstance<InclusiveGatewayWithLoopInsideSubprocessModel>
instance = process.createInstance(model);
+ instance.start();
+
+ assertThat(instance.status()).isEqualTo(ProcessInstance.STATE_ACTIVE);
List<KogitoWorkItem> workItems = handler.getWorkItems();
assertThat(workItems).isNotNull().hasSize(2);
-
for (KogitoWorkItem wi : workItems) {
- assertProcessInstanceActive(processInstance);
-
kruntime.getKogitoWorkItemManager().completeWorkItem(wi.getStringId(), null);
+
assertThat(instance.status()).isEqualTo(ProcessInstance.STATE_ACTIVE);
+ instance.completeWorkItem(wi.getStringId(), null);
}
-
- assertProcessInstanceActive(processInstance);
-
kruntime.getKogitoWorkItemManager().completeWorkItem(handler2.getWorkItem().getStringId(),
null);
- assertProcessInstanceActive(processInstance);
-
kruntime.getKogitoWorkItemManager().completeWorkItem(handler2.getWorkItem().getStringId(),
null);
- assertProcessInstanceActive(processInstance);
-
kruntime.getKogitoWorkItemManager().completeWorkItem(handler.getWorkItem().getStringId(),
null);
- assertProcessInstanceCompleted(processInstance);
+ assertThat(instance.status()).isEqualTo(ProcessInstance.STATE_ACTIVE);
+ instance.completeWorkItem(handler2.getWorkItem().getStringId(),
null);//After this line, state of the process instance is error state instead
of active
Review Comment:
good catch, thanks! comment removed now
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]