use of io.zeebe.client.ZeebeClient in project zeebe by zeebe-io.
the class BrokerRecoveryTest method shouldCreateUniquePartitionIdsAfterRestart.
@Test
public void shouldCreateUniquePartitionIdsAfterRestart() {
// given
final ZeebeClient client = clientRule.getClient();
client.topics().create("foo", 2).execute();
restartBroker();
// when
client.topics().create("bar", 2).execute();
// then
final TopologyResponse topology = client.requestTopology().execute();
final List<TopologyBroker> brokers = topology.getBrokers();
assertThat(brokers).hasSize(1);
final TopologyBroker topologyBroker = brokers.get(0);
final List<BrokerPartitionState> partitions = topologyBroker.getPartitions();
// default partition + system partition + 4 partitions we create here
assertThat(partitions).hasSize(6);
assertThat(partitions).extracting("partitionId").doesNotHaveDuplicates();
}
use of io.zeebe.client.ZeebeClient in project zeebe by zeebe-io.
the class TaskQueueTest method shouldFailCreateTaskIfTopicNameIsNotValid.
@Test
public void shouldFailCreateTaskIfTopicNameIsNotValid() {
final ZeebeClient client = clientRule.getClient();
thrown.expect(RuntimeException.class);
thrown.expectMessage("Cannot determine target partition for request. " + "Request was: [ topic = unknown-topic, partition = any, event type = TASK, state = CREATE ]");
client.tasks().create("unknown-topic", "foo").addCustomHeader("k1", "a").addCustomHeader("k2", "b").payload("{ \"payload\" : 123 }").execute();
}
Aggregations