use of io.zeebe.broker.incident.data.ErrorType in project zeebe by zeebe-io.
the class IncidentTest method shouldCreateIncidentIfConditionFailsToEvaluate.
@Test
public void shouldCreateIncidentIfConditionFailsToEvaluate() {
// given
testClient.deploy(Bpmn.createExecutableWorkflow("workflow").startEvent().exclusiveGateway("xor").sequenceFlow("s1", s -> s.condition("$.foo < 5")).endEvent().sequenceFlow("s2", s -> s.condition("$.foo >= 5 && $.foo < 10")).endEvent().done());
// when
testClient.createWorkflowInstance("workflow", asMsgPack("foo", "bar"));
// then incident is created
final SubscribedEvent incidentEvent = testClient.receiveSingleEvent(incidentEvents("CREATE"));
assertThat(incidentEvent.key()).isGreaterThan(0);
assertThat(incidentEvent.event()).containsEntry("errorType", ErrorType.CONDITION_ERROR.name()).containsEntry("errorMessage", "Cannot compare values of different types: STRING and INTEGER").containsEntry("activityId", "xor");
}
use of io.zeebe.broker.incident.data.ErrorType in project zeebe by zeebe-io.
the class IncidentTest method shouldCreateIncidentIfExclusiveGatewayHasNoMatchingCondition.
@Test
public void shouldCreateIncidentIfExclusiveGatewayHasNoMatchingCondition() {
// given
testClient.deploy(Bpmn.createExecutableWorkflow("workflow").startEvent().exclusiveGateway("xor").sequenceFlow("s1", s -> s.condition("$.foo < 5")).endEvent().sequenceFlow("s2", s -> s.condition("$.foo >= 5 && $.foo < 10")).endEvent().done());
// when
testClient.createWorkflowInstance("workflow", asMsgPack("foo", 12));
// then incident is created
final SubscribedEvent incidentEvent = testClient.receiveSingleEvent(incidentEvents("CREATE"));
assertThat(incidentEvent.key()).isGreaterThan(0);
assertThat(incidentEvent.event()).containsEntry("errorType", ErrorType.CONDITION_ERROR.name()).containsEntry("errorMessage", "All conditions evaluated to false and no default flow is set.").containsEntry("activityId", "xor");
}
use of io.zeebe.broker.incident.data.ErrorType in project zeebe by zeebe-io.
the class IncidentTest method shouldFailToResolveIncident.
@Test
public void shouldFailToResolveIncident() throws Exception {
// given
final WorkflowDefinition modelInstance = Bpmn.createExecutableWorkflow("process").startEvent().serviceTask("failingTask", t -> t.taskType("external").input("$.foo", "$.foo").input("$.bar", "$.bar")).done();
testClient.deploy(modelInstance);
final long workflowInstanceKey = testClient.createWorkflowInstance("process");
final SubscribedEvent failureEvent = testClient.receiveSingleEvent(workflowInstanceEvents("ACTIVITY_READY"));
final SubscribedEvent incidentEvent = testClient.receiveSingleEvent(incidentEvents("CREATED"));
assertThat(incidentEvent.event()).containsEntry("errorMessage", "No data found for query $.foo.");
// when
updatePayload(workflowInstanceKey, failureEvent.key(), PAYLOAD);
// then
final SubscribedEvent resolveFailedEvent = testClient.receiveSingleEvent(incidentEvents("RESOLVE_FAILED"));
assertThat(resolveFailedEvent.key()).isEqualTo(incidentEvent.key());
assertThat(resolveFailedEvent.event()).containsEntry("errorType", ErrorType.IO_MAPPING_ERROR.name()).containsEntry("errorMessage", "No data found for query $.bar.").containsEntry("bpmnProcessId", "process").containsEntry("workflowInstanceKey", workflowInstanceKey).containsEntry("activityId", "failingTask");
}
Aggregations