You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "martinweiler (via GitHub)" <gi...@apache.org> on 2024/12/17 23:23:35 UTC

[PR] [incubator-kie-issues#1719] Enable onEntry/onExit scripts in embedded nodes [incubator-kie-kogito-runtimes]

martinweiler opened a new pull request, #3815:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3815

   Closes https://github.com/apache/incubator-kie-issues/issues/1719


-- 
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: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-issues#1719] Enable onEntry/onExit scripts in embedded nodes [incubator-kie-kogito-runtimes]

Posted by "martinweiler (via GitHub)" <gi...@apache.org>.
martinweiler commented on code in PR #3815:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3815#discussion_r1894304564


##########
jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/loop/BPMN2-MultiInstanceLoopCharacteristicsTaskWithOutputCmpCondSequential.bpmn2:
##########
@@ -45,8 +45,8 @@
     <startEvent id="_1" name="StartProcess" />
     <userTask id="_2" name="Hello" tns:taskName="Human Task">
       <extensionElements>
-        <tns:onEntry-script>
-          <tns:script>System.out.println("Hello");context.setVariable("itemOut", "test");</tns:script>
+        <tns:onEntry-script scriptFormat="http://www.java.com/java">
+          <tns:script>System.out.println("Hello");kcontext.setVariable("itemOut", "test");</tns:script>

Review Comment:
   I think you have a valid point here. Those messages are just adding noise to the log files, and don't provide any real value. I have created https://github.com/apache/incubator-kie-issues/issues/1726 now to look into this some more. This affects not only this particular bpmn file.



-- 
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: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-issues#1719] Enable onEntry/onExit scripts in embedded nodes [incubator-kie-kogito-runtimes]

Posted by "martinweiler (via GitHub)" <gi...@apache.org>.
martinweiler merged PR #3815:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3815


-- 
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: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-issues#1719] Enable onEntry/onExit scripts in embedded nodes [incubator-kie-kogito-runtimes]

Posted by "martinweiler (via GitHub)" <gi...@apache.org>.
martinweiler commented on PR #3815:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3815#issuecomment-2557594996

   @jomarko thanks for looking into this issue, and for your input. This is very much appreciated, as you bring in some new perspectives and raise valid points!
   
   Regarding your question on embedded nodes and user tasks, what is used in some of the tests here are multi-instance tasks (similar to MI subprocesses, but just in a single task). For the engine, this task is then embedded in a ForEachNode. I hope this helps to clarify.


-- 
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: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-issues#1719] Enable onEntry/onExit scripts in embedded nodes [incubator-kie-kogito-runtimes]

Posted by "kie-ci3 (via GitHub)" <gi...@apache.org>.
kie-ci3 commented on PR #3815:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3815#issuecomment-2550146667

   
   **PR job** `#1` was: **UNSTABLE**
   Possible explanation: This should be test failures
   
   
   <details>
   <summary><b>Reproducer</b></summary>
   
   
   
   build-chain build full_downstream  -f 'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml' -o 'bc' -p apache/incubator-kie-kogito-runtimes -u https://github.com/apache/incubator-kie-kogito-runtimes/pull/3815 --skipParallelCheckout
   
   NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution
   
   </details>
   
   
   Please look here: https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3815/1/display/redirect
   
   **Test results:**
   - PASSED: 3515
   - FAILED: 1
   
   Those are the test failures: 
   <details>
   <summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3815/1/testReport/org.jbpm.bpmn2/IntermediateEventTest/testMultiInstanceLoopCharacteristicsTaskWithOutputCmpCondSequential/">org.jbpm.bpmn2.IntermediateEventTest.testMultiInstanceLoopCharacteristicsTaskWithOutputCmpCondSequential</a></summary>
   <br/>Expected size: 1 but was: 0 in:<br/>[]
   </details>
   


-- 
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: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-issues#1719] Enable onEntry/onExit scripts in embedded nodes [incubator-kie-kogito-runtimes]

Posted by "pefernan (via GitHub)" <gi...@apache.org>.
pefernan commented on code in PR #3815:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3815#discussion_r1894085765


##########
jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/FlowTest.java:
##########
@@ -857,30 +857,32 @@ public void beforeNodeTriggered(ProcessNodeTriggeredEvent event) {
             }
 
         });
+
         TestWorkItemHandler handler = new TestWorkItemHandler();
         TestWorkItemHandler handler2 = new TestWorkItemHandler();
-        kruntime.getKogitoWorkItemManager().registerWorkItemHandler("testWI", handler);
-        kruntime.getKogitoWorkItemManager().registerWorkItemHandler("testWI2", handler2);
-        Map<String, Object> params = new HashMap<>();
-        params.put("x", -1);
-        KogitoProcessInstance processInstance = kruntime.startProcess("Process_1", params);
+        ProcessTestHelper.registerHandler(app, "testWI", handler);
+        ProcessTestHelper.registerHandler(app, "testWI2", handler2);
 
-        assertProcessInstanceActive(processInstance);
+        Process<InclusiveGatewayWithLoopInsideSubprocessModel> process = InclusiveGatewayWithLoopInsideSubprocessProcess.newProcess(app);

Review Comment:
   @jomarko that`InclusiveGatewayWithLoopInsideSubprocessModel ` is generated during the build, if you run a mvn clean package locally you'll find them in the project target folder under the `generated-sources` folder



-- 
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: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-issues#1719] Enable onEntry/onExit scripts in embedded nodes [incubator-kie-kogito-runtimes]

Posted by "martinweiler (via GitHub)" <gi...@apache.org>.
martinweiler commented on code in PR #3815:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3815#discussion_r1894305700


##########
jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/FlowTest.java:
##########
@@ -857,30 +857,32 @@ public void beforeNodeTriggered(ProcessNodeTriggeredEvent event) {
             }
 
         });
+
         TestWorkItemHandler handler = new TestWorkItemHandler();
         TestWorkItemHandler handler2 = new TestWorkItemHandler();
-        kruntime.getKogitoWorkItemManager().registerWorkItemHandler("testWI", handler);
-        kruntime.getKogitoWorkItemManager().registerWorkItemHandler("testWI2", handler2);
-        Map<String, Object> params = new HashMap<>();
-        params.put("x", -1);
-        KogitoProcessInstance processInstance = kruntime.startProcess("Process_1", params);
+        ProcessTestHelper.registerHandler(app, "testWI", handler);
+        ProcessTestHelper.registerHandler(app, "testWI2", handler2);
 
-        assertProcessInstanceActive(processInstance);
+        Process<InclusiveGatewayWithLoopInsideSubprocessModel> process = InclusiveGatewayWithLoopInsideSubprocessProcess.newProcess(app);
+        InclusiveGatewayWithLoopInsideSubprocessModel model = process.createModel();
+        model.setX(-1);
+        ProcessInstance<InclusiveGatewayWithLoopInsideSubprocessModel> instance = process.createInstance(model);
+        instance.start();
+
+        assertThat(instance.status()).isEqualTo(ProcessInstance.STATE_ACTIVE);
         List<KogitoWorkItem> workItems = handler.getWorkItems();
         assertThat(workItems).isNotNull().hasSize(2);
-
         for (KogitoWorkItem wi : workItems) {
-            assertProcessInstanceActive(processInstance);
-            kruntime.getKogitoWorkItemManager().completeWorkItem(wi.getStringId(), null);
+            assertThat(instance.status()).isEqualTo(ProcessInstance.STATE_ACTIVE);
+            instance.completeWorkItem(wi.getStringId(), null);
         }
-
-        assertProcessInstanceActive(processInstance);
-        kruntime.getKogitoWorkItemManager().completeWorkItem(handler2.getWorkItem().getStringId(), null);
-        assertProcessInstanceActive(processInstance);
-        kruntime.getKogitoWorkItemManager().completeWorkItem(handler2.getWorkItem().getStringId(), null);
-        assertProcessInstanceActive(processInstance);
-        kruntime.getKogitoWorkItemManager().completeWorkItem(handler.getWorkItem().getStringId(), null);
-        assertProcessInstanceCompleted(processInstance);
+        assertThat(instance.status()).isEqualTo(ProcessInstance.STATE_ACTIVE);
+        instance.completeWorkItem(handler2.getWorkItem().getStringId(), null);//After this line, state of the process instance is error state instead of active

Review Comment:
   good catch, thanks! comment removed now



-- 
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: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-issues#1719] Enable onEntry/onExit scripts in embedded nodes [incubator-kie-kogito-runtimes]

Posted by "martinweiler (via GitHub)" <gi...@apache.org>.
martinweiler commented on code in PR #3815:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3815#discussion_r1894305009


##########
jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/FlowTest.java:
##########
@@ -837,12 +839,10 @@ public void beforeNodeTriggered(ProcessNodeTriggeredEvent event) {
     }
 
     @Test
-    @Disabled("On Exit not supported, see https://issues.redhat.com/browse/KOGITO-2067")

Review Comment:
   Yes, we should, and will. But some of them require additional fixes in the engine, so we will have to tackle them one by one.



-- 
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: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie-issues#1719] Enable onEntry/onExit scripts in embedded nodes [incubator-kie-kogito-runtimes]

Posted by "jomarko (via GitHub)" <gi...@apache.org>.
jomarko commented on code in PR #3815:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/3815#discussion_r1893470258


##########
jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/loop/BPMN2-MultiInstanceLoopCharacteristicsTaskWithOutputCmpCondSequential.bpmn2:
##########
@@ -45,8 +45,8 @@
     <startEvent id="_1" name="StartProcess" />
     <userTask id="_2" name="Hello" tns:taskName="Human Task">
       <extensionElements>
-        <tns:onEntry-script>
-          <tns:script>System.out.println("Hello");context.setVariable("itemOut", "test");</tns:script>
+        <tns:onEntry-script scriptFormat="http://www.java.com/java">
+          <tns:script>System.out.println("Hello");kcontext.setVariable("itemOut", "test");</tns:script>

Review Comment:
   As I sometimes need to read build logs I would like to share these ideas:
   - is it worth to keep `System.out.println("Hello")`? It adds one more line into logs, while there is still a java code `kcontext.setVariable("itemOut", "test");` that will be executed, so we will be still sure java in entry script works
   - maybe keep the log is fine, however `"Hello"` is non unique. What do you think about `"Hello testInclusiveSplitWithLoopInsideSubprocess"` or anything that would be easier to greap or search in logs



##########
jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/FlowTest.java:
##########
@@ -857,30 +857,32 @@ public void beforeNodeTriggered(ProcessNodeTriggeredEvent event) {
             }
 
         });
+
         TestWorkItemHandler handler = new TestWorkItemHandler();
         TestWorkItemHandler handler2 = new TestWorkItemHandler();
-        kruntime.getKogitoWorkItemManager().registerWorkItemHandler("testWI", handler);
-        kruntime.getKogitoWorkItemManager().registerWorkItemHandler("testWI2", handler2);
-        Map<String, Object> params = new HashMap<>();
-        params.put("x", -1);
-        KogitoProcessInstance processInstance = kruntime.startProcess("Process_1", params);
+        ProcessTestHelper.registerHandler(app, "testWI", handler);
+        ProcessTestHelper.registerHandler(app, "testWI2", handler2);
 
-        assertProcessInstanceActive(processInstance);
+        Process<InclusiveGatewayWithLoopInsideSubprocessModel> process = InclusiveGatewayWithLoopInsideSubprocessProcess.newProcess(app);

Review Comment:
   I am sorry, this is more my missing knowledge, where I can find the binding of
   
   `BPMN2-MultiInstanceLoopCharacteristicsTaskWithOutputCmpCondSequential.bpmn2` and `InclusiveGatewayWithLoopInsideSubprocessProcess` ? Or is the first mentioned edited as part of this PR but actually has noting with `InclusiveGatewayWithLoopInsideSubprocessProcess`?
   
   



##########
jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/FlowTest.java:
##########
@@ -837,12 +839,10 @@ public void beforeNodeTriggered(ProcessNodeTriggeredEvent event) {
     }
 
     @Test
-    @Disabled("On Exit not supported, see https://issues.redhat.com/browse/KOGITO-2067")

Review Comment:
   There are 5 more tests disabled due to `https://issues.redhat.com/browse/KOGITO-2067`, shouldn't we allow also them?



##########
jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/FlowTest.java:
##########
@@ -857,30 +857,32 @@ public void beforeNodeTriggered(ProcessNodeTriggeredEvent event) {
             }
 
         });
+
         TestWorkItemHandler handler = new TestWorkItemHandler();
         TestWorkItemHandler handler2 = new TestWorkItemHandler();
-        kruntime.getKogitoWorkItemManager().registerWorkItemHandler("testWI", handler);
-        kruntime.getKogitoWorkItemManager().registerWorkItemHandler("testWI2", handler2);
-        Map<String, Object> params = new HashMap<>();
-        params.put("x", -1);
-        KogitoProcessInstance processInstance = kruntime.startProcess("Process_1", params);
+        ProcessTestHelper.registerHandler(app, "testWI", handler);
+        ProcessTestHelper.registerHandler(app, "testWI2", handler2);
 
-        assertProcessInstanceActive(processInstance);
+        Process<InclusiveGatewayWithLoopInsideSubprocessModel> process = InclusiveGatewayWithLoopInsideSubprocessProcess.newProcess(app);
+        InclusiveGatewayWithLoopInsideSubprocessModel model = process.createModel();
+        model.setX(-1);
+        ProcessInstance<InclusiveGatewayWithLoopInsideSubprocessModel> instance = process.createInstance(model);
+        instance.start();
+
+        assertThat(instance.status()).isEqualTo(ProcessInstance.STATE_ACTIVE);
         List<KogitoWorkItem> workItems = handler.getWorkItems();
         assertThat(workItems).isNotNull().hasSize(2);
-
         for (KogitoWorkItem wi : workItems) {
-            assertProcessInstanceActive(processInstance);
-            kruntime.getKogitoWorkItemManager().completeWorkItem(wi.getStringId(), null);
+            assertThat(instance.status()).isEqualTo(ProcessInstance.STATE_ACTIVE);
+            instance.completeWorkItem(wi.getStringId(), null);
         }
-
-        assertProcessInstanceActive(processInstance);
-        kruntime.getKogitoWorkItemManager().completeWorkItem(handler2.getWorkItem().getStringId(), null);
-        assertProcessInstanceActive(processInstance);
-        kruntime.getKogitoWorkItemManager().completeWorkItem(handler2.getWorkItem().getStringId(), null);
-        assertProcessInstanceActive(processInstance);
-        kruntime.getKogitoWorkItemManager().completeWorkItem(handler.getWorkItem().getStringId(), null);
-        assertProcessInstanceCompleted(processInstance);
+        assertThat(instance.status()).isEqualTo(ProcessInstance.STATE_ACTIVE);
+        instance.completeWorkItem(handler2.getWorkItem().getStringId(), null);//After this line, state of the process instance is error state instead of active

Review Comment:
   is the comment still true?
   ```
   //After this line, state of the process instance is error state instead of active
   ```
   I do not see any assertion that would contain value like `ProcessInstance.STATE_ERROR`.



-- 
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: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org