use of io.camunda.zeebe.client.api.response.PartitionInfo in project zeebe-test-container by camunda-community-hub.
the class ZeebeTopologyWaitStrategy method buildPartitionsMap.
private Map<Integer, Partition> buildPartitionsMap(final Topology topology) {
final Map<Integer, Partition> partitions = new HashMap<>();
for (final BrokerInfo broker : topology.getBrokers()) {
final int nodeId = broker.getNodeId();
for (final PartitionInfo partitionInfo : broker.getPartitions()) {
final int partitionId = partitionInfo.getPartitionId();
partitions.putIfAbsent(partitionId, new Partition());
final Partition partition = partitions.get(partitionId);
if (partitionInfo.isLeader()) {
partition.leaderIds.add(nodeId);
} else {
partition.followerIds.add(nodeId);
}
}
}
return partitions;
}
use of io.camunda.zeebe.client.api.response.PartitionInfo in project zeebe by zeebe-io.
the class TopologyClusterSmallerReplicationTest method shouldHaveCorrectReplicationFactorForPartitions.
@Test
public void shouldHaveCorrectReplicationFactorForPartitions() {
// when
final Topology topology = CLIENT_RULE.getClient().newTopologyRequest().send().join();
// then
final List<BrokerInfo> brokers = topology.getBrokers();
assertThat(brokers).flatExtracting(BrokerInfo::getPartitions).filteredOn(PartitionInfo::isLeader).extracting(PartitionInfo::getPartitionId).containsExactlyInAnyOrder(START_PARTITION_ID, START_PARTITION_ID + 1, START_PARTITION_ID + 2);
assertPartitionInTopology(brokers, START_PARTITION_ID);
assertPartitionInTopology(brokers, START_PARTITION_ID + 1);
assertPartitionInTopology(brokers, START_PARTITION_ID + 2);
}
use of io.camunda.zeebe.client.api.response.PartitionInfo in project zeebe by zeebe-io.
the class TopologyClusterTest method shouldContainAllPartitions.
@Test
public void shouldContainAllPartitions() {
// when
final Topology topology = CLIENT_RULE.getClient().newTopologyRequest().send().join();
// then
final List<BrokerInfo> brokers = topology.getBrokers();
assertThat(brokers).flatExtracting(BrokerInfo::getPartitions).filteredOn(PartitionInfo::isLeader).extracting(PartitionInfo::getPartitionId).containsExactlyInAnyOrder(START_PARTITION_ID, START_PARTITION_ID + 1, START_PARTITION_ID + 2);
assertPartitionInTopology(brokers, START_PARTITION_ID);
assertPartitionInTopology(brokers, START_PARTITION_ID + 1);
assertPartitionInTopology(brokers, START_PARTITION_ID + 2);
}
use of io.camunda.zeebe.client.api.response.PartitionInfo in project zeebe by zeebe-io.
the class TopologyClusterWithoutReplicationTest method shouldHaveCorrectReplicationFactorForPartitions.
@Test
public void shouldHaveCorrectReplicationFactorForPartitions() {
// when
final Topology topology = CLIENT_RULE.getClient().newTopologyRequest().send().join();
// then
final List<BrokerInfo> brokers = topology.getBrokers();
assertThat(brokers).flatExtracting(BrokerInfo::getPartitions).filteredOn(PartitionInfo::isLeader).extracting(PartitionInfo::getPartitionId).containsExactlyInAnyOrder(START_PARTITION_ID, START_PARTITION_ID + 1, START_PARTITION_ID + 2);
assertPartitionInTopology(brokers, START_PARTITION_ID);
assertPartitionInTopology(brokers, START_PARTITION_ID + 1);
assertPartitionInTopology(brokers, START_PARTITION_ID + 2);
}
use of io.camunda.zeebe.client.api.response.PartitionInfo in project zeebe by camunda-cloud.
the class TopologyClusterSmallerReplicationTest method shouldHaveCorrectReplicationFactorForPartitions.
@Test
public void shouldHaveCorrectReplicationFactorForPartitions() {
// when
final Topology topology = CLIENT_RULE.getClient().newTopologyRequest().send().join();
// then
final List<BrokerInfo> brokers = topology.getBrokers();
assertThat(brokers).flatExtracting(BrokerInfo::getPartitions).filteredOn(PartitionInfo::isLeader).extracting(PartitionInfo::getPartitionId).containsExactlyInAnyOrder(START_PARTITION_ID, START_PARTITION_ID + 1, START_PARTITION_ID + 2);
assertPartitionInTopology(brokers, START_PARTITION_ID);
assertPartitionInTopology(brokers, START_PARTITION_ID + 1);
assertPartitionInTopology(brokers, START_PARTITION_ID + 2);
}
Aggregations