Search in sources :

Example 1 with EVALUATE_ALL_EXECUTION_ID

use of org.kie.kogito.dmn.DecisionTestUtils.EVALUATE_ALL_EXECUTION_ID in project kogito-runtimes by kiegroup.

the class DefaultAggregatorTest method testAggregateOnEvaluateAllWithListWithMissingLastBeforeEvaluateDecisionEventReturnsNoExecutionStepHierarchy.

@Test
void testAggregateOnEvaluateAllWithListWithMissingLastBeforeEvaluateDecisionEventReturnsNoExecutionStepHierarchy() throws IOException {
    final DefaultAggregator aggregator = new DefaultAggregator();
    final List<EvaluateEvent> events = DecisionTracingTestUtils.readEvaluateEventsFromJsonResource(EVALUATE_ALL_JSON_RESOURCE).stream().filter(e -> !(e.getType() == EvaluateEventType.BEFORE_EVALUATE_DECISION && LAST_DECISION_NODE_ID.equals(e.getNodeId()))).collect(Collectors.toList());
    CloudEvent cloudEvent = aggregator.aggregate(model, EVALUATE_ALL_EXECUTION_ID, events, configBean).orElseThrow(IllegalStateException::new);
    TraceEvent traceEvent = assertValidCloudEventAndGetData(cloudEvent, EVALUATE_ALL_EXECUTION_ID);
    assertTraceEventWithNoExecutionStepsHierarchy(traceEvent, 2, 2, 6);
}
Also used : TraceEventType(org.kie.kogito.tracing.event.trace.TraceEventType) Assertions.fail(org.junit.jupiter.api.Assertions.fail) DecisionTestUtils.createDMNModel(org.kie.kogito.dmn.DecisionTestUtils.createDMNModel) CloudEvent(io.cloudevents.CloudEvent) MessageCategory(org.kie.kogito.tracing.event.message.MessageCategory) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) EVALUATE_DECISION_SERVICE_JSON_RESOURCE(org.kie.kogito.tracing.decision.DecisionTracingTestUtils.EVALUATE_DECISION_SERVICE_JSON_RESOURCE) EVALUATE_ALL_JSON_RESOURCE(org.kie.kogito.tracing.decision.DecisionTracingTestUtils.EVALUATE_ALL_JSON_RESOURCE) EVALUATE_DECISION_SERVICE_EXECUTION_ID(org.kie.kogito.dmn.DecisionTestUtils.EVALUATE_DECISION_SERVICE_EXECUTION_ID) DMNModel(org.kie.dmn.api.core.DMNModel) BeforeAll(org.junit.jupiter.api.BeforeAll) DECISION_SERVICE_DECISION_ID(org.kie.kogito.dmn.DecisionTestUtils.DECISION_SERVICE_DECISION_ID) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) InternalMessageType(org.kie.kogito.tracing.decision.message.InternalMessageType) EvaluateEventType(org.kie.kogito.tracing.decision.event.evaluate.EvaluateEventType) TraceEvent(org.kie.kogito.tracing.event.trace.TraceEvent) EvaluateEvent(org.kie.kogito.tracing.decision.event.evaluate.EvaluateEvent) FIRST_DECISION_NODE_ID(org.kie.kogito.dmn.DecisionTestUtils.FIRST_DECISION_NODE_ID) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) Assertions.assertSame(org.junit.jupiter.api.Assertions.assertSame) Test(org.junit.jupiter.api.Test) List(java.util.List) DecisionTestUtils(org.kie.kogito.dmn.DecisionTestUtils) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Collections(java.util.Collections) EVALUATE_ALL_EXECUTION_ID(org.kie.kogito.dmn.DecisionTestUtils.EVALUATE_ALL_EXECUTION_ID) LAST_DECISION_NODE_ID(org.kie.kogito.dmn.DecisionTestUtils.LAST_DECISION_NODE_ID) DecisionTracingTestUtils(org.kie.kogito.tracing.decision.DecisionTracingTestUtils) StaticConfigBean(org.kie.kogito.conf.StaticConfigBean) CloudEvent(io.cloudevents.CloudEvent) EvaluateEvent(org.kie.kogito.tracing.decision.event.evaluate.EvaluateEvent) TraceEvent(org.kie.kogito.tracing.event.trace.TraceEvent) Test(org.junit.jupiter.api.Test)

Example 2 with EVALUATE_ALL_EXECUTION_ID

use of org.kie.kogito.dmn.DecisionTestUtils.EVALUATE_ALL_EXECUTION_ID in project kogito-runtimes by kiegroup.

the class DefaultAggregatorTest method testAggregateOnEvaluateAllWithListWithMissingFirstBeforeEvaluateDecisionEventReturnsNoExecutionStepHierarchy.

@Test
void testAggregateOnEvaluateAllWithListWithMissingFirstBeforeEvaluateDecisionEventReturnsNoExecutionStepHierarchy() throws IOException {
    final DefaultAggregator aggregator = new DefaultAggregator();
    final List<EvaluateEvent> events = DecisionTracingTestUtils.readEvaluateEventsFromJsonResource(EVALUATE_ALL_JSON_RESOURCE).stream().filter(e -> !(e.getType() == EvaluateEventType.BEFORE_EVALUATE_DECISION && FIRST_DECISION_NODE_ID.equals(e.getNodeId()))).collect(Collectors.toList());
    CloudEvent cloudEvent = aggregator.aggregate(model, EVALUATE_ALL_EXECUTION_ID, events, configBean).orElseThrow(IllegalStateException::new);
    TraceEvent traceEvent = assertValidCloudEventAndGetData(cloudEvent, EVALUATE_ALL_EXECUTION_ID);
    assertTraceEventWithNoExecutionStepsHierarchy(traceEvent, 2, 2, 6);
}
Also used : TraceEventType(org.kie.kogito.tracing.event.trace.TraceEventType) Assertions.fail(org.junit.jupiter.api.Assertions.fail) DecisionTestUtils.createDMNModel(org.kie.kogito.dmn.DecisionTestUtils.createDMNModel) CloudEvent(io.cloudevents.CloudEvent) MessageCategory(org.kie.kogito.tracing.event.message.MessageCategory) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) EVALUATE_DECISION_SERVICE_JSON_RESOURCE(org.kie.kogito.tracing.decision.DecisionTracingTestUtils.EVALUATE_DECISION_SERVICE_JSON_RESOURCE) EVALUATE_ALL_JSON_RESOURCE(org.kie.kogito.tracing.decision.DecisionTracingTestUtils.EVALUATE_ALL_JSON_RESOURCE) EVALUATE_DECISION_SERVICE_EXECUTION_ID(org.kie.kogito.dmn.DecisionTestUtils.EVALUATE_DECISION_SERVICE_EXECUTION_ID) DMNModel(org.kie.dmn.api.core.DMNModel) BeforeAll(org.junit.jupiter.api.BeforeAll) DECISION_SERVICE_DECISION_ID(org.kie.kogito.dmn.DecisionTestUtils.DECISION_SERVICE_DECISION_ID) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) InternalMessageType(org.kie.kogito.tracing.decision.message.InternalMessageType) EvaluateEventType(org.kie.kogito.tracing.decision.event.evaluate.EvaluateEventType) TraceEvent(org.kie.kogito.tracing.event.trace.TraceEvent) EvaluateEvent(org.kie.kogito.tracing.decision.event.evaluate.EvaluateEvent) FIRST_DECISION_NODE_ID(org.kie.kogito.dmn.DecisionTestUtils.FIRST_DECISION_NODE_ID) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) Assertions.assertSame(org.junit.jupiter.api.Assertions.assertSame) Test(org.junit.jupiter.api.Test) List(java.util.List) DecisionTestUtils(org.kie.kogito.dmn.DecisionTestUtils) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Collections(java.util.Collections) EVALUATE_ALL_EXECUTION_ID(org.kie.kogito.dmn.DecisionTestUtils.EVALUATE_ALL_EXECUTION_ID) LAST_DECISION_NODE_ID(org.kie.kogito.dmn.DecisionTestUtils.LAST_DECISION_NODE_ID) DecisionTracingTestUtils(org.kie.kogito.tracing.decision.DecisionTracingTestUtils) StaticConfigBean(org.kie.kogito.conf.StaticConfigBean) CloudEvent(io.cloudevents.CloudEvent) EvaluateEvent(org.kie.kogito.tracing.decision.event.evaluate.EvaluateEvent) TraceEvent(org.kie.kogito.tracing.event.trace.TraceEvent) Test(org.junit.jupiter.api.Test)

Example 3 with EVALUATE_ALL_EXECUTION_ID

use of org.kie.kogito.dmn.DecisionTestUtils.EVALUATE_ALL_EXECUTION_ID in project kogito-runtimes by kiegroup.

the class DefaultAggregatorTest method testAggregateOnEvaluateAllWithListWithMissingFirstAfterEvaluateDecisionEventReturnsNoExecutionStepHierarchy.

@Test
void testAggregateOnEvaluateAllWithListWithMissingFirstAfterEvaluateDecisionEventReturnsNoExecutionStepHierarchy() throws IOException {
    final DefaultAggregator aggregator = new DefaultAggregator();
    final List<EvaluateEvent> events = DecisionTracingTestUtils.readEvaluateEventsFromJsonResource(EVALUATE_ALL_JSON_RESOURCE).stream().filter(e -> !(e.getType() == EvaluateEventType.AFTER_EVALUATE_DECISION && FIRST_DECISION_NODE_ID.equals(e.getNodeId()))).collect(Collectors.toList());
    CloudEvent cloudEvent = aggregator.aggregate(model, EVALUATE_ALL_EXECUTION_ID, events, configBean).orElseThrow(IllegalStateException::new);
    TraceEvent traceEvent = assertValidCloudEventAndGetData(cloudEvent, EVALUATE_ALL_EXECUTION_ID);
    assertTraceEventWithNoExecutionStepsHierarchy(traceEvent, 2, 2, 5);
}
Also used : TraceEventType(org.kie.kogito.tracing.event.trace.TraceEventType) Assertions.fail(org.junit.jupiter.api.Assertions.fail) DecisionTestUtils.createDMNModel(org.kie.kogito.dmn.DecisionTestUtils.createDMNModel) CloudEvent(io.cloudevents.CloudEvent) MessageCategory(org.kie.kogito.tracing.event.message.MessageCategory) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) EVALUATE_DECISION_SERVICE_JSON_RESOURCE(org.kie.kogito.tracing.decision.DecisionTracingTestUtils.EVALUATE_DECISION_SERVICE_JSON_RESOURCE) EVALUATE_ALL_JSON_RESOURCE(org.kie.kogito.tracing.decision.DecisionTracingTestUtils.EVALUATE_ALL_JSON_RESOURCE) EVALUATE_DECISION_SERVICE_EXECUTION_ID(org.kie.kogito.dmn.DecisionTestUtils.EVALUATE_DECISION_SERVICE_EXECUTION_ID) DMNModel(org.kie.dmn.api.core.DMNModel) BeforeAll(org.junit.jupiter.api.BeforeAll) DECISION_SERVICE_DECISION_ID(org.kie.kogito.dmn.DecisionTestUtils.DECISION_SERVICE_DECISION_ID) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) InternalMessageType(org.kie.kogito.tracing.decision.message.InternalMessageType) EvaluateEventType(org.kie.kogito.tracing.decision.event.evaluate.EvaluateEventType) TraceEvent(org.kie.kogito.tracing.event.trace.TraceEvent) EvaluateEvent(org.kie.kogito.tracing.decision.event.evaluate.EvaluateEvent) FIRST_DECISION_NODE_ID(org.kie.kogito.dmn.DecisionTestUtils.FIRST_DECISION_NODE_ID) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) Assertions.assertSame(org.junit.jupiter.api.Assertions.assertSame) Test(org.junit.jupiter.api.Test) List(java.util.List) DecisionTestUtils(org.kie.kogito.dmn.DecisionTestUtils) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Collections(java.util.Collections) EVALUATE_ALL_EXECUTION_ID(org.kie.kogito.dmn.DecisionTestUtils.EVALUATE_ALL_EXECUTION_ID) LAST_DECISION_NODE_ID(org.kie.kogito.dmn.DecisionTestUtils.LAST_DECISION_NODE_ID) DecisionTracingTestUtils(org.kie.kogito.tracing.decision.DecisionTracingTestUtils) StaticConfigBean(org.kie.kogito.conf.StaticConfigBean) CloudEvent(io.cloudevents.CloudEvent) EvaluateEvent(org.kie.kogito.tracing.decision.event.evaluate.EvaluateEvent) TraceEvent(org.kie.kogito.tracing.event.trace.TraceEvent) Test(org.junit.jupiter.api.Test)

Example 4 with EVALUATE_ALL_EXECUTION_ID

use of org.kie.kogito.dmn.DecisionTestUtils.EVALUATE_ALL_EXECUTION_ID in project kogito-runtimes by kiegroup.

the class DefaultAggregatorTest method testAggregateOnEvaluateAllWithListWithMissingLastAfterEvaluateDecisionEventReturnsNoExecutionStepHierarchy.

@Test
void testAggregateOnEvaluateAllWithListWithMissingLastAfterEvaluateDecisionEventReturnsNoExecutionStepHierarchy() throws IOException {
    final DefaultAggregator aggregator = new DefaultAggregator();
    final List<EvaluateEvent> events = DecisionTracingTestUtils.readEvaluateEventsFromJsonResource(EVALUATE_ALL_JSON_RESOURCE).stream().filter(e -> !(e.getType() == EvaluateEventType.AFTER_EVALUATE_DECISION && LAST_DECISION_NODE_ID.equals(e.getNodeId()))).collect(Collectors.toList());
    CloudEvent cloudEvent = aggregator.aggregate(model, EVALUATE_ALL_EXECUTION_ID, events, configBean).orElseThrow(IllegalStateException::new);
    TraceEvent traceEvent = assertValidCloudEventAndGetData(cloudEvent, EVALUATE_ALL_EXECUTION_ID);
    assertTraceEventWithNoExecutionStepsHierarchy(traceEvent, 2, 2, 5);
}
Also used : TraceEventType(org.kie.kogito.tracing.event.trace.TraceEventType) Assertions.fail(org.junit.jupiter.api.Assertions.fail) DecisionTestUtils.createDMNModel(org.kie.kogito.dmn.DecisionTestUtils.createDMNModel) CloudEvent(io.cloudevents.CloudEvent) MessageCategory(org.kie.kogito.tracing.event.message.MessageCategory) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) EVALUATE_DECISION_SERVICE_JSON_RESOURCE(org.kie.kogito.tracing.decision.DecisionTracingTestUtils.EVALUATE_DECISION_SERVICE_JSON_RESOURCE) EVALUATE_ALL_JSON_RESOURCE(org.kie.kogito.tracing.decision.DecisionTracingTestUtils.EVALUATE_ALL_JSON_RESOURCE) EVALUATE_DECISION_SERVICE_EXECUTION_ID(org.kie.kogito.dmn.DecisionTestUtils.EVALUATE_DECISION_SERVICE_EXECUTION_ID) DMNModel(org.kie.dmn.api.core.DMNModel) BeforeAll(org.junit.jupiter.api.BeforeAll) DECISION_SERVICE_DECISION_ID(org.kie.kogito.dmn.DecisionTestUtils.DECISION_SERVICE_DECISION_ID) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) InternalMessageType(org.kie.kogito.tracing.decision.message.InternalMessageType) EvaluateEventType(org.kie.kogito.tracing.decision.event.evaluate.EvaluateEventType) TraceEvent(org.kie.kogito.tracing.event.trace.TraceEvent) EvaluateEvent(org.kie.kogito.tracing.decision.event.evaluate.EvaluateEvent) FIRST_DECISION_NODE_ID(org.kie.kogito.dmn.DecisionTestUtils.FIRST_DECISION_NODE_ID) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) Assertions.assertSame(org.junit.jupiter.api.Assertions.assertSame) Test(org.junit.jupiter.api.Test) List(java.util.List) DecisionTestUtils(org.kie.kogito.dmn.DecisionTestUtils) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Collections(java.util.Collections) EVALUATE_ALL_EXECUTION_ID(org.kie.kogito.dmn.DecisionTestUtils.EVALUATE_ALL_EXECUTION_ID) LAST_DECISION_NODE_ID(org.kie.kogito.dmn.DecisionTestUtils.LAST_DECISION_NODE_ID) DecisionTracingTestUtils(org.kie.kogito.tracing.decision.DecisionTracingTestUtils) StaticConfigBean(org.kie.kogito.conf.StaticConfigBean) CloudEvent(io.cloudevents.CloudEvent) EvaluateEvent(org.kie.kogito.tracing.decision.event.evaluate.EvaluateEvent) TraceEvent(org.kie.kogito.tracing.event.trace.TraceEvent) Test(org.junit.jupiter.api.Test)

Aggregations

CloudEvent (io.cloudevents.CloudEvent)4 IOException (java.io.IOException)4 Collections (java.util.Collections)4 List (java.util.List)4 Collectors (java.util.stream.Collectors)4 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)4 Assertions.assertNull (org.junit.jupiter.api.Assertions.assertNull)4 Assertions.assertSame (org.junit.jupiter.api.Assertions.assertSame)4 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)4 Assertions.fail (org.junit.jupiter.api.Assertions.fail)4 BeforeAll (org.junit.jupiter.api.BeforeAll)4 Test (org.junit.jupiter.api.Test)4 DMNModel (org.kie.dmn.api.core.DMNModel)4 StaticConfigBean (org.kie.kogito.conf.StaticConfigBean)4 DecisionTestUtils (org.kie.kogito.dmn.DecisionTestUtils)4 DECISION_SERVICE_DECISION_ID (org.kie.kogito.dmn.DecisionTestUtils.DECISION_SERVICE_DECISION_ID)4 EVALUATE_ALL_EXECUTION_ID (org.kie.kogito.dmn.DecisionTestUtils.EVALUATE_ALL_EXECUTION_ID)4 EVALUATE_DECISION_SERVICE_EXECUTION_ID (org.kie.kogito.dmn.DecisionTestUtils.EVALUATE_DECISION_SERVICE_EXECUTION_ID)4 FIRST_DECISION_NODE_ID (org.kie.kogito.dmn.DecisionTestUtils.FIRST_DECISION_NODE_ID)4 LAST_DECISION_NODE_ID (org.kie.kogito.dmn.DecisionTestUtils.LAST_DECISION_NODE_ID)4