Class Utils
java.lang.Object
io.kroxylicious.testing.kafka.common.Utils
The type Utils.
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.awaitility.core.ConditionFactoryawaitCondition(int timeout, TimeUnit timeUnit) Factory forAwaitility.await()preconfigured with defaults.static voidawaitExpectedBrokerCountInClusterViaTopic(Map<String, Object> connectionConfig, int timeout, TimeUnit timeUnit, Integer expectedBrokerCount) Await expected broker count in cluster.static voidawaitReassignmentOfKafkaInternalTopicsIfNecessary(Map<String, Object> connectionConfig, int fromNodeId, int toNodeId, int timeout, TimeUnit timeUnit) Reassign all kafka internal topic partitions that exist have a replica onfromNodeIdand don't have at least one replica elsewhere in the cluster.
-
Method Details
-
awaitReassignmentOfKafkaInternalTopicsIfNecessary
public static void awaitReassignmentOfKafkaInternalTopicsIfNecessary(Map<String, Object> connectionConfig, int fromNodeId, int toNodeId, int timeout, TimeUnit timeUnit) Reassign all kafka internal topic partitions that exist have a replica onfromNodeIdand don't have at least one replica elsewhere in the cluster.- Parameters:
connectionConfig- the connection configfromNodeId- nodeId being evacuatedtoNodeId- replacement nodeIdtimeout- the timeouttimeUnit- the time unit
-
awaitExpectedBrokerCountInClusterViaTopic
public static void awaitExpectedBrokerCountInClusterViaTopic(Map<String, Object> connectionConfig, int timeout, TimeUnit timeUnit, Integer expectedBrokerCount) Await expected broker count in cluster. Verifies that all expected brokers are present in the cluster.To Verify that all the expected brokers are in the cluster we create a topic with a replication factor = to the expected number of brokers. We then poll describeTopics until
- Parameters:
connectionConfig- the connection configtimeout- the timeouttimeUnit- the time unitexpectedBrokerCount- the expected broker count
-
awaitCondition
Factory forAwaitility.await()preconfigured with defaults.- Parameters:
timeout- at most timeouttimeUnit- at mostTimeUnit- Returns:
- preconfigured factory
-