public JobRecordStream withHeaders(final Headers headers) { return valueFilter(v -> headers.equals(v.getHeaders())); }
public JobRecordStream withHeaders(final Headers headers) { return valueFilter(v -> headers.equals(v.getHeaders())); }
public void completeJobOfWorkflowInstance( final String jobType, final long workflowInstanceKey, final byte[] payload) { completeJob( jobType, payload, e -> e.getValue().getHeaders().getWorkflowInstanceKey() == workflowInstanceKey); }
public void completeJobOfWorkflowInstance( final String jobType, final long workflowInstanceKey, final byte[] payload) { completeJob( jobType, payload, e -> e.getValue().getHeaders().getWorkflowInstanceKey() == workflowInstanceKey); }
/** * Verifies that the actual JobRecordValue's headers is equal to the given one. * @param headers the given headers to compare the actual JobRecordValue's headers to. * @return this assertion object. * @throws AssertionError - if the actual JobRecordValue's headers is not equal to the given one. */ public S hasHeaders(io.zeebe.exporter.record.value.job.Headers headers) { // check that actual JobRecordValue we want to make assertions on is not null. isNotNull(); // overrides the default error message with a more explicit one String assertjErrorMessage = "\nExpecting headers of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>"; // null safe check io.zeebe.exporter.record.value.job.Headers actualHeaders = actual.getHeaders(); if (!Objects.areEqual(actualHeaders, headers)) { failWithMessage(assertjErrorMessage, actual, headers, actualHeaders); } // return the current assertion for method chaining return myself; }
public static void assertJobHeaders( long workflowInstanceKey, String activityId, Record<JobRecordValue> jobRecord) { final Headers headers = jobRecord.getValue().getHeaders(); Assertions.assertThat(headers) .hasElementId(activityId) .hasWorkflowDefinitionVersion(1) .hasBpmnProcessId(PROCESS_ID) .hasWorkflowInstanceKey(workflowInstanceKey); } }
public long createJob(final String type, Consumer<ServiceTaskBuilder> consumer, String payload) { deploy( Bpmn.createExecutableProcess("process") .startEvent() .serviceTask( "task", b -> { b.zeebeTaskType(type).zeebeTaskRetries(3); consumer.accept(b); }) .done()); final long workflowInstance = createWorkflowInstance("process", payload); return RecordingExporter.jobRecords(JobIntent.CREATED) .withType(type) .filter(j -> j.getValue().getHeaders().getWorkflowInstanceKey() == workflowInstance) .getFirst() .getKey(); }
public static void assertJobHeaders(long workflowInstanceKey, Record<JobRecordValue> jobRecord) { final Headers headers = jobRecord.getValue().getHeaders(); Assertions.assertThat(headers) .hasElementId("task") .hasWorkflowDefinitionVersion(1) .hasBpmnProcessId(PROCESS_ID) .hasWorkflowInstanceKey(workflowInstanceKey); }
public long createJob(final String type, Consumer<ServiceTaskBuilder> consumer, String payload) { deploy( Bpmn.createExecutableProcess("process") .startEvent() .serviceTask( "task", b -> { b.zeebeTaskType(type).zeebeTaskRetries(3); consumer.accept(b); }) .done()); final long workflowInstance = createWorkflowInstance("process", payload); return RecordingExporter.jobRecords(JobIntent.CREATED) .withType(type) .filter(j -> j.getValue().getHeaders().getWorkflowInstanceKey() == workflowInstance) .getFirst() .getKey(); }
public static void assertJobHeaders(long workflowInstanceKey, Record<JobRecordValue> jobRecord) { final Headers headers = jobRecord.getValue().getHeaders(); Assertions.assertThat(headers) .hasElementId("task") .hasWorkflowDefinitionVersion(1) .hasBpmnProcessId(PROCESS_ID) .hasWorkflowInstanceKey(workflowInstanceKey); }
public static void assertJobHeaders( long workflowInstanceKey, String activityId, Record<JobRecordValue> jobRecord) { final Headers headers = jobRecord.getValue().getHeaders(); Assertions.assertThat(headers) .hasElementId(activityId) .hasWorkflowDefinitionVersion(1) .hasBpmnProcessId(PROCESS_ID) .hasWorkflowInstanceKey(workflowInstanceKey); } }
final Headers jobRecordHeaders = jobRecord.getValue().getHeaders(); assertThat(headers) .contains(
final Headers jobRecordHeaders = jobRecord.getValue().getHeaders(); assertThat(headers) .contains(
@Test public void shouldCreateJobForServiceTaskInEmbeddedSubprocess() { // given testClient.deploy(ONE_TASK_SUBPROCESS); final byte[] payload = BufferUtil.bufferAsArray(MsgPackUtil.asMsgPack("key", "val")); // when testClient.createWorkflowInstance(PROCESS_ID, payload); // then final Record<JobRecordValue> jobCreatedEvent = testClient.receiveFirstJobEvent(JobIntent.CREATED); MsgPackUtil.assertEquality(payload, jobCreatedEvent.getValue().getPayload()); final Headers headers = jobCreatedEvent.getValue().getHeaders(); Assertions.assertThat(headers).hasElementId("subProcessTask"); }
@Test public void shouldCreateJobForServiceTaskInEmbeddedSubprocess() { // given testClient.deploy(ONE_TASK_SUBPROCESS); final byte[] payload = BufferUtil.bufferAsArray(MsgPackUtil.asMsgPack("key", "val")); // when testClient.createWorkflowInstance(PROCESS_ID, payload); // then final Record<JobRecordValue> jobCreatedEvent = testClient.receiveFirstJobEvent(JobIntent.CREATED); MsgPackUtil.assertEquality(payload, jobCreatedEvent.getValue().getPayload()); final Headers headers = jobCreatedEvent.getValue().getHeaders(); Assertions.assertThat(headers).hasElementId("subProcessTask"); }
@Test public void shouldRunServiceTaskAfterEmbeddedSubProcess() { // given final BpmnModelInstance model = Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .subProcess() .embeddedSubProcess() .startEvent() .endEvent() .subProcessDone() .serviceTask("task", b -> b.zeebeTaskType("type")) .endEvent() .done(); testClient.deploy(model); // when testClient.createWorkflowInstance(PROCESS_ID); // then final Record<JobRecordValue> jobCreatedEvent = testClient.receiveFirstJobEvent(JobIntent.CREATED); final Headers headers = jobCreatedEvent.getValue().getHeaders(); Assertions.assertThat(headers).hasElementId("task"); }
@Test public void shouldRunServiceTaskAfterEmbeddedSubProcess() { // given final BpmnModelInstance model = Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .subProcess() .embeddedSubProcess() .startEvent() .endEvent() .subProcessDone() .serviceTask("task", b -> b.zeebeTaskType("type")) .endEvent() .done(); testClient.deploy(model); // when testClient.createWorkflowInstance(PROCESS_ID); // then final Record<JobRecordValue> jobCreatedEvent = testClient.receiveFirstJobEvent(JobIntent.CREATED); final Headers headers = jobCreatedEvent.getValue().getHeaders(); Assertions.assertThat(headers).hasElementId("task"); }