This is an automated email from the ASF dual-hosted git repository.

gitgabrio pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-drools.git


The following commit(s) were added to refs/heads/main by this push:
     new 8f020848cb [incubator-kie-issues#1853] Correctly map evaluation hit 
ids on nested conditional/decisiontable elements (#6271)
8f020848cb is described below

commit 8f020848cb77e444569b153e93ae3455a107cf9e
Author: Gabriele Cardosi <[email protected]>
AuthorDate: Wed Mar 5 15:47:01 2025 +0100

    [incubator-kie-issues#1853] Correctly map evaluation hit ids on nested 
conditional/decisiontable elements (#6271)
    
    * [incubator-kie-issues#1853] Add model and test for nested conditional 
evaluation
    
    * [incubator-kie-issues#1853] Refactored events to forward parent decision 
name
    
    * [incubator-kie-issues#1853] Add license header
    
    * [incubator-kie-issues#1853] Fix renaming
    
    * [incubator-kie-issues#1853] Fix renaming
    
    ---------
    
    Co-authored-by: Gabriele-Cardosi <[email protected]>
---
 .../event/AfterConditionalEvaluationEvent.java     |  8 +-
 .../event/AfterEvaluateDecisionTableEvent.java     |  6 +-
 .../kie/dmn/core/ast/DMNConditionalEvaluator.java  | 16 +++-
 .../impl/AfterConditionalEvaluationEventImpl.java  | 11 ++-
 .../impl/AfterEvaluateDecisionTableEventImpl.java  | 14 ++--
 .../dmn/core/impl/DMNRuntimeEventManagerUtils.java |  6 +-
 .../java/org/kie/dmn/core/DMNInputRuntimeTest.java | 64 ++++++++++++++-
 .../dmn/core/ast/DMNConditionalEvaluatorTest.java  |  9 ++-
 .../kie/dmn/core/decisiontable/DTListenerTest.java |  1 -
 .../core/impl/DMNRuntimeEventManagerUtilsTest.java | 31 ++++----
 .../core/v1_1/DMNDecisionTableRuntimeTest.java     |  1 -
 .../valid_models/DMNv1_5/NestedConditional.dmn     | 91 ++++++++++++++++++++++
 12 files changed, 220 insertions(+), 38 deletions(-)

diff --git 
a/kie-dmn/kie-dmn-api/src/main/java/org/kie/dmn/api/core/event/AfterConditionalEvaluationEvent.java
 
b/kie-dmn/kie-dmn-api/src/main/java/org/kie/dmn/api/core/event/AfterConditionalEvaluationEvent.java
index cdadc89944..2fbfeaa0ce 100644
--- 
a/kie-dmn/kie-dmn-api/src/main/java/org/kie/dmn/api/core/event/AfterConditionalEvaluationEvent.java
+++ 
b/kie-dmn/kie-dmn-api/src/main/java/org/kie/dmn/api/core/event/AfterConditionalEvaluationEvent.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -28,6 +28,12 @@ public interface AfterConditionalEvaluationEvent {
 
     String getNodeName();
 
+    /**
+     * The decision that this node relates to
+     * @return
+     */
+    String getDecisionName();
+
     EvaluatorResult getEvaluatorResultResult();
 
     String getExecutedId();
diff --git 
a/kie-dmn/kie-dmn-api/src/main/java/org/kie/dmn/api/core/event/AfterEvaluateDecisionTableEvent.java
 
b/kie-dmn/kie-dmn-api/src/main/java/org/kie/dmn/api/core/event/AfterEvaluateDecisionTableEvent.java
index 6daa2958bd..0885f060e0 100644
--- 
a/kie-dmn/kie-dmn-api/src/main/java/org/kie/dmn/api/core/event/AfterEvaluateDecisionTableEvent.java
+++ 
b/kie-dmn/kie-dmn-api/src/main/java/org/kie/dmn/api/core/event/AfterEvaluateDecisionTableEvent.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -22,6 +22,10 @@ import java.util.List;
 
 public interface AfterEvaluateDecisionTableEvent extends DMNEvent {
 
+    /**
+     * The decision that this node relates to
+     * @return
+     */
     String getNodeName();
 
     String getDecisionTableName();
diff --git 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/ast/DMNConditionalEvaluator.java
 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/ast/DMNConditionalEvaluator.java
index 2df62a1dc7..1f07efbb87 100644
--- 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/ast/DMNConditionalEvaluator.java
+++ 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/ast/DMNConditionalEvaluator.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -35,6 +35,8 @@ import org.kie.dmn.core.impl.DMNRuntimeEventManagerUtils;
 import org.kie.dmn.core.util.Msg;
 import org.kie.dmn.core.util.MsgUtil;
 import org.kie.dmn.model.api.DMNElement;
+import org.kie.dmn.model.api.DMNModelInstrumentedBase;
+import org.kie.dmn.model.api.Decision;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -84,6 +86,7 @@ public class DMNConditionalEvaluator implements 
DMNExpressionEvaluator {
     private final DMNExpressionEvaluator elseEvaluator;
     private final DMNElement node;
     private final String name;
+    private final String decisionName;
     private final EvaluatorIdentifier ifEvaluatorIdentifier;
     private final EvaluatorIdentifier thenEvaluatorIdentifier;
     private final EvaluatorIdentifier elseEvaluatorIdentifier;
@@ -98,9 +101,13 @@ public class DMNConditionalEvaluator implements 
DMNExpressionEvaluator {
                 .orElseThrow(() -> new RuntimeException("Missing " + type + " 
evaluator in evaluatorIdMap"));
     }
 
-    public DMNConditionalEvaluator(String name, DMNElement node, Map 
<EvaluatorIdentifier, DMNExpressionEvaluator> evaluatorIdMap) {
+    static String getDecisionName(DMNModelInstrumentedBase dmnElement) {
+        return dmnElement instanceof Decision decision ? decision.getName() : 
getDecisionName(dmnElement.getParentDRDElement());
+    }
+
+    public DMNConditionalEvaluator(String name, DMNElement dmnElement, Map 
<EvaluatorIdentifier, DMNExpressionEvaluator> evaluatorIdMap) {
         this.name = name;
-        this.node = node;
+        this.node = dmnElement;
         Map<EvaluatorType, EvaluatorIdentifier> evaluatorIdentifierMap = 
mapEvaluatorIdentifiers(evaluatorIdMap);
         this.ifEvaluatorIdentifier = 
getEvaluatorIdentifier(evaluatorIdentifierMap, EvaluatorType.IF);
         this.thenEvaluatorIdentifier = 
getEvaluatorIdentifier(evaluatorIdentifierMap, EvaluatorType.THEN);
@@ -108,6 +115,7 @@ public class DMNConditionalEvaluator implements 
DMNExpressionEvaluator {
         this.ifEvaluator = evaluatorIdMap.get(ifEvaluatorIdentifier);
         this.thenEvaluator = evaluatorIdMap.get(thenEvaluatorIdentifier);
         this.elseEvaluator = evaluatorIdMap.get(elseEvaluatorIdentifier);
+        this.decisionName = getDecisionName(dmnElement);
     }
 
     @Override
@@ -141,7 +149,7 @@ public class DMNConditionalEvaluator implements 
DMNExpressionEvaluator {
         DMNExpressionEvaluator evaluatorToUse = booleanResult != null && 
booleanResult ? thenEvaluator : elseEvaluator;
         EvaluatorResult toReturn = evaluatorToUse.evaluate(eventManager, 
result);
         String executedId = evaluatorToUse.equals(thenEvaluator) ? 
thenEvaluatorIdentifier.id : elseEvaluatorIdentifier.id;
-        
DMNRuntimeEventManagerUtils.fireAfterConditionalEvaluation(eventManager, name, 
toReturn, executedId);
+        
DMNRuntimeEventManagerUtils.fireAfterConditionalEvaluation(eventManager, name, 
decisionName, toReturn, executedId);
         return toReturn;
     }
 
diff --git 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/AfterConditionalEvaluationEventImpl.java
 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/AfterConditionalEvaluationEventImpl.java
index b34e937da8..0bc6d8da21 100644
--- 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/AfterConditionalEvaluationEventImpl.java
+++ 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/AfterConditionalEvaluationEventImpl.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -24,11 +24,13 @@ import 
org.kie.dmn.api.core.event.AfterConditionalEvaluationEvent;
 public class AfterConditionalEvaluationEventImpl implements 
AfterConditionalEvaluationEvent {
 
     private final String nodeName;
+    private final String decisionName;
     private final EvaluatorResult evaluatorResult;
     private final String executedId;
 
-    public AfterConditionalEvaluationEventImpl(String nodeName, 
EvaluatorResult evaluatorResult, String executedId) {
+    public AfterConditionalEvaluationEventImpl(String nodeName, String 
decisionName, EvaluatorResult evaluatorResult, String executedId) {
         this.nodeName = nodeName;
+        this.decisionName = decisionName;
         this.evaluatorResult = evaluatorResult;
         this.executedId = executedId;
     }
@@ -38,6 +40,11 @@ public class AfterConditionalEvaluationEventImpl implements 
AfterConditionalEval
         return nodeName;
     }
 
+    @Override
+    public String getDecisionName() {
+        return decisionName;
+    }
+
     @Override
     public EvaluatorResult getEvaluatorResultResult() {
         return evaluatorResult;
diff --git 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/AfterEvaluateDecisionTableEventImpl.java
 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/AfterEvaluateDecisionTableEventImpl.java
index 76d80fccfb..fb588c168c 100644
--- 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/AfterEvaluateDecisionTableEventImpl.java
+++ 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/AfterEvaluateDecisionTableEventImpl.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -27,8 +27,8 @@ import java.util.List;
 public class AfterEvaluateDecisionTableEventImpl
         implements AfterEvaluateDecisionTableEvent {
 
-    private final String        nodeName;
-    private final String        dtName;
+    private final String nodeName;
+    private final String decisionTableName;
     private final String        dtId;
     private final DMNResult     result;
     private final List<Integer> matches;
@@ -36,9 +36,9 @@ public class AfterEvaluateDecisionTableEventImpl
     private final List<String> matchesIds;
     private final List<String> firedIds;
 
-    public AfterEvaluateDecisionTableEventImpl(String nodeName, String dtName, 
String dtId, DMNResult result, List<Integer> matches, List<Integer> fired, 
List<String> matchesIds, List<String> firedIds) {
+    public AfterEvaluateDecisionTableEventImpl(String nodeName, String 
decisionTableName, String dtId, DMNResult result, List<Integer> matches, 
List<Integer> fired, List<String> matchesIds, List<String> firedIds) {
         this.nodeName = nodeName;
-        this.dtName = dtName;
+        this.decisionTableName = decisionTableName;
         this.dtId = dtId;
         this.result = result;
         this.matches = matches;
@@ -54,7 +54,7 @@ public class AfterEvaluateDecisionTableEventImpl
 
     @Override
     public String getDecisionTableName() {
-        return dtName;
+        return decisionTableName;
     }
 
     @Override
@@ -88,7 +88,7 @@ public class AfterEvaluateDecisionTableEventImpl
 
     @Override
     public String toString() {
-        return "AfterEvaluateDecisionTableEvent{ nodeName='"+nodeName+"' 
decisionTableName='" + dtName + "' matches=" + getMatches() + " fired=" + 
getSelected() + "' matchesIds=" + getMatchesIds() + " firedIds=" + 
getSelectedIds() + " }";
+        return "AfterEvaluateDecisionTableEvent{ nodeName='"+ nodeName +"' 
decisionTableName='" + decisionTableName + "' matches=" + getMatches() + " 
fired=" + getSelected() + "' matchesIds=" + getMatchesIds() + " firedIds=" + 
getSelectedIds() + " }";
     }
 
 }
diff --git 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNRuntimeEventManagerUtils.java
 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNRuntimeEventManagerUtils.java
index 7c4d158821..1d56fd7f2f 100644
--- 
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNRuntimeEventManagerUtils.java
+++ 
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNRuntimeEventManagerUtils.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -159,9 +159,9 @@ public final class DMNRuntimeEventManagerUtils {
         }
     }
 
-    public static void fireAfterConditionalEvaluation(DMNRuntimeEventManager 
eventManager, String nodeName, EvaluatorResult evaluatorResult, String 
idExecuted) {
+    public static void fireAfterConditionalEvaluation(DMNRuntimeEventManager 
eventManager, String conditionalName, String decisionName, EvaluatorResult 
evaluatorResult, String idExecuted) {
         if( eventManager.hasListeners() ) {
-            AfterConditionalEvaluationEvent event = new 
AfterConditionalEvaluationEventImpl(nodeName, evaluatorResult, idExecuted);
+            AfterConditionalEvaluationEvent event = new 
AfterConditionalEvaluationEventImpl(conditionalName, decisionName, 
evaluatorResult, idExecuted);
             notifyListeners(eventManager, l -> 
l.afterConditionalEvaluation(event));
         }
     }
diff --git 
a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNInputRuntimeTest.java 
b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNInputRuntimeTest.java
index 9e3e29dee9..27140431ae 100644
--- 
a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNInputRuntimeTest.java
+++ 
b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNInputRuntimeTest.java
@@ -41,6 +41,7 @@ import org.kie.dmn.api.core.ast.InputDataNode;
 import org.kie.dmn.api.core.ast.ItemDefNode;
 import org.kie.dmn.api.core.event.AfterConditionalEvaluationEvent;
 import org.kie.dmn.api.core.event.AfterEvaluateConditionalEvent;
+import org.kie.dmn.api.core.event.AfterEvaluateDecisionEvent;
 import org.kie.dmn.api.core.event.AfterEvaluateDecisionTableEvent;
 import org.kie.dmn.core.api.DMNFactory;
 import org.kie.dmn.core.api.event.DefaultDMNRuntimeEventListener;
@@ -452,13 +453,74 @@ public class DMNInputRuntimeTest extends 
BaseInterpretedVsCompiledTest {
         ctx2.set("Credit Score", "Excellent");
         ctx2.set("DTI", 10);
         final DMNResult dmnResult2 = runtime.evaluateAll(dmnModel, ctx2);
-        
assertThat(dmnResult2.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnResult1.getMessages())).isFalse();
+        
assertThat(dmnResult2.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnResult2.getMessages())).isFalse();
         assertThat(dmnResult2.getContext().get("Risk 
Score")).isEqualTo(BigDecimal.valueOf(20));
         assertThat(evaluateConditionalIds).hasSize(1).allMatch(id -> 
id.equals(ifElementId));
         assertThat(conditionalEvaluationIds).hasSize(1).allMatch(id -> 
id.equals(thenElementId));
         assertThat(executedRuleIds).hasSize(2).contains(ruleId1, ruleId4);
     }
 
+    @ParameterizedTest
+    @MethodSource("params")
+    void nestedConditionalEvaluationHitIdsCheck(boolean useExecModelCompiler) {
+        init(useExecModelCompiler);
+        final String ifElementId = "_80CE666C-3436-4767-8A1D-2BE427F5679C";
+        final String thenElementId = "_C69417CB-474E-4742-9D26-8D1ADB75CAEC";
+        final String elseElementId = "_0C94AE89-A771-4CD8-A62F-B7BA7F8F2359";
+        final String decisionId = "_E0D45F9F-76E3-4F85-8A0D-6127965F717A";
+        final DMNRuntime runtime = 
DMNRuntimeUtil.createRuntime("valid_models/DMNv1_5/NestedConditional.dmn",
+                                                                
this.getClass());
+
+        final List<String> evaluateConditionalIds = new ArrayList<>();
+        final List<String> conditionalEvaluationIds = new ArrayList<>();
+        final List<String> executedDecisionIds = new ArrayList<>();
+        runtime.addListener(new DefaultDMNRuntimeEventListener() {
+
+            @Override
+            public void 
afterConditionalEvaluation(AfterConditionalEvaluationEvent event) {
+                conditionalEvaluationIds.add(event.getExecutedId());
+            }
+
+            @Override
+            public void afterEvaluateConditional(AfterEvaluateConditionalEvent 
event) {
+                evaluateConditionalIds.add(event.getExecutedId());
+            }
+
+            @Override
+            public void afterEvaluateDecision(AfterEvaluateDecisionEvent 
event) {
+                executedDecisionIds.add(event.getDecision().getId());
+            }
+
+        });
+        final DMNModel dmnModel = runtime.getModel(
+                "https://kie.org/dmn/_0E7C2E43-9E1B-4AB6-8FD1-B3A1461B8C54";,
+                "DMN_A50C20F0-B784-4749-A8FB-CF008006B0EC");
+        assertThat(dmnModel).isNotNull();
+        
assertThat(dmnModel.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).isFalse();
+
+        final DMNContext ctx1 = runtime.newContext();
+        ctx1.set("A", 1);
+        final DMNResult dmnResult1 = runtime.evaluateAll(dmnModel, ctx1);
+        
assertThat(dmnResult1.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnResult1.getMessages())).isFalse();
+        assertThat(dmnResult1.getContext().get("New 
Decision")).isEqualTo(BigDecimal.valueOf(10));
+        assertThat(evaluateConditionalIds).hasSize(1).allMatch(id -> 
id.equals(ifElementId));
+        assertThat(conditionalEvaluationIds).hasSize(1).allMatch(id -> 
id.equals(thenElementId));
+        assertThat(executedDecisionIds).hasSize(1).contains(decisionId);
+
+        //
+        evaluateConditionalIds.clear();
+        conditionalEvaluationIds.clear();
+        executedDecisionIds.clear();
+        final DMNContext ctx2 = runtime.newContext();
+        ctx2.set("A", 0);
+        final DMNResult dmnResult2 = runtime.evaluateAll(dmnModel, ctx2);
+        
assertThat(dmnResult2.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnResult2.getMessages())).isFalse();
+        assertThat(dmnResult2.getContext().get("New 
Decision")).isEqualTo(BigDecimal.valueOf(-10));
+        assertThat(evaluateConditionalIds).hasSize(1).allMatch(id -> 
id.equals(ifElementId));
+        assertThat(conditionalEvaluationIds).hasSize(1).allMatch(id -> 
id.equals(elseElementId));
+        assertThat(executedDecisionIds).hasSize(1).contains(decisionId);
+    }
+
     @ParameterizedTest
     @MethodSource("params")
     void dmnInputDataNodeTypeTest(boolean useExecModelCompiler) {
diff --git 
a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/ast/DMNConditionalEvaluatorTest.java
 
b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/ast/DMNConditionalEvaluatorTest.java
index 881df88463..cbcd7004b2 100644
--- 
a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/ast/DMNConditionalEvaluatorTest.java
+++ 
b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/ast/DMNConditionalEvaluatorTest.java
@@ -34,6 +34,7 @@ import org.kie.dmn.api.core.event.DMNRuntimeEventManager;
 import org.kie.dmn.core.api.DMNExpressionEvaluator;
 import org.kie.dmn.core.impl.DMNResultImpl;
 import org.kie.dmn.model.api.DMNElement;
+import org.kie.dmn.model.api.Decision;
 import org.mockito.ArgumentCaptor;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -46,6 +47,7 @@ import static org.mockito.Mockito.when;
 
 class DMNConditionalEvaluatorTest {
 
+    private static final String DECISION_NAME = "DECISION_NAME";
     private static final String IF_ELEMENT_ID = "IF_ELEMENT_ID";
     private static final String THEN_ELEMENT_ID = "THEN_ELEMENT_ID";
     private static final String ELSE_ELEMENT_ID = "ELSE_ELEMENT_ID";
@@ -81,7 +83,10 @@ class DMNConditionalEvaluatorTest {
         when(thenEvaluatorMock.evaluate(eventManagerMock, 
dmnResultMock)).thenReturn(thenEvaluationMock);
         when(elseEvaluatorMock.evaluate(eventManagerMock, 
dmnResultMock)).thenReturn(elseEvaluationMock);
 
-        DMNElement nodeMock = mock(DMNElement.class);
+        Decision decisionMock = mock(Decision.class);
+        when(decisionMock.getName()).thenReturn(DECISION_NAME);
+        DMNElement dmnElementMocked = mock(DMNElement.class);
+        when(dmnElementMocked.getParentDRDElement()).thenReturn(decisionMock);
 
         ifIdentifier = new 
DMNConditionalEvaluator.EvaluatorIdentifier(IF_ELEMENT_ID, 
DMNConditionalEvaluator.EvaluatorType.IF);
         thenIdentifier = new 
DMNConditionalEvaluator.EvaluatorIdentifier(THEN_ELEMENT_ID, 
DMNConditionalEvaluator.EvaluatorType.THEN);
@@ -91,7 +96,7 @@ class DMNConditionalEvaluatorTest {
         EVALUATOR_ID_MAP.put(thenIdentifier, thenEvaluatorMock);
         EVALUATOR_ID_MAP.put(elseIdentifier, elseEvaluatorMock);
 
-        dmnConditionalEvaluator = new DMNConditionalEvaluator("name", 
nodeMock, EVALUATOR_ID_MAP);
+        dmnConditionalEvaluator = new DMNConditionalEvaluator("name", 
dmnElementMocked, EVALUATOR_ID_MAP);
     }
 
     @BeforeEach
diff --git 
a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/decisiontable/DTListenerTest.java
 
b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/decisiontable/DTListenerTest.java
index 27eb139fb8..fa22936ea8 100644
--- 
a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/decisiontable/DTListenerTest.java
+++ 
b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/decisiontable/DTListenerTest.java
@@ -24,7 +24,6 @@ import java.util.List;
 import java.util.Map;
 
 import org.assertj.core.api.SoftAssertions;
-import org.junit.jupiter.api.Test;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.MethodSource;
 import org.kie.dmn.api.core.DMNContext;
diff --git 
a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/impl/DMNRuntimeEventManagerUtilsTest.java
 
b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/impl/DMNRuntimeEventManagerUtilsTest.java
index 354ef23002..52a51e7e41 100644
--- 
a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/impl/DMNRuntimeEventManagerUtilsTest.java
+++ 
b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/impl/DMNRuntimeEventManagerUtilsTest.java
@@ -82,26 +82,30 @@ class DMNRuntimeEventManagerUtilsTest {
     @Test
     void fireAfterConditionalEvaluation() {
         EvaluatorResult evaluatorResult = mock(EvaluatorResult.class);
-        String name = "NAME";
+        String conditionalName = "NAME";
+        String decisionName = "DECISION";
         String executedId = "EXECUTED_ID";
-        
DMNRuntimeEventManagerUtils.fireAfterConditionalEvaluation(eventManagerMock, 
name, evaluatorResult, executedId);
+        
DMNRuntimeEventManagerUtils.fireAfterConditionalEvaluation(eventManagerMock, 
conditionalName, decisionName, evaluatorResult, executedId);
         ArgumentCaptor<AfterConditionalEvaluationEvent> 
conditionalEvaluationEventArgumentCaptor = 
ArgumentCaptor.forClass(AfterConditionalEvaluationEvent.class);
         verify(spiedListener).afterConditionalEvaluation 
(conditionalEvaluationEventArgumentCaptor.capture());
         AfterConditionalEvaluationEvent evaluateConditionalEvent = 
conditionalEvaluationEventArgumentCaptor.getValue();
         assertThat(evaluateConditionalEvent).isNotNull();
-        assertThat(evaluateConditionalEvent.getNodeName()).isEqualTo(name);
+        
assertThat(evaluateConditionalEvent.getNodeName()).isEqualTo(conditionalName);
+        
assertThat(evaluateConditionalEvent.getDecisionName()).isEqualTo(decisionName);
         
assertThat(evaluateConditionalEvent.getEvaluatorResultResult()).isEqualTo(evaluatorResult);
         
assertThat(evaluateConditionalEvent.getExecutedId()).isEqualTo(executedId);
     }
 
     @Test
     void testConditionalEvent() {
-        EvaluatorResult evaluatorResult = mock(EvaluatorResult.class);
-        String name = "B [return]";
-        String executedId = "_96D34F2E-3CC0-45A6-9455-2F960361A9CC";
+        String decisionName = "B";
+        String executedId = "_F9D2FA33-4604-4AAA-8FF1-5A4AC5055385";
         Resource resource = 
ResourceFactory.newClassPathResource("valid_models/DMNv1_5/ConditionalEvent.dmn");
-        DMNRuntime dmnRuntime = 
DMNRuntimeBuilder.fromDefaults().buildConfiguration()
-                
.fromResources(Collections.singletonList(resource)).getOrElseThrow(RuntimeException::new);
+        DMNRuntime dmnRuntime = DMNRuntimeBuilder.fromDefaults()
+                .buildConfiguration()
+                .fromResources(Collections.singletonList(resource))
+                .getOrElseThrow(RuntimeException::new);
+        dmnRuntime.addListener(spiedListener);
         assertThat(dmnRuntime).isNotNull();
         String nameSpace = 
"https://kie.org/dmn/_5B448C78-0DBF-4554-92A4-8C0247EB01FD";;
 
@@ -110,18 +114,15 @@ class DMNRuntimeEventManagerUtilsTest {
         DMNContext context = DMNFactory.newContext();
         context.set("A", List.of(3));
         DMNResult dmnResult = dmnRuntime.evaluateAll(dmnModel, context);
-        
assertThat(dmnResult.getDecisionResultByName("B").getResult()).isEqualTo(List.of("pos"));
-
-        DMNRuntimeEventManager eventManager = new DMNRuntimeEventManagerImpl();
-        eventManager.addListener(spiedListener);
+        
assertThat(dmnResult.getDecisionResultByName(decisionName).getResult()).isEqualTo(List.of("pos"));
 
-        
DMNRuntimeEventManagerUtils.fireAfterConditionalEvaluation(eventManager, name, 
evaluatorResult, executedId);
         ArgumentCaptor<AfterConditionalEvaluationEvent> 
conditionalEvaluationEventArgumentCaptor = 
ArgumentCaptor.forClass(AfterConditionalEvaluationEvent.class);
         verify(spiedListener).afterConditionalEvaluation 
(conditionalEvaluationEventArgumentCaptor.capture());
         AfterConditionalEvaluationEvent evaluateConditionalEvent = 
conditionalEvaluationEventArgumentCaptor.getValue();
         assertThat(evaluateConditionalEvent).isNotNull();
-        assertThat(evaluateConditionalEvent.getNodeName()).isEqualTo(name);
-        
assertThat(evaluateConditionalEvent.getEvaluatorResultResult()).isEqualTo(evaluatorResult);
+        
assertThat(evaluateConditionalEvent.getDecisionName()).isEqualTo(decisionName);
+        EvaluatorResult retrieved = 
evaluateConditionalEvent.getEvaluatorResultResult();
+        assertThat(retrieved).isNotNull();
         
assertThat(evaluateConditionalEvent.getExecutedId()).isEqualTo(executedId);
     }
 }
\ No newline at end of file
diff --git 
a/kie-dmn/kie-dmn-legacy-tests/src/test/java/org/kie/dmn/legacy/tests/core/v1_1/DMNDecisionTableRuntimeTest.java
 
b/kie-dmn/kie-dmn-legacy-tests/src/test/java/org/kie/dmn/legacy/tests/core/v1_1/DMNDecisionTableRuntimeTest.java
index e5a15bcdaa..7a5c7d1141 100644
--- 
a/kie-dmn/kie-dmn-legacy-tests/src/test/java/org/kie/dmn/legacy/tests/core/v1_1/DMNDecisionTableRuntimeTest.java
+++ 
b/kie-dmn/kie-dmn-legacy-tests/src/test/java/org/kie/dmn/legacy/tests/core/v1_1/DMNDecisionTableRuntimeTest.java
@@ -29,7 +29,6 @@ import java.util.UUID;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.TimeUnit;
 
-import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Timeout;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.MethodSource;
diff --git 
a/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/NestedConditional.dmn
 
b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/NestedConditional.dmn
new file mode 100644
index 0000000000..ff13938528
--- /dev/null
+++ 
b/kie-dmn/kie-dmn-test-resources/src/test/resources/valid_models/DMNv1_5/NestedConditional.dmn
@@ -0,0 +1,91 @@
+<?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 xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/"; 
expressionLanguage="https://www.omg.org/spec/DMN/20230324/FEEL/"; 
namespace="https://kie.org/dmn/_0E7C2E43-9E1B-4AB6-8FD1-B3A1461B8C54"; 
id="_30FBF557-D95E-4550-945D-D0B705BF9D62" 
name="DMN_A50C20F0-B784-4749-A8FB-CF008006B0EC" 
xmlns:dmndi="https://www.omg.org/spec/DMN/20230324/DMNDI/"; 
xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/"; 
xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/"; 
xmlns:kie="https://kie.org/dmn/extens [...]
+  <inputData name="A" id="_7715EDD7-067A-4D86-B7E1-031A7F66CF3D">
+    <variable name="A" id="_EDA0C3CD-5204-4622-9940-18B9932E3C55" 
typeRef="number" />
+  </inputData>
+  <decision name="New Decision" id="_E0D45F9F-76E3-4F85-8A0D-6127965F717A">
+    <variable id="_8D290D9E-32C0-4D5F-A011-9A94D2E64E1C" typeRef="number" 
name="New Decision" />
+    <informationRequirement id="_0C714487-A634-4CA0-AA68-CE1831492229">
+      <requiredInput href="#_7715EDD7-067A-4D86-B7E1-031A7F66CF3D" />
+    </informationRequirement>
+    <context id="_D95DDE65-71A6-4506-AB09-66A461CE12E0" typeRef="number" 
label="New Decision">
+      <contextEntry id="_74284FC2-FBB0-4C94-9026-4DDC0B7CC5CB">
+        <variable id="_27CA9E90-1952-48F0-A354-F3AEFED8016B" 
name="ContextEntry-1" typeRef="number" />
+        <conditional id="_6A6CABE7-BB94-4B34-B312-CCF97550D869" 
label="ContextEntry-1">
+          <if id="_80CE666C-3436-4767-8A1D-2BE427F5679C">
+            <literalExpression id="_80550B06-6A96-4C46-8D10-DD7D2E681C95" 
label="Expression Name">
+              <text>A &gt; 0</text>
+            </literalExpression>
+          </if>
+          <then id="_C69417CB-474E-4742-9D26-8D1ADB75CAEC">
+            <literalExpression id="_D9E73191-D7E0-43C6-966F-E45BA5086F4B" 
label="Expression Name">
+              <text>10</text>
+            </literalExpression>
+          </then>
+          <else id="_0C94AE89-A771-4CD8-A62F-B7BA7F8F2359">
+            <literalExpression id="_A8DD132E-F489-4162-966F-4F4C3F198423" 
label="Expression Name">
+              <text>-10</text>
+            </literalExpression>
+          </else>
+        </conditional>
+      </contextEntry>
+      <contextEntry id="_9AF5E1C3-7A38-47B8-B5AC-FD9772115CBC">
+        <literalExpression id="_3D8E3BB1-6A75-4087-B233-01BE40C8E403" 
typeRef="number" label="New Decision">
+          <text>ContextEntry-1</text>
+        </literalExpression>
+      </contextEntry>
+    </context>
+  </decision>
+  <dmndi:DMNDI>
+    <dmndi:DMNDiagram id="_0AA69AD4-557F-481B-B939-71EDD6D5BE8D" name="Default 
DRD" useAlternativeInputDataShape="false">
+      <di:extension>
+        <kie:ComponentsWidthsExtension>
+          <kie:ComponentWidths 
dmnElementRef="_D95DDE65-71A6-4506-AB09-66A461CE12E0">
+            <kie:width>120</kie:width>
+          </kie:ComponentWidths>
+          <kie:ComponentWidths 
dmnElementRef="_3D8E3BB1-6A75-4087-B233-01BE40C8E403">
+            <kie:width>190</kie:width>
+          </kie:ComponentWidths>
+          <kie:ComponentWidths 
dmnElementRef="_80550B06-6A96-4C46-8D10-DD7D2E681C95">
+            <kie:width>190</kie:width>
+          </kie:ComponentWidths>
+          <kie:ComponentWidths 
dmnElementRef="_D9E73191-D7E0-43C6-966F-E45BA5086F4B">
+            <kie:width>190</kie:width>
+          </kie:ComponentWidths>
+          <kie:ComponentWidths 
dmnElementRef="_A8DD132E-F489-4162-966F-4F4C3F198423">
+            <kie:width>190</kie:width>
+          </kie:ComponentWidths>
+        </kie:ComponentsWidthsExtension>
+      </di:extension>
+      <dmndi:DMNShape id="_71932E62-B3AF-4B94-82F5-E28AA1FDF211" 
dmnElementRef="_7715EDD7-067A-4D86-B7E1-031A7F66CF3D" isCollapsed="false" 
isListedInputData="false">
+        <dc:Bounds x="60" y="80" width="160" height="80" />
+      </dmndi:DMNShape>
+      <dmndi:DMNShape id="_765B15F7-DF29-4D6D-B4A8-2C0D9AC7CAC7" 
dmnElementRef="_E0D45F9F-76E3-4F85-8A0D-6127965F717A" isCollapsed="false" 
isListedInputData="false">
+        <dc:Bounds x="360" y="80" width="160" height="80" />
+      </dmndi:DMNShape>
+      <dmndi:DMNEdge id="_4516657F-0861-4577-BC70-A5030CF0CEAC-AUTO-TARGET" 
dmnElementRef="_0C714487-A634-4CA0-AA68-CE1831492229" 
sourceElement="_71932E62-B3AF-4B94-82F5-E28AA1FDF211" 
targetElement="_765B15F7-DF29-4D6D-B4A8-2C0D9AC7CAC7">
+        <di:waypoint x="140" y="120" />
+        <di:waypoint x="440" y="120" />
+      </dmndi:DMNEdge>
+    </dmndi:DMNDiagram>
+  </dmndi:DMNDI>
+</definitions>
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to