@Test public void shouldCreateIncidentForInputMappingFailure() { // given testClient.deploy(WORKFLOW_INPUT_MAPPING); // when final long workflowInstanceKey = testClient.createWorkflowInstance("process"); // then final Record failureEvent = testClient.receiveElementInState("failingTask", WorkflowInstanceIntent.ELEMENT_ACTIVATING); final Record createIncidentEvent = testClient.receiveFirstIncidentCommand(IncidentIntent.CREATE); final Record<IncidentRecordValue> incidentEvent = testClient.receiveFirstIncidentEvent(IncidentIntent.CREATED); assertThat(incidentEvent.getKey()).isGreaterThan(0); assertThat(createIncidentEvent.getSourceRecordPosition()).isEqualTo(failureEvent.getPosition()); assertThat(incidentEvent.getSourceRecordPosition()) .isEqualTo(createIncidentEvent.getPosition()); assertThat(incidentEvent.getValue().getVariableScopeKey()).isEqualTo(failureEvent.getKey()); assertIOMappingIncidentWithNoData(workflowInstanceKey, failureEvent, incidentEvent); }
@Test public void shouldCreateIncidentForNonMatchingAndMatchingValueOnInputMapping() { // given testClient.deploy( Bpmn.createExecutableProcess("process") .startEvent() .serviceTask( "service", t -> t.zeebeTaskType("external") .zeebeInput("$.notExisting", "$.nullVal") .zeebeInput(NODE_STRING_PATH, "$.existing")) .endEvent() .done()); // when testClient.createWorkflowInstance("process", MSGPACK_PAYLOAD); final Record<WorkflowInstanceRecordValue> failureEvent = testClient.receiveElementInState("service", WorkflowInstanceIntent.ELEMENT_ACTIVATING); final Record<IncidentRecordValue> incidentEvent = testClient.receiveFirstIncidentEvent(IncidentIntent.CREATED); // then incident is created assertThat(incidentEvent.getKey()).isGreaterThan(0); assertThat(incidentEvent.getValue().getVariableScopeKey()).isEqualTo(failureEvent.getKey()); assertIncidentRecordValue( ErrorType.IO_MAPPING_ERROR.name(), "No data found for query $.notExisting.", "service", incidentEvent); }