Abhitocode commented on code in PR #3649:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3649#discussion_r1738033866


##########
jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/FlowTest.java:
##########
@@ -892,69 +888,28 @@ public void beforeNodeTriggered(ProcessNodeTriggeredEvent 
event) {
     }
 
     @Test
-    public void testMultiInstanceLoopCharacteristicsProcessWithORGateway()
-            throws Exception {
-        kruntime = 
createKogitoProcessRuntime("org/jbpm/bpmn2/flow/BPMN2-MultiInstanceLoopCharacteristicsProcessWithORgateway.bpmn2");
-
+    public void testMultiInstanceLoopCharacteristicsProcessWithORGateway() {
+        Application app = ProcessTestHelper.newApplication();
         TestWorkItemHandler workItemHandler = new TestWorkItemHandler();
-        kruntime.getKogitoWorkItemManager().registerWorkItemHandler("Human 
Task",
-                workItemHandler);
-        Map<String, Object> params = new HashMap<>();
+        ProcessTestHelper.registerHandler(app, "Human Task", workItemHandler);
+        
org.kie.kogito.process.Process<MultiInstanceLoopCharacteristicsProcessWithORgatewayModel>
 definition = 
MultiInstanceLoopCharacteristicsProcessWithORgatewayProcess.newProcess(app);
+        MultiInstanceLoopCharacteristicsProcessWithORgatewayModel model = 
definition.createModel();
         List<Integer> myList = new ArrayList<>();
         myList.add(12);
         myList.add(15);
-        params.put("list", myList);
-        KogitoProcessInstance processInstance = kruntime.startProcess(
-                "MultiInstanceLoopCharacteristicsProcessWithORgateway", 
params);
-
+        model.setList(myList);
+        
ProcessInstance<MultiInstanceLoopCharacteristicsProcessWithORgatewayModel> 
processInstance = definition.createInstance(model);
+        processInstance.start();
         List<KogitoWorkItem> workItems = workItemHandler.getWorkItems();
         assertThat(workItems).hasSize(4);
-
-        Collection<NodeInstance> nodeInstances = 
((WorkflowProcessInstanceImpl) processInstance)
-                .getNodeInstances();
-        assertThat(nodeInstances).hasSize(1);
-        NodeInstance nodeInstance = nodeInstances.iterator().next();
-        assertThat(nodeInstance).isInstanceOf(ForEachNodeInstance.class);
-
-        Collection<NodeInstance> nodeInstancesChild = ((ForEachNodeInstance) 
nodeInstance)
-                .getNodeInstances();
-        assertThat(nodeInstancesChild).hasSize(2);
-
-        for (NodeInstance child : nodeInstancesChild) {
-            assertThat(child).isInstanceOf(CompositeContextNodeInstance.class);
-            assertThat(((CompositeContextNodeInstance) child)
-                    .getNodeInstances()).hasSize(2);
-        }
-
-        kruntime.getKogitoWorkItemManager().completeWorkItem(
-                workItems.get(0).getStringId(), null);
-        kruntime.getKogitoWorkItemManager().completeWorkItem(
-                workItems.get(1).getStringId(), null);
-
-        processInstance = 
kruntime.getProcessInstance(processInstance.getStringId());
-        nodeInstances = ((WorkflowProcessInstanceImpl) processInstance)
-                .getNodeInstances();
-        assertThat(nodeInstances).hasSize(1);
-        nodeInstance = nodeInstances.iterator().next();
-        assertThat(nodeInstance).isInstanceOf(ForEachNodeInstance.class);
-
-        nodeInstancesChild = ((ForEachNodeInstance) nodeInstance)
-                .getNodeInstances();
-        assertThat(nodeInstancesChild).hasSize(2);
-
-        Iterator<NodeInstance> childIterator = nodeInstancesChild
-                .iterator();
-
-        
assertThat(childIterator.next()).isInstanceOf(CompositeContextNodeInstance.class);
-        
assertThat(childIterator.next()).isInstanceOf(ForEachJoinNodeInstance.class);
-
-        kruntime.getKogitoWorkItemManager().completeWorkItem(
-                workItems.get(2).getStringId(), null);
-        kruntime.getKogitoWorkItemManager().completeWorkItem(
-                workItems.get(3).getStringId(), null);
-
-        assertProcessInstanceFinished(processInstance, kruntime);
-

Review Comment:
   @martinweiler, Not specifically but I thought it would be sufficient capture 
the behaviour of the process properly for the migrated one than checking the 
node instances for this test. I will include the missing asserts and update 
again.
   
   



-- 
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]

Reply via email to