Search in sources :

Example 1 with IncidentRecordValue

use of io.camunda.zeebe.protocol.record.value.IncidentRecordValue in project zeebe-process-test by camunda.

the class RecordStreamLogger method logIncidentRecordValue.

private String logIncidentRecordValue(final Record<?> record) {
    final IncidentRecordValue value = (IncidentRecordValue) record.getValue();
    final StringJoiner joiner = new StringJoiner(", ", "", "");
    if (record.getRecordType().equals(RecordType.EVENT)) {
        joiner.add(String.format("(Element id: %s)", value.getElementId()));
        joiner.add(String.format("(Process id: %s)", value.getBpmnProcessId()));
    }
    return joiner.toString();
}
Also used : IncidentRecordValue(io.camunda.zeebe.protocol.record.value.IncidentRecordValue) StringJoiner(java.util.StringJoiner)

Example 2 with IncidentRecordValue

use of io.camunda.zeebe.protocol.record.value.IncidentRecordValue in project zeebe-process-test by camunda.

the class IncidentLogger method summarizeIncident.

private String summarizeIncident(final Record<IncidentRecordValue> incident) {
    final IncidentRecordValue value = incident.getValue();
    final StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append(String.format("On element %s in process %s", value.getElementId(), value.getBpmnProcessId())).append(System.lineSeparator()).append("\t").append("- Error type: ").append(value.getErrorType()).append(System.lineSeparator()).append("\t").append("- Error message: ").append(value.getErrorMessage());
    return stringBuilder.toString();
}
Also used : IncidentRecordValue(io.camunda.zeebe.protocol.record.value.IncidentRecordValue)

Example 3 with IncidentRecordValue

use of io.camunda.zeebe.protocol.record.value.IncidentRecordValue in project zeebe-process-test by camunda.

the class IncidentAssert method wasRaisedInProcessInstance.

/**
 * Asserts that the incident is associated with the given process instance
 *
 * @param expectedProcessInstanceKey key of expected process instance
 * @return this {@link IncidentAssert}
 */
public IncidentAssert wasRaisedInProcessInstance(final long expectedProcessInstanceKey) {
    final IncidentRecordValue record = getIncidentCreatedRecordValue();
    final long actualProcessInstanceKey = record.getProcessInstanceKey();
    assertThat(actualProcessInstanceKey).withFailMessage("Incident was not raised in process instance %d but was raised in %s instead.%s", expectedProcessInstanceKey, actualProcessInstanceKey, composeIncidentDetails()).isEqualTo(expectedProcessInstanceKey);
    return this;
}
Also used : IncidentRecordValue(io.camunda.zeebe.protocol.record.value.IncidentRecordValue)

Example 4 with IncidentRecordValue

use of io.camunda.zeebe.protocol.record.value.IncidentRecordValue in project zeebe-process-test by camunda.

the class IncidentAssert method hasErrorType.

/**
 * Asserts that the incident has the given error type
 *
 * @param expectedErrorType expected error type
 * @return this {@link IncidentAssert}
 */
public IncidentAssert hasErrorType(final ErrorType expectedErrorType) {
    assertThat(expectedErrorType).describedAs("Parameter 'expectedErrorType").isNotNull();
    final IncidentRecordValue record = getIncidentCreatedRecordValue();
    final ErrorType actualErrorType = record.getErrorType();
    assertThat(actualErrorType).withFailMessage("Error type was not '%s' but was '%s' instead.%s", expectedErrorType, actualErrorType, composeIncidentDetails()).isEqualTo(expectedErrorType);
    return this;
}
Also used : ErrorType(io.camunda.zeebe.protocol.record.value.ErrorType) IncidentRecordValue(io.camunda.zeebe.protocol.record.value.IncidentRecordValue)

Example 5 with IncidentRecordValue

use of io.camunda.zeebe.protocol.record.value.IncidentRecordValue in project zeebe-process-test by camunda.

the class IncidentAssert method extractingErrorMessage.

/**
 * Extracts the error message for further assertions
 *
 * @return {@link StringAssert} of error message
 */
public StringAssert extractingErrorMessage() {
    final IncidentRecordValue record = getIncidentCreatedRecordValue();
    final String actualErrorMessage = record.getErrorMessage();
    return new StringAssert(actualErrorMessage);
}
Also used : IncidentRecordValue(io.camunda.zeebe.protocol.record.value.IncidentRecordValue) StringAssert(org.assertj.core.api.StringAssert)

Aggregations

IncidentRecordValue (io.camunda.zeebe.protocol.record.value.IncidentRecordValue)75 Test (org.junit.Test)55 Record (io.camunda.zeebe.protocol.record.Record)42 BpmnModelInstance (io.camunda.zeebe.model.bpmn.BpmnModelInstance)23 ProcessInstanceRecordValue (io.camunda.zeebe.protocol.record.value.ProcessInstanceRecordValue)21 Bpmn (io.camunda.zeebe.model.bpmn.Bpmn)15 IncidentIntent (io.camunda.zeebe.protocol.record.intent.IncidentIntent)15 ProcessInstanceIntent (io.camunda.zeebe.protocol.record.intent.ProcessInstanceIntent)15 RecordingExporter (io.camunda.zeebe.test.util.record.RecordingExporter)15 Map (java.util.Map)15 ErrorType (io.camunda.zeebe.protocol.record.value.ErrorType)14 EngineRule (io.camunda.zeebe.engine.util.EngineRule)12 RecordingExporterTestWatcher (io.camunda.zeebe.test.util.record.RecordingExporterTestWatcher)12 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)12 Assertions.entry (org.assertj.core.api.Assertions.entry)12 ClassRule (org.junit.ClassRule)12 Rule (org.junit.Rule)12 Assertions (io.camunda.zeebe.protocol.record.Assertions)9 JobIntent (io.camunda.zeebe.protocol.record.intent.JobIntent)9 BpmnElementType (io.camunda.zeebe.protocol.record.value.BpmnElementType)9