use of org.kie.kogito.tracing.event.message.Message in project kogito-runtimes by kiegroup.
the class DecisionMessageTest method testSerialization.
@Test
public void testSerialization() throws JsonProcessingException {
Message message = getDecisionMessage(new Random().nextInt(5));
String retrieved = new ObjectMapper().writeValueAsString(message);
assertNotNull(retrieved);
System.out.println(retrieved);
}
use of org.kie.kogito.tracing.event.message.Message in project kogito-runtimes by kiegroup.
the class DecisionMessageTest method testDeserialization.
@Test
public void testDeserialization() throws JsonProcessingException {
String toRead = TracingTestUtils.readResourceAsString("/decisionmessage.json");
Message retrieved = new ObjectMapper().readValue(toRead, Message.class);
assertNotNull(retrieved);
assertTrue(retrieved instanceof DecisionMessage);
}
use of org.kie.kogito.tracing.event.message.Message in project kogito-runtimes by kiegroup.
the class TraceEventTest method getTraceInputValue.
private TraceInputValue getTraceInputValue(int id) {
String valueType = "type-" + id;
TypedValue value = new UnitValue(valueType);
List<Message> messages = IntStream.range(id + 1, id + 3).mapToObj(DecisionMessageTest::getDecisionMessage).collect(Collectors.toList());
return new TraceInputValue("id-" + id, "name-" + id, value, messages);
}
use of org.kie.kogito.tracing.event.message.Message in project kogito-runtimes by kiegroup.
the class TraceEventTest method getTraceExecutionStep.
private TraceExecutionStep getTraceExecutionStep(int id) {
List<Message> messages = IntStream.range(id + 1, id + 3).mapToObj(DecisionMessageTest::getDecisionMessage).collect(Collectors.toList());
Map<String, String> additionalData = Collections.singletonMap("key", "value");
List<TraceExecutionStep> children = IntStream.range(id + 1, id + 3).mapToObj(i -> getTraceExecutionStep()).collect(Collectors.toList());
return new TraceExecutionStep(getTraceExecutionStepType(), new Random().nextLong(), "name-" + id, new IntNode(id), messages, additionalData, children);
}
use of org.kie.kogito.tracing.event.message.Message in project kogito-runtimes by kiegroup.
the class TraceEventTest method getTraceOutputValue.
private TraceOutputValue getTraceOutputValue(int id) {
String valueType = "type-" + id;
TypedValue value = new UnitValue(valueType);
Map<String, TypedValue> inputs = Collections.singletonMap(valueType, value);
List<Message> messages = IntStream.range(id + 1, id + 3).mapToObj(DecisionMessageTest::getDecisionMessage).collect(Collectors.toList());
return new TraceOutputValue("id-" + id, "name-" + id, "status-" + id, value, inputs, messages);
}
Aggregations