use of io.camunda.zeebe.protocol.record.intent.IncidentIntent.RESOLVE in project zeebe by camunda.
the class MappingIncidentTest method shouldCreateNewIncidentAfterResolvedFirstOne.
@Test
public void shouldCreateNewIncidentAfterResolvedFirstOne() {
// given
final BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("process").startEvent().serviceTask("failingTask", t -> t.zeebeJobType("external").zeebeInputExpression("foo", "foo").zeebeInputExpression("bar", "bar")).done();
ENGINE.deployment().withXmlResource(modelInstance).deploy();
final long processInstanceKey = ENGINE.processInstance().ofBpmnProcessId("process").create();
final Record failureEvent = RecordingExporter.processInstanceRecords().withProcessInstanceKey(processInstanceKey).withElementId("failingTask").withIntent(ProcessInstanceIntent.ELEMENT_ACTIVATING).getFirst();
final Record<IncidentRecordValue> incidentEvent = RecordingExporter.incidentRecords().withProcessInstanceKey(processInstanceKey).withIntent(IncidentIntent.CREATED).getFirst();
assertThat(incidentEvent.getValue().getErrorMessage()).contains("no variable found for name 'foo'");
// when
ENGINE.variables().ofScope(failureEvent.getKey()).withDocument(VARIABLES).update();
final Record<IncidentRecordValue> resolvedEvent = ENGINE.incident().ofInstance(processInstanceKey).withKey(incidentEvent.getKey()).resolve();
// then
assertThat(resolvedEvent.getKey()).isEqualTo(incidentEvent.getKey());
final Record<IncidentRecordValue> secondIncidentEvent = RecordingExporter.incidentRecords().onlyEvents().withProcessInstanceKey(processInstanceKey).skipUntil(e -> e.getIntent() == RESOLVED).withIntent(IncidentIntent.CREATED).getFirst();
Assertions.assertThat(secondIncidentEvent.getValue()).hasErrorType(ErrorType.IO_MAPPING_ERROR).hasBpmnProcessId("process").hasProcessInstanceKey(processInstanceKey).hasElementId("failingTask").hasElementInstanceKey(failureEvent.getKey()).hasVariableScopeKey(failureEvent.getKey());
assertThat(secondIncidentEvent.getValue().getErrorMessage()).contains("no variable found for name 'bar'");
}
use of io.camunda.zeebe.protocol.record.intent.IncidentIntent.RESOLVE in project zeebe by camunda-cloud.
the class MappingIncidentTest method shouldCreateNewIncidentAfterResolvedFirstOne.
@Test
public void shouldCreateNewIncidentAfterResolvedFirstOne() {
// given
final BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("process").startEvent().serviceTask("failingTask", t -> t.zeebeJobType("external").zeebeInputExpression("foo", "foo").zeebeInputExpression("bar", "bar")).done();
ENGINE.deployment().withXmlResource(modelInstance).deploy();
final long processInstanceKey = ENGINE.processInstance().ofBpmnProcessId("process").create();
final Record failureEvent = RecordingExporter.processInstanceRecords().withProcessInstanceKey(processInstanceKey).withElementId("failingTask").withIntent(ProcessInstanceIntent.ELEMENT_ACTIVATING).getFirst();
final Record<IncidentRecordValue> incidentEvent = RecordingExporter.incidentRecords().withProcessInstanceKey(processInstanceKey).withIntent(IncidentIntent.CREATED).getFirst();
assertThat(incidentEvent.getValue().getErrorMessage()).contains("no variable found for name 'foo'");
// when
ENGINE.variables().ofScope(failureEvent.getKey()).withDocument(VARIABLES).update();
final Record<IncidentRecordValue> resolvedEvent = ENGINE.incident().ofInstance(processInstanceKey).withKey(incidentEvent.getKey()).resolve();
// then
assertThat(resolvedEvent.getKey()).isEqualTo(incidentEvent.getKey());
final Record<IncidentRecordValue> secondIncidentEvent = RecordingExporter.incidentRecords().onlyEvents().withProcessInstanceKey(processInstanceKey).skipUntil(e -> e.getIntent() == RESOLVED).withIntent(IncidentIntent.CREATED).getFirst();
Assertions.assertThat(secondIncidentEvent.getValue()).hasErrorType(ErrorType.IO_MAPPING_ERROR).hasBpmnProcessId("process").hasProcessInstanceKey(processInstanceKey).hasElementId("failingTask").hasElementInstanceKey(failureEvent.getKey()).hasVariableScopeKey(failureEvent.getKey());
assertThat(secondIncidentEvent.getValue().getErrorMessage()).contains("no variable found for name 'bar'");
}
use of io.camunda.zeebe.protocol.record.intent.IncidentIntent.RESOLVE in project zeebe by zeebe-io.
the class MappingIncidentTest method shouldCreateNewIncidentAfterResolvedFirstOne.
@Test
public void shouldCreateNewIncidentAfterResolvedFirstOne() {
// given
final BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("process").startEvent().serviceTask("failingTask", t -> t.zeebeJobType("external").zeebeInputExpression("foo", "foo").zeebeInputExpression("bar", "bar")).done();
ENGINE.deployment().withXmlResource(modelInstance).deploy();
final long processInstanceKey = ENGINE.processInstance().ofBpmnProcessId("process").create();
final Record failureEvent = RecordingExporter.processInstanceRecords().withProcessInstanceKey(processInstanceKey).withElementId("failingTask").withIntent(ProcessInstanceIntent.ELEMENT_ACTIVATING).getFirst();
final Record<IncidentRecordValue> incidentEvent = RecordingExporter.incidentRecords().withProcessInstanceKey(processInstanceKey).withIntent(IncidentIntent.CREATED).getFirst();
assertThat(incidentEvent.getValue().getErrorMessage()).contains("no variable found for name 'foo'");
// when
ENGINE.variables().ofScope(failureEvent.getKey()).withDocument(VARIABLES).update();
final Record<IncidentRecordValue> resolvedEvent = ENGINE.incident().ofInstance(processInstanceKey).withKey(incidentEvent.getKey()).resolve();
// then
assertThat(resolvedEvent.getKey()).isEqualTo(incidentEvent.getKey());
final Record<IncidentRecordValue> secondIncidentEvent = RecordingExporter.incidentRecords().onlyEvents().withProcessInstanceKey(processInstanceKey).skipUntil(e -> e.getIntent() == RESOLVED).withIntent(IncidentIntent.CREATED).getFirst();
Assertions.assertThat(secondIncidentEvent.getValue()).hasErrorType(ErrorType.IO_MAPPING_ERROR).hasBpmnProcessId("process").hasProcessInstanceKey(processInstanceKey).hasElementId("failingTask").hasElementInstanceKey(failureEvent.getKey()).hasVariableScopeKey(failureEvent.getKey());
assertThat(secondIncidentEvent.getValue().getErrorMessage()).contains("no variable found for name 'bar'");
}
Aggregations