use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.Partition.PartitionBrokerRole in project zeebe-test-container by camunda-community-hub.
the class ZeebeTopologyWaitStrategyTest method newTopology.
private static TopologyResponse newTopology(final int brokersCount, final int partitionsCount, final BiFunction<Integer, Integer, PartitionBrokerRole> partitioner) {
final TopologyResponse.Builder topologyBuilder = TopologyResponse.newBuilder();
for (int brokerId = 0; brokerId < brokersCount; brokerId++) {
final BrokerInfo.Builder brokerBuilder = BrokerInfo.newBuilder().setNodeId(brokerId);
for (int partitionId = 0; partitionId < partitionsCount; partitionId++) {
final PartitionBrokerRole role = partitioner.apply(brokerId, partitionId);
if (role != null) {
brokerBuilder.addPartitions(Partition.newBuilder().setPartitionId(partitionId).setRole(role));
}
}
topologyBuilder.addBrokers(brokerBuilder);
}
return topologyBuilder.build();
}
Aggregations