/** * Creates a new instance of <code>{@link io.zeebe.exporter.record.value.IncidentRecordValueAssert}</code>. * * @param actual the actual value. * @return the created assertion object. */ @org.assertj.core.util.CheckReturnValue public static io.zeebe.exporter.record.value.IncidentRecordValueAssert assertThat(io.zeebe.exporter.record.value.IncidentRecordValue actual) { return new io.zeebe.exporter.record.value.IncidentRecordValueAssert(actual); }
public static void assertIncidentRecordValue( String errorType, String errorMsg, long workflowInstanceKey, String elementId, long elementInstanceKey, long jobKey, Record<IncidentRecordValue> incidentResolvedEvent) { final IncidentRecordValue incidentEventValue = incidentResolvedEvent.getValue(); Assertions.assertThat(incidentEventValue) .hasErrorType(errorType) .hasErrorMessage(errorMsg) .hasBpmnProcessId("process") .hasWorkflowInstanceKey(workflowInstanceKey) .hasElementId(elementId) .hasElementInstanceKey(elementInstanceKey) .hasJobKey(jobKey); }
public static void assertIncidentRecordValue( String errorType, String errorMsg, String elementId, Record<IncidentRecordValue> incidentRecord) { final IncidentRecordValue incidentEventValue = incidentRecord.getValue(); Assertions.assertThat(incidentEventValue) .hasErrorType(errorType) .hasErrorMessage(errorMsg) .hasElementId(elementId); }
public static void assertIncidentContainErrorDetails( Record<IncidentRecordValue> incidentEvent, String errorType, String errorMsg) { Assertions.assertThat(incidentEvent.getValue()) .hasErrorType(errorType) .hasErrorMessage(errorMsg); } }
.hasErrorType(ErrorType.EXTRACT_VALUE_ERROR.name()) .hasWorkflowInstanceKey(workflowInstanceKey) .hasElementId("task") .hasElementInstanceKey(failureEvent.getKey()) .hasJobKey(-1L) .hasVariableScopeKey(workflowInstanceKey);
.hasErrorMessage("No data found for query $.foo.");
public static void assertIncidentRecordValue( String errorType, String errorMsg, String elementId, Record<IncidentRecordValue> incidentRecord) { final IncidentRecordValue incidentEventValue = incidentRecord.getValue(); Assertions.assertThat(incidentEventValue) .hasErrorType(errorType) .hasErrorMessage(errorMsg) .hasElementId(elementId); }
public static void assertIncidentContainErrorDetails( Record<IncidentRecordValue> incidentEvent, String errorType, String errorMsg) { Assertions.assertThat(incidentEvent.getValue()) .hasErrorType(errorType) .hasErrorMessage(errorMsg); } }
.hasErrorMessage("No data found for query $.foo.");
public static void assertIncidentRecordValue( String errorType, String errorMsg, long workflowInstanceKey, String elementId, long elementInstanceKey, long jobKey, Record<IncidentRecordValue> incidentResolvedEvent) { final IncidentRecordValue incidentEventValue = incidentResolvedEvent.getValue(); Assertions.assertThat(incidentEventValue) .hasErrorType(errorType) .hasErrorMessage(errorMsg) .hasBpmnProcessId("process") .hasWorkflowInstanceKey(workflowInstanceKey) .hasElementId(elementId) .hasElementInstanceKey(elementInstanceKey) .hasJobKey(jobKey) .hasVariableScopeKey(elementInstanceKey); }
/** * An entry point for IncidentRecordValueAssert to follow AssertJ standard <code>assertThat()</code> statements.<br> * With a static import, one can write directly: <code>assertThat(myIncidentRecordValue)</code> and get specific assertion with code completion. * @param actual the IncidentRecordValue we want to make assertions on. * @return a new <code>{@link IncidentRecordValueAssert}</code> */ @org.assertj.core.util.CheckReturnValue public static IncidentRecordValueAssert assertThat(IncidentRecordValue actual) { return new IncidentRecordValueAssert(actual); } }
@Test public void shouldCreateIncidentIfCorrelationKeyNotFound() { // when final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID); final Record<WorkflowInstanceRecordValue> failureEvent = RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.EVENT_ACTIVATED) .withElementId("catch") .getFirst(); // then final Record<IncidentRecordValue> incidentRecord = RecordingExporter.incidentRecords(IncidentIntent.CREATED).getFirst(); Assertions.assertThat(incidentRecord.getValue()) .hasErrorType(ErrorType.EXTRACT_VALUE_ERROR.name()) .hasErrorMessage("Failed to extract the correlation-key by '$.orderId': no value found") .hasBpmnProcessId(PROCESS_ID) .hasWorkflowInstanceKey(workflowInstanceKey) .hasElementId("catch") .hasElementInstanceKey(failureEvent.getKey()) .hasJobKey(-1L); }
@Test public void shouldCreateIncidentIfCorrelationKeyNotFound() { // when final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID); final Record<WorkflowInstanceRecordValue> failureEvent = RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_ACTIVATING) .withElementId("catch") .getFirst(); // then final Record<IncidentRecordValue> incidentRecord = RecordingExporter.incidentRecords(IncidentIntent.CREATED).getFirst(); Assertions.assertThat(incidentRecord.getValue()) .hasErrorType(ErrorType.EXTRACT_VALUE_ERROR.name()) .hasErrorMessage("Failed to extract the correlation-key by '$.orderId': no value found") .hasBpmnProcessId(PROCESS_ID) .hasWorkflowInstanceKey(workflowInstanceKey) .hasElementId("catch") .hasElementInstanceKey(failureEvent.getKey()) .hasJobKey(-1L) .hasVariableScopeKey(failureEvent.getKey()); }
@Test public void shouldCreateIncidentIfCorrelationKeyOfInvalidType() { // when final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, MsgPackUtil.asMsgPack("orderId", true)); final Record<WorkflowInstanceRecordValue> failureEvent = RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.EVENT_ACTIVATED) .withElementId("catch") .getFirst(); // then final Record<IncidentRecordValue> incidentRecord = RecordingExporter.incidentRecords(IncidentIntent.CREATED).getFirst(); Assertions.assertThat(incidentRecord.getValue()) .hasErrorType(ErrorType.EXTRACT_VALUE_ERROR.name()) .hasErrorMessage( "Failed to extract the correlation-key by '$.orderId': the value must be either a string or a number") .hasBpmnProcessId(PROCESS_ID) .hasWorkflowInstanceKey(workflowInstanceKey) .hasElementId("catch") .hasElementInstanceKey(failureEvent.getKey()) .hasJobKey(-1L); }
@Test public void shouldCreateIncidentIfCorrelationKeyOfInvalidType() { // when final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, MsgPackUtil.asMsgPack("orderId", true)); final Record<WorkflowInstanceRecordValue> failureEvent = RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_ACTIVATING) .withElementId("catch") .getFirst(); // then final Record<IncidentRecordValue> incidentRecord = RecordingExporter.incidentRecords(IncidentIntent.CREATED).getFirst(); Assertions.assertThat(incidentRecord.getValue()) .hasErrorType(ErrorType.EXTRACT_VALUE_ERROR.name()) .hasErrorMessage( "Failed to extract the correlation-key by '$.orderId': the value must be either a string or a number") .hasBpmnProcessId(PROCESS_ID) .hasWorkflowInstanceKey(workflowInstanceKey) .hasElementId("catch") .hasElementInstanceKey(failureEvent.getKey()) .hasJobKey(-1L) .hasVariableScopeKey(failureEvent.getKey()); }
@Test public void shouldCreateIncidentIfMessageCorrelationKeyNotFound() { // when final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, MsgPackUtil.asMsgPack("key-1", "k1")); final Record<WorkflowInstanceRecordValue> failureEvent = RecordingExporter.workflowInstanceRecords(failureEventIntent) .withElementId(elementId) .getFirst(); // then final Record<IncidentRecordValue> incidentRecord = RecordingExporter.incidentRecords(IncidentIntent.CREATED).getFirst(); Assertions.assertThat(incidentRecord.getValue()) .hasErrorType(ErrorType.EXTRACT_VALUE_ERROR.name()) .hasErrorMessage("Failed to extract the correlation-key by '$.key-2': no value found") .hasBpmnProcessId(PROCESS_ID) .hasWorkflowInstanceKey(workflowInstanceKey) .hasElementId(failureEvent.getValue().getElementId()) .hasElementInstanceKey(failureEvent.getKey()) .hasJobKey(-1L); }
@Test public void shouldCreateIncidentIfMessageCorrelationKeyNotFound() { // when final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, MsgPackUtil.asMsgPack("key-1", "k1")); final Record<WorkflowInstanceRecordValue> failureEvent = RecordingExporter.workflowInstanceRecords(failureEventIntent) .withElementId(elementId) .getFirst(); // then final Record<IncidentRecordValue> incidentRecord = RecordingExporter.incidentRecords(IncidentIntent.CREATED).getFirst(); Assertions.assertThat(incidentRecord.getValue()) .hasErrorType(ErrorType.EXTRACT_VALUE_ERROR.name()) .hasErrorMessage("Failed to extract the correlation-key by '$.key-2': no value found") .hasBpmnProcessId(PROCESS_ID) .hasWorkflowInstanceKey(workflowInstanceKey) .hasElementId(failureEvent.getValue().getElementId()) .hasElementInstanceKey(failureEvent.getKey()) .hasJobKey(-1L); }
@Test public void shouldCreateIncidentIfMessageCorrelationKeyHasInvalidType() { // when final long workflowInstanceKey = testClient.createWorkflowInstance( PROCESS_ID, MsgPackUtil.asMsgPack("{'key-1':'k1', 'key-2':[1,2,3]}")); final Record<WorkflowInstanceRecordValue> failureEvent = RecordingExporter.workflowInstanceRecords(failureEventIntent) .withElementId(elementId) .getFirst(); // then final Record<IncidentRecordValue> incidentRecord = RecordingExporter.incidentRecords(IncidentIntent.CREATED).getFirst(); Assertions.assertThat(incidentRecord.getValue()) .hasErrorType(ErrorType.EXTRACT_VALUE_ERROR.name()) .hasErrorMessage( "Failed to extract the correlation-key by '$.key-2': the value must be either a string or a number") .hasBpmnProcessId(PROCESS_ID) .hasWorkflowInstanceKey(workflowInstanceKey) .hasElementId(failureEvent.getValue().getElementId()) .hasElementInstanceKey(failureEvent.getKey()) .hasJobKey(-1L); }
@Test public void shouldCreateIncidentIfMessageCorrelationKeyHasInvalidType() { // when final long workflowInstanceKey = testClient.createWorkflowInstance( PROCESS_ID, MsgPackUtil.asMsgPack("{'key-1':'k1', 'key-2':[1,2,3]}")); final Record<WorkflowInstanceRecordValue> failureEvent = RecordingExporter.workflowInstanceRecords(failureEventIntent) .withElementId(elementId) .getFirst(); // then final Record<IncidentRecordValue> incidentRecord = RecordingExporter.incidentRecords(IncidentIntent.CREATED).getFirst(); Assertions.assertThat(incidentRecord.getValue()) .hasErrorType(ErrorType.EXTRACT_VALUE_ERROR.name()) .hasErrorMessage( "Failed to extract the correlation-key by '$.key-2': the value must be either a string or a number") .hasBpmnProcessId(PROCESS_ID) .hasWorkflowInstanceKey(workflowInstanceKey) .hasElementId(failureEvent.getValue().getElementId()) .hasElementInstanceKey(failureEvent.getKey()) .hasJobKey(-1L); }