josedee commented on code in PR #7208:
URL: https://github.com/apache/incubator-kie/pull/7208#discussion_r4415722802


##########
kogito-jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/foreach/MiParentProcess.bpmn2:
##########
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<definitions id="MiParentProcessDef"
+             targetNamespace="http://www.example.org/MinimalExample";
+             typeLanguage="http://www.java.com/javaTypes";
+             expressionLanguage="http://www.mvel.org/2.0";
+             xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL";
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+             xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL 
BPMN20.xsd"
+             xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI";
+             xmlns:dc="http://www.omg.org/spec/DD/20100524/DC";
+             xmlns:di="http://www.omg.org/spec/DD/20100524/DI";
+             xmlns:tns="http://www.jboss.org/drools";>
+
+  <itemDefinition id="_itemListItem" structureRef="java.util.List"/>
+
+  <process processType="Private" isExecutable="true" id="MiParentProcess"

Review Comment:
   Even though only used for tests, I think ideally to manually invoke this in 
a business service `processType="Public"`



##########
kogito-jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ForEachParallelSubProcessAsyncTest.java:
##########
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jbpm.bpmn2;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.jbpm.bpmn2.foreach.MiChildProcessProcess;
+import org.jbpm.bpmn2.foreach.MiParentProcessModel;
+import org.jbpm.bpmn2.foreach.MiParentProcessProcess;
+import org.jbpm.test.utils.ProcessTestHelper;
+import org.junit.jupiter.api.Test;
+import org.kie.api.event.process.ProcessStartedEvent;
+import org.kie.kogito.Application;
+import org.kie.kogito.internal.process.event.DefaultKogitoProcessEventListener;
+import org.kie.kogito.internal.process.runtime.KogitoProcessInstance;
+import org.kie.kogito.process.ProcessInstance;
+import org.kie.kogito.process.workitems.impl.DefaultKogitoWorkItemHandler;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Tests that a parallel multi-instance call activity whose child subprocess
+ * contains an async node (e.g. a {@code customAsync} script task) and 
wait-state
+ * user tasks launches all child instances in parallel, rather than falling 
back
+ * to sequential execution.
+ *
+ * <p>
+ * Previously, {@code ForEachNodeInstance} fell back to sequential mode when
+ * child instances contained asynchronous nodes.
+ */
+public class ForEachParallelSubProcessAsyncTest {
+
+    @Test
+    public void 
testParallelMISubProcessWithAsyncNodeCreatesAllChildInstancesUpFront() {
+        Application app = ProcessTestHelper.newApplication();
+        ProcessTestHelper.registerHandler(app, "Human Task", new 
DefaultKogitoWorkItemHandler());
+
+        final List<String> childInstanceIds = new ArrayList<>();
+        ProcessTestHelper.registerProcessEventListener(app, new 
DefaultKogitoProcessEventListener() {
+            @Override
+            public void beforeProcessStarted(ProcessStartedEvent event) {
+                if 
("MiChildProcess".equals(event.getProcessInstance().getProcessId())) {
+                    childInstanceIds.add(((KogitoProcessInstance) 
event.getProcessInstance()).getStringId());
+                }
+            }
+        });
+
+        MiChildProcessProcess.newProcess(app);
+        org.kie.kogito.process.Process<MiParentProcessModel> parentProcess = 
MiParentProcessProcess.newProcess(app);

Review Comment:
   Nitpick: I think to be clean let's use import instead of fully qualified 
package name



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