martinweiler commented on code in PR #3519:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3519#discussion_r1609929636
##########
jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ActivityTest.java:
##########
@@ -607,36 +592,40 @@ public void testMultiinstanceSubProcessWrongStartEvent()
throws Exception {
}
@Test
- public void testSubProcessWithTerminateEndEvent() throws Exception {
- kruntime =
createKogitoProcessRuntime("org/jbpm/bpmn2/subprocess/BPMN2-SubProcessWithTerminateEndEvent.bpmn2");
- final List<String> list = new ArrayList<>();
- kruntime.getProcessEventManager().addEventListener(new
DefaultKogitoProcessEventListener() {
+ public void testSubProcessWithTerminateEndEvent() {
+ Application app = ProcessTestHelper.newApplication();
+ EventTrackerProcessListener listener = new
EventTrackerProcessListener();
+ ProcessTestHelper.registerProcessEventListener(app, listener);
+ org.kie.kogito.process.Process<SubProcessWithTerminateEndEventModel>
processDefinition = SubProcessWithTerminateEndEventProcess.newProcess(app);
+ SubProcessWithTerminateEndEventModel model =
processDefinition.createModel();
+
+
org.kie.kogito.process.ProcessInstance<SubProcessWithTerminateEndEventModel>
instance = processDefinition.createInstance(model);
+ instance.start();
+ Set<NodeInstance> processNodeEvents = listener.tracked().stream()
+ .map(ProcessNodeEvent::getNodeInstance)
+ .collect(Collectors.toSet());
+
assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_COMPLETED);
+ assertThat(processNodeEvents).hasSize(7);
- @Override
- public void afterNodeTriggered(ProcessNodeTriggeredEvent event) {
- list.add(event.getNodeInstance().getNodeName());
- }
- });
- KogitoProcessInstance processInstance =
kruntime.startProcess("SubProcessWithTerminateEndEvent");
- assertProcessInstanceCompleted(processInstance);
- assertThat(list).hasSize(7);
}
@Test
- public void testSubProcessWithTerminateEndEventProcessScope()
- throws Exception {
- kruntime =
createKogitoProcessRuntime("org/jbpm/bpmn2/subprocess/BPMN2-SubProcessWithTerminateEndEventProcessScope.bpmn2");
- final List<String> list = new ArrayList<>();
- kruntime.getProcessEventManager().addEventListener(new
DefaultKogitoProcessEventListener() {
+ public void testSubProcessWithTerminateEndEventProcessScope() {
- @Override
- public void afterNodeTriggered(ProcessNodeTriggeredEvent event) {
- list.add(event.getNodeInstance().getNodeName());
- }
- });
- KogitoProcessInstance processInstance =
kruntime.startProcess("SubProcessWithTerminateEndEventProcessScope");
- assertProcessInstanceCompleted(processInstance);
- assertThat(list).hasSize(5);
+ Application app = ProcessTestHelper.newApplication();
+ EventTrackerProcessListener listener = new
EventTrackerProcessListener();
+ ProcessTestHelper.registerProcessEventListener(app, listener);
+
org.kie.kogito.process.Process<SubProcessWithTerminateEndEventProcessScopeModel>
processDefinition =
SubProcessWithTerminateEndEventProcessScopeProcess.newProcess(app);
+ SubProcessWithTerminateEndEventProcessScopeModel model =
processDefinition.createModel();
+
+
org.kie.kogito.process.ProcessInstance<SubProcessWithTerminateEndEventProcessScopeModel>
instance = processDefinition.createInstance(model);
+ instance.start();
+ Set<NodeInstance> processNodeEvents = listener.tracked().stream()
+ .map(ProcessNodeEvent::getNodeInstance)
+ .filter(nodeInstance -> !(nodeInstance instanceof
EndNodeInstance || nodeInstance instanceof StartNodeInstance))
Review Comment:
Ok, from the processdefinition I'd expect to see 7 node triggered events
instead of 5 anyway (including the duplicates for start/end), so if there is
anything to question it is probably why the initial version had a check for 5.
--
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]