public WorkflowInstanceRecordStream withScopeInstanceKey(final long scopeInstanceKey) { return valueFilter(v -> v.getScopeInstanceKey() == scopeInstanceKey); }
/** * Verifies that the actual WorkflowInstanceRecordValue's scopeInstanceKey is equal to the given one. * @param scopeInstanceKey the given scopeInstanceKey to compare the actual WorkflowInstanceRecordValue's scopeInstanceKey to. * @return this assertion object. * @throws AssertionError - if the actual WorkflowInstanceRecordValue's scopeInstanceKey is not equal to the given one. */ public S hasScopeInstanceKey(long scopeInstanceKey) { // check that actual WorkflowInstanceRecordValue we want to make assertions on is not null. isNotNull(); // overrides the default error message with a more explicit one String assertjErrorMessage = "\nExpecting scopeInstanceKey of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>"; // check long actualScopeInstanceKey = actual.getScopeInstanceKey(); if (actualScopeInstanceKey != scopeInstanceKey) { failWithMessage(assertjErrorMessage, actual, scopeInstanceKey, actualScopeInstanceKey); } // return the current assertion for method chaining return myself; }
@Test public void shouldResolveIncidentForInputMappingFailure() { // given testClient.deploy(WORKFLOW_INPUT_MAPPING); final long workflowInstanceKey = testClient.createWorkflowInstance("process"); final Record<WorkflowInstanceRecordValue> failureEvent = testClient.receiveElementInState("failingTask", WorkflowInstanceIntent.ELEMENT_READY); final Record<IncidentRecordValue> incidentEvent = testClient.receiveFirstIncidentEvent(IncidentIntent.CREATED); // when testClient.updatePayload(failureEvent.getValue().getScopeInstanceKey(), PAYLOAD); testClient.resolveIncident(incidentEvent.getKey()); // then final Record<WorkflowInstanceRecordValue> followUpEvent = testClient.receiveElementInState("failingTask", WorkflowInstanceIntent.ELEMENT_ACTIVATED); assertWorkflowInstancePayload(followUpEvent, "{'foo':'bar'}"); final Record incidentResolveCommand = testClient.receiveFirstIncidentCommand(RESOLVE); final Record incidentResolvedEvent = testClient.receiveFirstIncidentEvent(RESOLVED); assertThat(incidentResolvedEvent.getKey()).isEqualTo(incidentEvent.getKey()); assertThat(incidentResolveCommand.getPosition()) .isEqualTo(followUpEvent.getSourceRecordPosition()); assertThat(incidentResolveCommand.getPosition()) .isEqualTo(incidentResolvedEvent.getSourceRecordPosition()); assertIOMappingIncidentWithNoData(workflowInstanceKey, followUpEvent, incidentResolvedEvent); }
.withIntent(WorkflowInstanceIntent.ELEMENT_READY) .getFirst(); assertThat(subProcessReady.getValue().getScopeInstanceKey()).isEqualTo(workflowInstanceKey); .withIntent(WorkflowInstanceIntent.ELEMENT_READY) .getFirst(); assertThat(subProcessTaskReady.getValue().getScopeInstanceKey()) .isEqualTo(subProcessReady.getKey());
failureEvent.getValue().getScopeInstanceKey(), "{'string':{'obj':'test'}}"); testClient.resolveIncident(incidentEvent.getKey());