use of io.zeebe.test.broker.protocol.clientapi.ExecuteCommandResponse in project zeebe by zeebe-io.
the class CreateTopicTest method shouldCreateTopicAfterRejection.
@Test
public void shouldCreateTopicAfterRejection() {
// given a rejected creation request
final String topicName = "newTopic";
apiRule.createTopic(topicName, 0);
// when I send a valid creation request for the same topic
final ExecuteCommandResponse response = apiRule.createTopic(topicName, 1);
// then this is successful
assertThat(response.getEvent()).containsExactly(entry("state", "CREATED"), entry("name", topicName), entry("partitions", 1));
}
use of io.zeebe.test.broker.protocol.clientapi.ExecuteCommandResponse in project zeebe by zeebe-io.
the class IncidentTest method cancelWorkflowInstance.
private void cancelWorkflowInstance(final long workflowInstanceKey) {
final ExecuteCommandResponse response = apiRule.createCmdRequest().key(workflowInstanceKey).eventTypeWorkflow().command().put("state", "CANCEL_WORKFLOW_INSTANCE").done().sendAndAwait();
assertThat(response.getEvent()).containsEntry("state", "WORKFLOW_INSTANCE_CANCELED");
}
use of io.zeebe.test.broker.protocol.clientapi.ExecuteCommandResponse in project zeebe by zeebe-io.
the class IncidentTest method updateTaskRetries.
private void updateTaskRetries() {
final SubscribedEvent taskEvent = testClient.receiveSingleEvent(taskEvents("FAILED"));
final ExecuteCommandResponse response = apiRule.createCmdRequest().key(taskEvent.key()).eventTypeTask().command().put("state", "UPDATE_RETRIES").put("retries", 1).put("type", "test").put("lockOwner", taskEvent.event().get("lockOwner")).put("headers", taskEvent.event().get("headers")).done().sendAndAwait();
assertThat(response.getEvent()).containsEntry("state", "RETRIES_UPDATED");
}
use of io.zeebe.test.broker.protocol.clientapi.ExecuteCommandResponse in project zeebe by zeebe-io.
the class IncidentTest method updatePayload.
private void updatePayload(final long workflowInstanceKey, final long activityInstanceKey, byte[] payload) {
final ExecuteCommandResponse response = apiRule.createCmdRequest().eventType(EventType.WORKFLOW_INSTANCE_EVENT).key(activityInstanceKey).command().put("state", WorkflowInstanceState.UPDATE_PAYLOAD).put("workflowInstanceKey", workflowInstanceKey).put("payload", payload).done().sendAndAwait();
assertThat(response.getEvent()).containsEntry("state", WorkflowInstanceState.PAYLOAD_UPDATED.name());
}
use of io.zeebe.test.broker.protocol.clientapi.ExecuteCommandResponse in project zeebe by zeebe-io.
the class IncidentTest method failTaskWithNoRetriesLeft.
private void failTaskWithNoRetriesLeft() {
apiRule.openTaskSubscription("test").await();
final SubscribedEvent taskEvent = testClient.receiveSingleEvent(taskEvents("LOCKED"));
final ExecuteCommandResponse response = apiRule.createCmdRequest().key(taskEvent.key()).eventTypeTask().command().put("state", "FAIL").put("retries", 0).put("type", "failingTask").put("lockOwner", taskEvent.event().get("lockOwner")).put("headers", taskEvent.event().get("headers")).done().sendAndAwait();
assertThat(response.getEvent()).containsEntry("state", "FAILED");
}
Aggregations