Skip to content

Commit

Permalink
[incubator-kie-issues-1131] testSubProcessWithTerminateEndEventProces…
Browse files Browse the repository at this point in the history
…sScope changes
  • Loading branch information
Abhitocode committed May 21, 2024
1 parent 5c499ff commit bea3415
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ActivityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -649,19 +649,25 @@ public void testSubProcessWithTerminateEndEvent() {
public void testSubProcessWithTerminateEndEventProcessScope() {

Application app = ProcessTestHelper.newApplication();
EventTrackerProcessListener listener = new EventTrackerProcessListener();
final List<String> nodeList = new ArrayList<>();
EventTrackerProcessListener listener = new EventTrackerProcessListener() {

@Override
public void afterNodeTriggered(ProcessNodeTriggeredEvent event) {
NodeInstance nodeInstance = event.getNodeInstance();
if (!(nodeInstance instanceof EndNodeInstance || nodeInstance instanceof StartNodeInstance)) {
nodeList.add(nodeInstance.getNodeName());
}
}
};
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))
.collect(Collectors.toSet());
assertThat(instance).extracting(ProcessInstance::status).isEqualTo(ProcessInstance.STATE_COMPLETED);
assertThat(processNodeEvents).hasSize(3);
assertThat(nodeList).hasSize(3);
}

@Test
Expand Down

0 comments on commit bea3415

Please sign in to comment.