You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "AthiraHari77 (via GitHub)" <gi...@apache.org> on 2025/03/26 07:27:55 UTC

[PR] [Incubator kie issues#1882] DMN: Return full path of invalid element (until its root) from jit-executor [incubator-kie-kogito-apps]

AthiraHari77 opened a new pull request, #2206:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2206

   Closes https://github.com/apache/incubator-kie-issues/issues/1882
   Needs PR : https://github.com/apache/incubator-kie-drools/pull/6291
   This PR aims to identify and return the full path of invalid element until its root in a dmn.
   
   <details>
   <summary>
   How to replicate CI configuration locally?
   </summary>
   
   Build Chain tool does "simple" maven build(s), the builds are just Maven commands, but because the repositories relates and depends on each other and any change in API or class method could affect several of those repositories there is a need to use [build-chain tool](https://github.com/kiegroup/github-action-build-chain) to handle cross repository builds and be sure that we always use latest version of the code for each repository.
    
   [build-chain tool](https://github.com/kiegroup/github-action-build-chain) is a build tool which can be used on command line locally or in Github Actions workflow(s), in case you need to change multiple repositories and send multiple dependent pull requests related with a change you can easily reproduce the same build by executing it on Github hosted environment or locally in your development environment. See [local execution](https://github.com/kiegroup/github-action-build-chain#local-execution) details to get more information about it.
   </details>
   
   <details>
   <summary>
   How to retest this PR or trigger a specific build:
   </summary>
   
   - for <b>pull request checks</b>  
     Please add comment: <b>Jenkins retest this</b>
   
   - for a <b>specific pull request check</b>  
     Please add comment: <b>Jenkins (re)run [kogito-apps|kogito-examples] tests</b>
   
   - for <b>quarkus branch checks</b>  
     Run checks against Quarkus current used branch  
     Please add comment: <b>Jenkins run quarkus-branch</b>
   
   - for a <b>quarkus branch specific check</b>  
     Run checks against Quarkus current used branch  
     Please add comment: <b>Jenkins (re)run [kogito-apps|kogito-examples] quarkus-branch</b>
   
   - for <b>quarkus main checks</b>  
     Run checks against Quarkus main branch  
     Please add comment: <b>Jenkins run quarkus-main</b>
   
   - for a <b>specific quarkus main check</b>  
     Run checks against Quarkus main branch  
     Please add comment: <b>Jenkins (re)run [kogito-apps|kogito-examples] quarkus-main</b>
   
   - for <b>quarkus lts checks</b>  
     Run checks against Quarkus lts branch  
     Please add comment: <b>Jenkins run quarkus-lts</b>
   
   - for a <b>specific quarkus lts check</b>  
     Run checks against Quarkus lts branch  
     Please add comment: <b>Jenkins (re)run [kogito-apps|kogito-examples] quarkus-lts</b>
    
   - for <b>native checks</b>  
     Run native checks  
     Please add comment: <b>Jenkins run native</b>
   
   - for a <b>specific native check</b>  
     Run native checks 
     Please add comment: <b>Jenkins (re)run [kogito-apps|kogito-examples] native</b>
   
   - for <b>native lts checks</b>  
     Run native checks against quarkus lts branch
     Please add comment: <b>Jenkins run native-lts</b>
   
   - for a <b>specific native lts check</b>  
     Run native checks against quarkus lts branch
     Please add comment: <b>Jenkins (re)run [kogito-apps|kogito-examples] native-lts</b>
    
   </details>
   
   <details>
   <summary>
   How to backport a pull request to a different branch?
   </summary>
   
   In order to automatically create a **backporting pull request** please add one or more labels having the following format `backport-<branch-name>`, where `<branch-name>` is the name of the branch where the pull request must be backported to (e.g., `backport-7.67.x` to backport the original PR to the `7.67.x` branch).
   
   > **NOTE**: **backporting** is an action aiming to move a change (usually a commit) from a branch (usually the main one) to another one, which is generally referring to a still maintained release branch. Keeping it simple: it is about to move a specific change or a set of them from one branch to another.
   
   Once the original pull request is successfully merged, the automated action will create one backporting pull request per each label (with the previous format) that has been added.
   
   If something goes wrong, the author will be notified and at this point a manual backporting is needed.
   
   > **NOTE**: this automated backporting is triggered whenever a pull request on `main` branch is labeled or closed, but both conditions must be satisfied to get the new PR created.
   </details>
   
   <details>
   <summary>
   Quarkus-3 PR check is failing ... what to do ?
   </summary>
   The Quarkus 3 check is applying patches from the `.ci/environments/quarkus-3/patches`.
   
   The first patch, called `0001_before_sh.patch`, is generated from Openrewrite `.ci/environments/quarkus-3/quarkus3.yml` recipe. The patch is created to speed up the check. But it may be that some changes in the PR broke this patch.  
   No panic, there is an easy way to regenerate it. You just need to comment on the PR:
   ```
   jenkins rewrite quarkus-3
   ```
   and it should, after some minutes (~20/30min) apply a commit on the PR with the patch regenerated.
   
   Other patches were generated manually. If any of it fails, you will need to manually update it... and push your changes.
   </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#1882] DMN: Return full path of invalid element (until its root) from jit-executor [incubator-kie-kogito-apps]

Posted by "AthiraHari77 (via GitHub)" <gi...@apache.org>.
AthiraHari77 commented on code in PR #2206:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2206#discussion_r2014075066


##########
jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/DMNEvaluator.java:
##########
@@ -19,11 +19,13 @@
 package org.kie.kogito.jitexecutor.dmn;
 
 import java.io.StringReader;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;

Review Comment:
   It is used in method `getNodeById(DMNModel dmnModel, String id)`.



-- 
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#1882] DMN: Return full path of invalid element (until its root) from jit-executor [incubator-kie-kogito-apps]

Posted by "AthiraHari77 (via GitHub)" <gi...@apache.org>.
AthiraHari77 commented on PR #2206:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2206#issuecomment-2754296569

   Hi @gitgabrio I have updated the PR with the changes you have suggested. 


-- 
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#1882] DMN: Return full path of invalid element (until its root) from jit-executor [incubator-kie-kogito-apps]

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

   
   **PR job** `#15` 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-apps -u https://github.com/apache/incubator-kie-kogito-apps/pull/2206 --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-apps-pr/job/PR-2206/15/display/redirect
   
   **Test results:**
   - PASSED: 1828
   - 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-apps-pr/job/PR-2206/15/testReport/org.kie.kogito.trusty.service.infinispan/InfinispanTrustyServiceIT/testStoreExplainabilityResult_Counterfactual/">org.kie.kogito.trusty.service.infinispan.InfinispanTrustyServiceIT.testStoreExplainabilityResult_Counterfactual</a></summary>
   java.lang.RuntimeException: Unable to start Quarkus test resource class org.kie.kogito.testcontainers.quarkus.KafkaQuarkusTestResource
   </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#1882] DMN: Return full path of invalid element (until its root) from jit-executor [incubator-kie-kogito-apps]

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

   
   **PR job** `#16` 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-apps -u https://github.com/apache/incubator-kie-kogito-apps/pull/2206 --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-apps-pr/job/PR-2206/16/display/redirect
   
   **Test results:**
   - PASSED: 1850
   - FAILED: 3
   
   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-apps-pr/job/PR-2206/16/testReport/org.kie.kogito.index.infinispan/ProcessDataIndexInfinispanHttpIT/testProcessInstanceEvents/">org.kie.kogito.index.infinispan.ProcessDataIndexInfinispanHttpIT.testProcessInstanceEvents</a></summary>
   Assertion condition defined as a org.kie.kogito.index.AbstractProcessDataIndexIT 1 expectation failed.<br/>JSON path data.ProcessInstances[0].executionSummary.size() doesn't match.<br/>Expected: is <2><br/>  Actual: <1><br/> within 30 seconds.
   </details>
   <details>
   <summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-apps-pr/job/PR-2206/16/testReport/org.kie.kogito.index.mongodb/ProcessDataIndexMongoDBKafkaIT/testProcessInstanceEvents/">org.kie.kogito.index.mongodb.ProcessDataIndexMongoDBKafkaIT.testProcessInstanceEvents</a></summary>
   Assertion condition defined as a org.kie.kogito.index.AbstractProcessDataIndexIT 1 expectation failed.<br/>JSON path data.ProcessInstances[0].executionSummary.size() doesn't match.<br/>Expected: is <2><br/>  Actual: <1><br/> within 30 seconds.
   </details>
   <details>
   <summary><a href="https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-apps-pr/job/PR-2206/16/testReport/org.kie.kogito.index/ProcessDataIndexInfinispanIT/testProcessInstanceEvents/">org.kie.kogito.index.ProcessDataIndexInfinispanIT.testProcessInstanceEvents</a></summary>
   Assertion condition defined as a org.kie.kogito.index.AbstractProcessDataIndexIT 1 expectation failed.<br/>JSON path data.ProcessInstances[0].executionSummary.size() doesn't match.<br/>Expected: is <2><br/>  Actual: <1><br/> within 30 seconds.
   </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#1882] DMN: Return full path of invalid element (until its root) from jit-executor [incubator-kie-kogito-apps]

Posted by "gitgabrio (via GitHub)" <gi...@apache.org>.
gitgabrio commented on code in PR #2206:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2206#discussion_r2013608429


##########
jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/responses/JITDMNResult.java:
##########
@@ -181,4 +185,12 @@ private static List<JITDMNMessage> internalGetMessages(List<? extends DMNMessage
     private static List<DMNDecisionResult> internalGetDecisionResults(List<? extends DMNDecisionResult> decisionResults, Map<String, Map<String, Integer>> decisionEvaluationHitIdsMap) {
         return decisionResults.stream().map(dr -> JITDMNDecisionResult.of(dr, decisionEvaluationHitIdsMap.getOrDefault(dr.getDecisionName(), Collections.emptyMap()))).collect(Collectors.toList());
     }
+
+    public List<List<String>> getInvalidElementPaths() {

Review Comment:
   Hi @AthiraHari77 
   Could you please move those two public getter/setter up, together to the others? Keep a class in good order make it easier to manage



##########
jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/DMNEvaluator.java:
##########
@@ -95,6 +102,52 @@ static DMNEvaluator validateForErrors(DMNModel dmnModel, DMNRuntime dmnRuntime)
         }
     }
 
+    static List<String> getPathToRoot(DMNModel dmnModel, String invalidId) {
+        List<String> path = new ArrayList<>();
+        DMNModelInstrumentedBase node = getNodeById(dmnModel, invalidId);
+
+        while (node != null && !(node instanceof Definitions)) {
+            if (node instanceof Decision) {
+                path.add(((Decision) node).getId());
+            } else if (node instanceof BusinessKnowledgeModel) {
+                path.add(((BusinessKnowledgeModel) node).getId());
+            } else if (node instanceof ChildExpression) {
+                path.add(((ChildExpression) node).getId());
+            } else {
+                path.add(node.getIdentifierString());
+            }
+            node = node.getParent();
+        }
+        Collections.reverse(path);
+        return path.isEmpty() ? Collections.singletonList(invalidId) : path;
+    }
+
+    static DMNModelInstrumentedBase getNodeById(DMNModel dmnModel, String id) {
+        return dmnModel.getDefinitions().getChildren().stream().map(child -> getNodeById(child, id))
+                .filter(Objects::nonNull).findFirst().orElse(null);
+    }
+
+    static DMNModelInstrumentedBase getNodeById(DMNModelInstrumentedBase dmnModelInstrumentedBase, String id) {
+        if (dmnModelInstrumentedBase.getIdentifierString().equals(id)) {
+            return dmnModelInstrumentedBase;
+        }
+        for (DMNModelInstrumentedBase child : dmnModelInstrumentedBase.getChildren()) {
+            DMNModelInstrumentedBase result = getNodeById(child, id);
+            if (result != null) {
+                return result;
+            }
+        }
+        return null;
+    }
+
+    static List<List<String>> retrieveInvalidElementPaths(List<DMNMessage> messages, DMNModel dmnModel) {
+        return messages.stream().filter(message -> message.getLevel().equals(Message.Level.WARNING) ||
+                message.getLevel().equals(Message.Level.ERROR)).map(message -> {
+                    List<String> pathToRoot = getPathToRoot(dmnModel, message.getSourceId());

Review Comment:
   Please return directly that 
   `getPathToRoot(dmnModel, message.getSourceId());`
   instead of creating a redundant variable



##########
jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/DMNEvaluator.java:
##########
@@ -19,11 +19,13 @@
 package org.kie.kogito.jitexecutor.dmn;
 
 import java.io.StringReader;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;

Review Comment:
   This import seems unused: could you please remove it ?



##########
jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/DMNEvaluator.java:
##########
@@ -95,6 +102,52 @@ static DMNEvaluator validateForErrors(DMNModel dmnModel, DMNRuntime dmnRuntime)
         }
     }
 
+    static List<String> getPathToRoot(DMNModel dmnModel, String invalidId) {
+        List<String> path = new ArrayList<>();
+        DMNModelInstrumentedBase node = getNodeById(dmnModel, invalidId);
+
+        while (node != null && !(node instanceof Definitions)) {

Review Comment:
   I think that loop could be replaced with
   
   ```java
   while (node != null && !(node instanceof Definitions) ) {
               if (node instanceof DMNElement dmnElement) {
                   path.add(dmnElement.getId());
               } else {
                   path.add(node.getIdentifierString());
               }
               node = node.getParent();
   }
   ```
   
   This would
   
   1.   avoid direct reference to specific classes (that potentially could miss others)
   2.  better represent the logic of the loop
   
           
   Could you please give it a try (and remove imports of unused classes) ?



##########
jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/JITDMNServiceImpl.java:
##########
@@ -119,14 +119,14 @@ public DMNResultWithExplanation evaluateModelAndExplain(DMNEvaluator dmnEvaluato
                 Thread.currentThread().interrupt();
             }
             return new DMNResultWithExplanation(
-                    JITDMNResult.of(dmnEvaluator.getNamespace(), dmnEvaluator.getName(), dmnResult, Collections.emptyMap()),
+                    JITDMNResult.of(dmnEvaluator.getNamespace(), dmnEvaluator.getName(), dmnResult, Collections.emptyMap(), Collections.emptyList()),

Review Comment:
   Please, replace with
   
   `JITDMNResult.of(dmnEvaluator.getNamespace(), dmnEvaluator.getName(), dmnResult, Collections.emptyMap(), dmnResult.getInvalidElementPaths()),` 
   
   



##########
jitexecutor/jitexecutor-dmn/src/test/java/org/kie/kogito/jitexecutor/dmn/responses/JITDMNResultTest.java:
##########
@@ -78,7 +78,7 @@ void serializeDeserialize() throws JsonProcessingException {
         dmnResult.setContext(createContext());
         dmnResult.addDecisionResult(decisionResult);
 
-        JITDMNResult jitdmnResult = JITDMNResult.of("http://www.trisotech.com/definitions/_9d01a0c4-f529-4ad8-ad8e-ec5fb5d96ad4", "Chapter 11 Example", dmnResult, Collections.emptyMap());
+        JITDMNResult jitdmnResult = JITDMNResult.of("http://www.trisotech.com/definitions/_9d01a0c4-f529-4ad8-ad8e-ec5fb5d96ad4", "Chapter 11 Example", dmnResult, Collections.emptyMap(), Collections.emptyList());

Review Comment:
   Could you also please modify the 
   
   `void deserialize() `
   
   test, introducing the new invalidElementPaths ?



##########
jitexecutor/jitexecutor-dmn/src/main/java/org/kie/kogito/jitexecutor/dmn/JITDMNServiceImpl.java:
##########
@@ -119,14 +119,14 @@ public DMNResultWithExplanation evaluateModelAndExplain(DMNEvaluator dmnEvaluato
                 Thread.currentThread().interrupt();
             }
             return new DMNResultWithExplanation(
-                    JITDMNResult.of(dmnEvaluator.getNamespace(), dmnEvaluator.getName(), dmnResult, Collections.emptyMap()),
+                    JITDMNResult.of(dmnEvaluator.getNamespace(), dmnEvaluator.getName(), dmnResult, Collections.emptyMap(), Collections.emptyList()),
                     new SalienciesResponse(EXPLAINABILITY_FAILED, EXPLAINABILITY_FAILED_MESSAGE, null));
         }
 
         List<SaliencyResponse> saliencyModelResponse = buildSalienciesResponse(dmnEvaluator.getDmnModel(), saliencyMap);
 
         return new DMNResultWithExplanation(
-                JITDMNResult.of(dmnEvaluator.getNamespace(), dmnEvaluator.getName(), dmnResult, Collections.emptyMap()),
+                JITDMNResult.of(dmnEvaluator.getNamespace(), dmnEvaluator.getName(), dmnResult, Collections.emptyMap(), Collections.emptyList()),

Review Comment:
   Please, replace with
   
   `JITDMNResult.of(dmnEvaluator.getNamespace(), dmnEvaluator.getName(), dmnResult, Collections.emptyMap(), dmnResult.getInvalidElementPaths()),` 



##########
jitexecutor/jitexecutor-dmn/src/test/java/org/kie/kogito/jitexecutor/dmn/responses/JITDMNResultTest.java:
##########
@@ -78,7 +78,7 @@ void serializeDeserialize() throws JsonProcessingException {
         dmnResult.setContext(createContext());
         dmnResult.addDecisionResult(decisionResult);
 
-        JITDMNResult jitdmnResult = JITDMNResult.of("http://www.trisotech.com/definitions/_9d01a0c4-f529-4ad8-ad8e-ec5fb5d96ad4", "Chapter 11 Example", dmnResult, Collections.emptyMap());
+        JITDMNResult jitdmnResult = JITDMNResult.of("http://www.trisotech.com/definitions/_9d01a0c4-f529-4ad8-ad8e-ec5fb5d96ad4", "Chapter 11 Example", dmnResult, Collections.emptyMap(), Collections.emptyList());

Review Comment:
   Please modify that invocation to also contain both 
   
   1. decisionEvaluationHitIdsMap
   2. invalidElementPaths
   
   The scope of this test is to double check serialization/deserialization roundtrip



-- 
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#1882] DMN: Return full path of invalid element (until its root) from jit-executor [incubator-kie-kogito-apps]

Posted by "gitgabrio (via GitHub)" <gi...@apache.org>.
gitgabrio commented on code in PR #2206:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2206#discussion_r2015816958


##########
jitexecutor/jitexecutor-dmn/src/test/java/org/kie/kogito/jitexecutor/dmn/DMNEvaluatorTest.java:
##########
@@ -88,4 +97,88 @@ void testValidateForErrors() {
         assertNotNull(evaluator);
     }
 
+    @Test
+    void testRetrieveInvalidElementPaths() throws IOException {
+        Resource resource = ResourceFactory.newClassPathResource("invalid_models/DMNv1_5/DMN-MultipleInvalidElements.dmn");
+        DMNRuntime dmnRuntime = DMNRuntimeBuilder.fromDefaults().buildConfiguration()
+                .fromResources(Collections.singletonList(resource)).getOrElseThrow(RuntimeException::new);
+        assertThat(dmnRuntime).isNotNull();
+        String nameSpace = "https://kie.org/dmn/_79591DB5-1EE1-4CBD-AA5D-2E3EDF31150E";
+
+        final DMNModel dmnModel = dmnRuntime.getModel(nameSpace, "DMN_8F7C4323-412A-4E0B-9AEF-0F24C8F55282");
+        assertThat(dmnModel).isNotNull();
+        DMNContext dmnContext = DMNFactory.newContext();
+        dmnContext.set("id", "_7273EA2E-2CC3-4012-8F87-39E310C8DF3C");
+        dmnContext.set("Conditional Input", 107);
+        dmnContext.set("New Input Data", 8888);
+        dmnContext.set("Score", 8);
+        DMNResult dmnResult = dmnRuntime.evaluateAll(dmnModel, dmnContext);
+        List<List<String>> invalidElementPaths = List.of(List.of("_3DC41DB9-BE1D-4289-A639-24AB57ED082D", "_2B147ECC-2457-4623-B841-3360D75F9F76", "_6F318F57-DA06-4F71-80AD-288E0BBB3A52", "_43236F2B-9857-454F-8EA0-39B37C7519CF"),
+                        List.of("_09186183-0646-4CD0-AD67-A159E9F87F5E", "_D386D137-582B-49F9-B6F9-F341C3AC4B3E", "_2E43C09D-011A-436C-B40B-9154405EAF3A"), List.of("_E9468D45-51EB-48DA-8B30-7D65696FDFB8"));
+
+        List<List<String>> invalidPaths = DMNEvaluator.retrieveInvalidElementPaths(dmnResult.getMessages(), dmnModel);
+        System.out.println(invalidPaths);

Review Comment:
   HI @AthiraHari77 
   Could you please remove this System.out.println ? Thanks



##########
jitexecutor/jitexecutor-dmn/src/test/java/org/kie/kogito/jitexecutor/dmn/DMNEvaluatorTest.java:
##########
@@ -88,4 +97,88 @@ void testValidateForErrors() {
         assertNotNull(evaluator);
     }
 
+    @Test
+    void testRetrieveInvalidElementPaths() throws IOException {
+        Resource resource = ResourceFactory.newClassPathResource("invalid_models/DMNv1_5/DMN-MultipleInvalidElements.dmn");
+        DMNRuntime dmnRuntime = DMNRuntimeBuilder.fromDefaults().buildConfiguration()
+                .fromResources(Collections.singletonList(resource)).getOrElseThrow(RuntimeException::new);
+        assertThat(dmnRuntime).isNotNull();
+        String nameSpace = "https://kie.org/dmn/_79591DB5-1EE1-4CBD-AA5D-2E3EDF31150E";
+
+        final DMNModel dmnModel = dmnRuntime.getModel(nameSpace, "DMN_8F7C4323-412A-4E0B-9AEF-0F24C8F55282");
+        assertThat(dmnModel).isNotNull();
+        DMNContext dmnContext = DMNFactory.newContext();
+        dmnContext.set("id", "_7273EA2E-2CC3-4012-8F87-39E310C8DF3C");
+        dmnContext.set("Conditional Input", 107);
+        dmnContext.set("New Input Data", 8888);
+        dmnContext.set("Score", 8);
+        DMNResult dmnResult = dmnRuntime.evaluateAll(dmnModel, dmnContext);
+        List<List<String>> invalidElementPaths = List.of(List.of("_3DC41DB9-BE1D-4289-A639-24AB57ED082D", "_2B147ECC-2457-4623-B841-3360D75F9F76", "_6F318F57-DA06-4F71-80AD-288E0BBB3A52", "_43236F2B-9857-454F-8EA0-39B37C7519CF"),
+                        List.of("_09186183-0646-4CD0-AD67-A159E9F87F5E", "_D386D137-582B-49F9-B6F9-F341C3AC4B3E", "_2E43C09D-011A-436C-B40B-9154405EAF3A"), List.of("_E9468D45-51EB-48DA-8B30-7D65696FDFB8"));
+
+        List<List<String>> invalidPaths = DMNEvaluator.retrieveInvalidElementPaths(dmnResult.getMessages(), dmnModel);
+        System.out.println(invalidPaths);
+        assertNotNull(invalidPaths);
+        assertThat(invalidElementPaths.size()).isEqualTo(invalidPaths.size());
+        assertThat(invalidElementPaths).isEqualTo(invalidPaths);
+    }
+
+    @Test
+    void testGetPathToRoot() {
+        Resource resource = ResourceFactory.newClassPathResource("invalid_models/DMNv1_5/InvalidElementPath.dmn");
+        DMNRuntime dmnRuntime = DMNRuntimeBuilder.fromDefaults().buildConfiguration()
+                .fromResources(Collections.singletonList(resource)).getOrElseThrow(RuntimeException::new);
+        assertThat(dmnRuntime).isNotNull();
+        String nameSpace = "https://kie.org/dmn/_608570C5-8344-42B6-9538-6E0EA9892C38";
+
+        final DMNModel dmnModel = dmnRuntime.getModel(nameSpace, "DMN_039CBA90-29EC-4A15-B376-FC0FBC5F6807");
+        assertThat(dmnModel).isNotNull();
+        String id = "_8577FE15-1512-4BBE-885F-C30FD73ADC6B";
+        List<String> invalidPath = List.of("_172F9901-0884-47C1-A5B4-3C09CC83D5B6", "_8577FE15-1512-4BBE-885F-C30FD73ADC6B");
+
+        List<String> path = DMNEvaluator.getPathToRoot(dmnModel, id);

Review Comment:
   As previous, please rename 
   
   `List<String> path` with `List<String> retrieved`: it would make the test much easier to read



##########
jitexecutor/jitexecutor-dmn/src/test/java/org/kie/kogito/jitexecutor/dmn/DMNEvaluatorTest.java:
##########
@@ -88,4 +97,88 @@ void testValidateForErrors() {
         assertNotNull(evaluator);
     }
 
+    @Test
+    void testRetrieveInvalidElementPaths() throws IOException {
+        Resource resource = ResourceFactory.newClassPathResource("invalid_models/DMNv1_5/DMN-MultipleInvalidElements.dmn");
+        DMNRuntime dmnRuntime = DMNRuntimeBuilder.fromDefaults().buildConfiguration()
+                .fromResources(Collections.singletonList(resource)).getOrElseThrow(RuntimeException::new);
+        assertThat(dmnRuntime).isNotNull();
+        String nameSpace = "https://kie.org/dmn/_79591DB5-1EE1-4CBD-AA5D-2E3EDF31150E";
+
+        final DMNModel dmnModel = dmnRuntime.getModel(nameSpace, "DMN_8F7C4323-412A-4E0B-9AEF-0F24C8F55282");
+        assertThat(dmnModel).isNotNull();
+        DMNContext dmnContext = DMNFactory.newContext();
+        dmnContext.set("id", "_7273EA2E-2CC3-4012-8F87-39E310C8DF3C");
+        dmnContext.set("Conditional Input", 107);
+        dmnContext.set("New Input Data", 8888);
+        dmnContext.set("Score", 8);
+        DMNResult dmnResult = dmnRuntime.evaluateAll(dmnModel, dmnContext);
+        List<List<String>> invalidElementPaths = List.of(List.of("_3DC41DB9-BE1D-4289-A639-24AB57ED082D", "_2B147ECC-2457-4623-B841-3360D75F9F76", "_6F318F57-DA06-4F71-80AD-288E0BBB3A52", "_43236F2B-9857-454F-8EA0-39B37C7519CF"),
+                        List.of("_09186183-0646-4CD0-AD67-A159E9F87F5E", "_D386D137-582B-49F9-B6F9-F341C3AC4B3E", "_2E43C09D-011A-436C-B40B-9154405EAF3A"), List.of("_E9468D45-51EB-48DA-8B30-7D65696FDFB8"));
+
+        List<List<String>> invalidPaths = DMNEvaluator.retrieveInvalidElementPaths(dmnResult.getMessages(), dmnModel);

Review Comment:
   Hi @AthiraHari77 
   Please rename `List<List<String>> invalidPaths`  with `List<List<String>> retrieved`:
   the following two lines:
   
   ```java
   assertThat(invalidElementPaths.size()).isEqualTo(invalidPaths.size());
   assertThat(invalidElementPaths).isEqualTo(invalidPaths);
   ```
   are pretty meaningless, otherwise



-- 
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#1882] DMN: Return full path of invalid element (until its root) from jit-executor [incubator-kie-kogito-apps]

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


-- 
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#1882] DMN: Return full path of invalid element (until its root) from jit-executor [incubator-kie-kogito-apps]

Posted by "gitgabrio (via GitHub)" <gi...@apache.org>.
gitgabrio commented on code in PR #2206:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2206#discussion_r2028235984


##########
jitexecutor/jitexecutor-dmn/src/test/java/org/kie/kogito/jitexecutor/dmn/DMNEvaluatorTest.java:
##########
@@ -45,6 +59,13 @@ public static void setup() throws IOException {
         invalidModel = getModelFromIoUtils("invalid_models/DMNv1_5/DMN-Invalid.dmn");
     }
 
+    private static Stream<Arguments> provideParametersForRemoveDuplicates() {

Review Comment:
   Hi @AthiraHari77 could you pls move to bottom of the class ? Thanks!



##########
jitexecutor/jitexecutor-dmn/src/test/java/org/kie/kogito/jitexecutor/dmn/api/JITDMNResourceTest.java:
##########
@@ -77,6 +76,16 @@ public static void setup() throws IOException {
         modelWithNestedConditionalEvaluationHitIds = getModelFromIoUtils("valid_models/DMNv1_5/NestedConditional.dmn");
     }
 
+    static Map<String, Object> buildMultipleHitContext() {

Review Comment:
   Please move to bottom of class



-- 
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#1882] DMN: Return full path of invalid element (until its root) from jit-executor [incubator-kie-kogito-apps]

Posted by "AthiraHari77 (via GitHub)" <gi...@apache.org>.
AthiraHari77 commented on PR #2206:
URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2206#issuecomment-2778120349

   > Thnk you for the PR. My only point is for the `DMNEvaluatorTest` that I would prefer to have more scenarios, just for easier understanding for newcomer. I mean the current test is good and has good coverage, but for someone new may be tricky to understand how the duplicates removal works. Would you mind to add these more simple tests?
   > 
   > [AthiraHari77#1](https://github.com/AthiraHari77/incubator-kie-kogito-apps/pull/1)
   
   @jomarko I have updated the testcases.


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