From d9aa6f958c15f843b15f732fa0fcb7a6a047cade Mon Sep 17 00:00:00 2001 From: Gabriele Cardosi Date: Wed, 16 Oct 2024 10:14:40 +0200 Subject: [PATCH] [incubator-kie-issues#1528] Adapt tracing code. Fix tests (#3727) Co-authored-by: Gabriele-Cardosi --- .../tracing/decision/event/evaluate/EvaluateEventType.java | 6 ++++++ .../decision/event/evaluate/EvaluateEventTypeTest.java | 4 ++++ .../kogito/tracing/event/trace/TraceExecutionStepType.java | 1 + 3 files changed, 11 insertions(+) diff --git a/addons/common/tracing/decision-common/src/main/java/org/kie/kogito/tracing/decision/event/evaluate/EvaluateEventType.java b/addons/common/tracing/decision-common/src/main/java/org/kie/kogito/tracing/decision/event/evaluate/EvaluateEventType.java index a548c221d7d..eb13ac290db 100644 --- a/addons/common/tracing/decision-common/src/main/java/org/kie/kogito/tracing/decision/event/evaluate/EvaluateEventType.java +++ b/addons/common/tracing/decision-common/src/main/java/org/kie/kogito/tracing/decision/event/evaluate/EvaluateEventType.java @@ -21,10 +21,12 @@ import org.kie.kogito.tracing.event.trace.TraceExecutionStepType; public enum EvaluateEventType { + AFTER_CONDITIONAL_EVALUATION(false), BEFORE_EVALUATE_ALL(true), AFTER_EVALUATE_ALL(false), BEFORE_EVALUATE_BKM(true), AFTER_EVALUATE_BKM(false), + AFTER_EVALUATE_CONDITIONAL(false), BEFORE_EVALUATE_CONTEXT_ENTRY(true), AFTER_EVALUATE_CONTEXT_ENTRY(false), BEFORE_EVALUATE_DECISION(true), @@ -52,6 +54,10 @@ public boolean isAfter() { public TraceExecutionStepType toTraceExecutionStepType() { switch (this) { + case AFTER_CONDITIONAL_EVALUATION: + case AFTER_EVALUATE_CONDITIONAL: + return TraceExecutionStepType.DMN_CONDITIONAL_INVOCATION; + case BEFORE_EVALUATE_CONTEXT_ENTRY: case AFTER_EVALUATE_CONTEXT_ENTRY: return TraceExecutionStepType.DMN_CONTEXT_ENTRY; diff --git a/addons/common/tracing/decision-common/src/test/java/org/kie/kogito/tracing/decision/event/evaluate/EvaluateEventTypeTest.java b/addons/common/tracing/decision-common/src/test/java/org/kie/kogito/tracing/decision/event/evaluate/EvaluateEventTypeTest.java index 61b59ba968e..b5203d10773 100644 --- a/addons/common/tracing/decision-common/src/test/java/org/kie/kogito/tracing/decision/event/evaluate/EvaluateEventTypeTest.java +++ b/addons/common/tracing/decision-common/src/test/java/org/kie/kogito/tracing/decision/event/evaluate/EvaluateEventTypeTest.java @@ -24,8 +24,10 @@ import java.util.Optional; import org.junit.jupiter.api.Test; +import org.kie.dmn.api.core.event.AfterConditionalEvaluationEvent; import org.kie.dmn.api.core.event.AfterEvaluateAllEvent; import org.kie.dmn.api.core.event.AfterEvaluateBKMEvent; +import org.kie.dmn.api.core.event.AfterEvaluateConditionalEvent; import org.kie.dmn.api.core.event.AfterEvaluateContextEntryEvent; import org.kie.dmn.api.core.event.AfterEvaluateDecisionEvent; import org.kie.dmn.api.core.event.AfterEvaluateDecisionServiceEvent; @@ -67,6 +69,8 @@ class EvaluateEventTypeTest { put(EvaluateEventType.AFTER_EVALUATE_DECISION_TABLE, new Pair<>("afterEvaluateDecisionTable", AfterEvaluateDecisionTableEvent.class)); put(EvaluateEventType.BEFORE_INVOKE_BKM, new Pair<>("beforeInvokeBKM", BeforeInvokeBKMEvent.class)); put(EvaluateEventType.AFTER_INVOKE_BKM, new Pair<>("afterInvokeBKM", AfterInvokeBKMEvent.class)); + put(EvaluateEventType.AFTER_CONDITIONAL_EVALUATION, new Pair<>("afterConditionalEvaluation", AfterConditionalEvaluationEvent.class)); + put(EvaluateEventType.AFTER_EVALUATE_CONDITIONAL, new Pair<>("afterEvaluateConditional", AfterEvaluateConditionalEvent.class)); } }; private static final Class LISTENER_CLASS = DMNRuntimeEventListener.class; diff --git a/addons/common/tracing/tracing-api/src/main/java/org/kie/kogito/tracing/event/trace/TraceExecutionStepType.java b/addons/common/tracing/tracing-api/src/main/java/org/kie/kogito/tracing/event/trace/TraceExecutionStepType.java index 823231adc53..bccd24c7f27 100644 --- a/addons/common/tracing/tracing-api/src/main/java/org/kie/kogito/tracing/event/trace/TraceExecutionStepType.java +++ b/addons/common/tracing/tracing-api/src/main/java/org/kie/kogito/tracing/event/trace/TraceExecutionStepType.java @@ -24,6 +24,7 @@ public enum TraceExecutionStepType { DMN_BKM_EVALUATION, DMN_BKM_INVOCATION, + DMN_CONDITIONAL_INVOCATION, DMN_CONTEXT_ENTRY, DMN_DECISION, DMN_DECISION_SERVICE,