use of io.zeebe.test.broker.protocol.brokerapi.ExecuteCommandRequest in project zeebe by zeebe-io.
the class CompleteTaskTest method shouldSetPayloadAsStream.
@Test
public void shouldSetPayloadAsStream() {
// given
final TaskEventImpl baseEvent = Events.exampleTask();
brokerRule.onExecuteCommandRequest(EventType.TASK_EVENT, "COMPLETE").respondWith().key(123).event().allOf((r) -> r.getCommand()).put("state", "COMPLETED").done().register();
final String updatedPayload = "{\"fruit\":\"cherry\"}";
final ByteArrayInputStream inStream = new ByteArrayInputStream(updatedPayload.getBytes(StandardCharsets.UTF_8));
// when
clientRule.tasks().complete(baseEvent).payload(inStream).execute();
// then
final ExecuteCommandRequest request = brokerRule.getReceivedCommandRequests().get(0);
assertThat(request.getCommand()).contains(entry("payload", converter.convertToMsgPack(updatedPayload)));
}
Aggregations