elguardian commented on code in PR #3559:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3559#discussion_r1679413520
##########
jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ActivityTest.java:
##########
@@ -976,48 +991,55 @@ public void testCallActivityWithBoundaryEvent() throws
Exception {
}
@Test
- public void testCallActivityWithSubProcessWaitState() throws Exception {
- kruntime = createKogitoProcessRuntime(
-
"org/jbpm/bpmn2/subprocess/BPMN2-CallActivityProcessWithBoundaryEvent.bpmn2",
-
"org/jbpm/bpmn2/subprocess/BPMN2-CallActivitySubProcessWithBoundaryEvent.bpmn2");
-
+ public void testCallActivityWithSubProcessWaitState() {
+ Application app = ProcessTestHelper.newApplication();
TestWorkItemHandler workItemHandler = new TestWorkItemHandler();
- kruntime.getKogitoWorkItemManager().registerWorkItemHandler("Human
Task",
- workItemHandler);
- Map<String, Object> params = new HashMap<>();
- KogitoProcessInstance processInstance =
kruntime.startProcess("CallActivityProcessWithBoundaryEvent", params);
- assertProcessInstanceActive(processInstance.getStringId(), kruntime);
-
- org.kie.kogito.internal.process.runtime.KogitoWorkItem wi =
workItemHandler.getWorkItem();
- assertThat(wi).isNotNull();
-
- kruntime.getKogitoWorkItemManager().completeWorkItem(wi.getStringId(),
null);
+ ProcessTestHelper.registerHandler(app, "Human Task", workItemHandler);
+
+
org.kie.kogito.process.Process<CallActivitySubProcessWithBoundaryEventModel>
callActivitySubProcessWithBoundaryEventProcess =
CallActivitySubProcessWithBoundaryEventProcess.newProcess(app);
+ ProcessInstance<CallActivitySubProcessWithBoundaryEventModel>
subProcessInstance =
+
callActivitySubProcessWithBoundaryEventProcess.createInstance(callActivitySubProcessWithBoundaryEventProcess.createModel());
+
org.kie.kogito.process.Process<CallActivityProcessWithBoundaryEventModel>
process = CallActivityProcessWithBoundaryEventProcess.newProcess(app);
+ CallActivityProcessWithBoundaryEventModel model =
process.createModel();
+ ProcessInstance<CallActivityProcessWithBoundaryEventModel>
processInstance = process.createInstance(model);
+ processInstance.start();
- assertProcessInstanceFinished(processInstance, kruntime);
- // first check the parent process executed nodes
- assertNodeTriggered(processInstance.getStringId(), "StartProcess",
"Call Activity 1", "EndProcess");
- // then check child process executed nodes - is there better way to
get child process id than simply increment?
- assertNodeTriggered(processInstance.getStringId() + 1,
"StartProcess2", "User Task", "EndProcess");
+
assertThat(processInstance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_ACTIVE);
+ org.kie.kogito.internal.process.runtime.KogitoWorkItem workItem =
workItemHandler.getWorkItem();
+ assertThat(workItem).isNotNull();
+ subProcessInstance.completeWorkItem(workItem.getStringId(),
Collections.emptyMap());
+
assertThat(processInstance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_COMPLETED);
+ Collection<String> processNodes =
process.findNodes(Objects::nonNull).stream().map(Node::getName).collect(Collectors.toSet());
+ Collection<String> subProcessNodes =
callActivitySubProcessWithBoundaryEventProcess.findNodes(Objects::nonNull).stream().map(Node::getName).collect(Collectors.toSet());
+ System.out.println("process nodes: " + processNodes);
Review Comment:
try to avoid system out
--
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]