Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.junit.rules.ExternalResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import scala.collection.JavaConverters;

import java.io.IOException;
import java.util.ArrayList;
Expand Down Expand Up @@ -284,8 +283,7 @@ public void deleteTopicsAndWait(final long timeoutMs, final String... topics) th
* @param timeoutMs the max time to wait for the topics to be deleted (does not block if {@code <= 0})
*/
public void deleteAllTopicsAndWait(final long timeoutMs) throws InterruptedException {
final Set<String> topics = JavaConverters.setAsJavaSetConverter(
brokers[0].kafkaServer().zkClient().getAllTopicsInCluster(false)).asJava();
final Set<String> topics = getAllTopicsInCluster();
for (final String topic : topics) {
try {
brokers[0].deleteTopic(topic);
Expand Down Expand Up @@ -314,8 +312,7 @@ private TopicsDeletedCondition(final Collection<String> topics) {

@Override
public boolean conditionMet() {
final Set<String> allTopics = new HashSet<>(JavaConverters.setAsJavaSetConverter(
brokers[0].kafkaServer().zkClient().getAllTopicsInCluster(false)).asJava());
final Set<String> allTopics = getAllTopicsInCluster();
return !allTopics.removeAll(deletedTopics);
}
}
Expand All @@ -329,8 +326,7 @@ private TopicsRemainingCondition(final String... topics) {

@Override
public boolean conditionMet() {
final Set<String> allTopics = JavaConverters.setAsJavaSetConverter(
brokers[0].kafkaServer().zkClient().getAllTopicsInCluster(false)).asJava();
final Set<String> allTopics = getAllTopicsInCluster();
return allTopics.equals(remainingTopics);
}
}
Expand All @@ -348,6 +344,11 @@ public Properties getLogConfig(final String topic) {
}

public Set<String> getAllTopicsInCluster() {
return JavaConverters.setAsJavaSetConverter(brokers[0].kafkaServer().zkClient().getAllTopicsInCluster(false)).asJava();
final scala.collection.Iterator<String> topicsIterator = brokers[0].kafkaServer().zkClient().getAllTopicsInCluster(false).iterator();
final Set<String> topics = new HashSet<>();
while (topicsIterator.hasNext()) {
topics.add(topicsIterator.next());
}
return topics;
}
}