use of io.zeebe.test.broker.protocol.clientapi.ExecuteCommandResponse in project zeebe by zeebe-io.
the class CreateDeploymentTest method shouldRejectDeploymentIfConditionIsInvalid.
@Test
public void shouldRejectDeploymentIfConditionIsInvalid() {
final WorkflowDefinition definition = Bpmn.createExecutableWorkflow("workflow").startEvent().exclusiveGateway().sequenceFlow(s -> s.condition("foobar")).endEvent().sequenceFlow(s -> s.defaultFlow()).endEvent().done();
// when
final ExecuteCommandResponse resp = apiRule.topic().deployWithResponse(ClientApiRule.DEFAULT_TOPIC_NAME, definition);
// then
assertThat(resp.key()).isGreaterThanOrEqualTo(0L);
assertThat(resp.getEvent()).containsEntry(PROP_STATE, "REJECTED");
assertThat((String) resp.getEvent().get("errorMessage")).contains("The condition 'foobar' is not valid");
}
use of io.zeebe.test.broker.protocol.clientapi.ExecuteCommandResponse in project zeebe by zeebe-io.
the class CreateDeploymentTest method shouldRejectDeploymentIfNoResources.
@Test
public void shouldRejectDeploymentIfNoResources() {
// when
final ExecuteCommandResponse resp = apiRule.createCmdRequest().partitionId(Protocol.SYSTEM_PARTITION).eventType(EventType.DEPLOYMENT_EVENT).command().put(PROP_STATE, "CREATE").put("topicName", ClientApiRule.DEFAULT_TOPIC_NAME).put("resources", Collections.emptyList()).done().sendAndAwait();
// then
assertThat(resp.key()).isGreaterThanOrEqualTo(0L);
assertThat(resp.getEvent()).containsEntry(PROP_STATE, "REJECTED");
assertThat((String) resp.getEvent().get("errorMessage")).isEqualTo("Deployment doesn't contain a resource to deploy.");
}
use of io.zeebe.test.broker.protocol.clientapi.ExecuteCommandResponse in project zeebe by zeebe-io.
the class CreateTopicTest method shouldCreateTopic.
@Test
public void shouldCreateTopic() {
// given
final String topicName = "newTopic";
// when
final ExecuteCommandResponse response = apiRule.createTopic(topicName, 2);
// then
assertThat(response.getEvent()).containsExactly(entry("state", "CREATED"), entry("name", topicName), entry("partitions", 2));
}
use of io.zeebe.test.broker.protocol.clientapi.ExecuteCommandResponse in project zeebe by zeebe-io.
the class CreateTopicTest method shouldNotCreateSystemTopic.
@Test
public void shouldNotCreateSystemTopic() {
// when
final ExecuteCommandResponse response = apiRule.createTopic(Protocol.SYSTEM_TOPIC, 2);
// then
assertThat(response.getEvent()).containsExactly(entry("state", "CREATE_REJECTED"), entry("name", Protocol.SYSTEM_TOPIC), entry("partitions", 2));
}
use of io.zeebe.test.broker.protocol.clientapi.ExecuteCommandResponse in project zeebe by zeebe-io.
the class CreateTopicTest method shouldNotCreateExistingTopic.
@Test
public void shouldNotCreateExistingTopic() throws InterruptedException {
// given
final String topicName = "newTopic";
apiRule.createTopic(topicName, 2);
// when
final ExecuteCommandResponse response = apiRule.createTopic(topicName, 2);
// then
assertThat(response.getEvent()).containsExactly(entry("state", "CREATE_REJECTED"), entry("name", topicName), entry("partitions", 2));
}
Aggregations