public JobRecordStream withCustomHeader(final String key, final Object value) { return valueFilter(v -> value.equals(v.getCustomHeaders().get(key))); }
public JobRecordStream withCustomHeaders(final Map<String, Object> customHeaders) { return valueFilter(v -> customHeaders.equals(v.getCustomHeaders())); }
public JobRecordStream withCustomHeaders(final Map<String, Object> customHeaders) { return valueFilter(v -> customHeaders.equals(v.getCustomHeaders())); }
public JobRecordStream withCustomHeader(final String key, final Object value) { return valueFilter(v -> value.equals(v.getCustomHeaders().get(key))); }
/** * Verifies that the actual JobRecordValue's customHeaders is equal to the given one. * @param customHeaders the given customHeaders to compare the actual JobRecordValue's customHeaders to. * @return this assertion object. * @throws AssertionError - if the actual JobRecordValue's customHeaders is not equal to the given one. */ public S hasCustomHeaders(java.util.Map customHeaders) { // 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 customHeaders of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>"; // null safe check java.util.Map actualCustomHeaders = actual.getCustomHeaders(); if (!Objects.areEqual(actualCustomHeaders, customHeaders)) { failWithMessage(assertjErrorMessage, actual, customHeaders, actualCustomHeaders); } // return the current assertion for method chaining return myself; }
@Test public void shouldActivateJobsWithLongCustomHeaders() { // given final BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("processId") .startEvent() .serviceTask( "task", b -> { b.zeebeTaskType("taskType").zeebeTaskHeader("foo", LONG_CUSTOM_HEADER_VALUE); }) .endEvent() .done(); apiRule.partitionClient().deployWithResponse(Bpmn.convertToString(modelInstance).getBytes()); apiRule.partitionClient().createWorkflowInstance("processId"); // when apiRule.partitionClient().completeJobOfType("taskType"); // then final JobRecordValue jobRecord = RecordingExporter.jobRecords(JobIntent.ACTIVATED).limit(1).getFirst().getValue(); assertThat(jobRecord.getCustomHeaders().get("foo")).isEqualTo(LONG_CUSTOM_HEADER_VALUE); }
@Test public void shouldActivateJobsWithLongCustomHeaders() { // given final BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("processId") .startEvent() .serviceTask( "task", b -> { b.zeebeTaskType("taskType").zeebeTaskHeader("foo", LONG_CUSTOM_HEADER_VALUE); }) .endEvent() .done(); apiRule.partitionClient().deployWithResponse(Bpmn.convertToString(modelInstance).getBytes()); apiRule.partitionClient().createWorkflowInstance("processId"); // when apiRule.partitionClient().completeJobOfType("taskType"); // then final JobRecordValue jobRecord = RecordingExporter.jobRecords(JobIntent.ACTIVATED).limit(1).getFirst().getValue(); assertThat(jobRecord.getCustomHeaders().get("foo")).isEqualTo(LONG_CUSTOM_HEADER_VALUE); }
assertThat(customHeaders).isEqualTo(jobRecord.getValue().getCustomHeaders());
assertThat(customHeaders).isEqualTo(jobRecord.getValue().getCustomHeaders());
@Test public void shouldCreateJobWithWorkflowInstanceAndCustomHeaders() { // given testClient.deploy( Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .serviceTask( "foo", t -> t.zeebeTaskType("bar").zeebeTaskHeader("a", "b").zeebeTaskHeader("c", "d")) .endEvent() .done()); // when final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID); // then final Record<JobRecordValue> event = testClient.receiveFirstJobCommand(JobIntent.CREATE); assertJobHeaders(workflowInstanceKey, "foo", event); final Map<String, Object> customHeaders = event.getValue().getCustomHeaders(); assertThat(customHeaders).containsEntry("a", "b").containsEntry("c", "d"); }
assertThat(firstJob.getCustomHeaders()).isEmpty(); testClient.completeJobOfType("type1"); assertThat(secondJob.getCustomHeaders()).isEmpty(); testClient.completeJobOfType("type2"); assertThat(thirdJob.getCustomHeaders()).isEmpty();
assertThat(firstJob.getCustomHeaders()).isEmpty(); testClient.completeJobOfType("type1"); assertThat(secondJob.getCustomHeaders()).isEmpty(); testClient.completeJobOfType("type2"); assertThat(thirdJob.getCustomHeaders()).isEmpty();
@Test public void shouldCreateJobWithWorkflowInstanceAndCustomHeaders() { // given testClient.deploy( Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .serviceTask( "foo", t -> t.zeebeTaskType("bar").zeebeTaskHeader("a", "b").zeebeTaskHeader("c", "d")) .endEvent() .done()); // when final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID); // then final Record<JobRecordValue> event = testClient.receiveFirstJobCommand(JobIntent.CREATE); assertJobHeaders(workflowInstanceKey, "foo", event); final Map<String, Object> customHeaders = event.getValue().getCustomHeaders(); assertThat(customHeaders).containsEntry("a", "b").containsEntry("c", "d"); }