|
29 | 29 | import org.apache.kafka.common.config.TopicConfig;
|
30 | 30 | import org.apache.kafka.common.serialization.ByteArraySerializer;
|
31 | 31 | import org.apache.kafka.common.serialization.StringDeserializer;
|
| 32 | +import org.apache.kafka.common.test.TestUtils; |
32 | 33 | import org.apache.kafka.common.utils.Exit;
|
33 | 34 | import org.apache.kafka.server.util.CommandLineUtils;
|
34 |
| -import org.apache.kafka.test.TestUtils; |
35 | 35 |
|
36 | 36 | import java.io.BufferedReader;
|
37 | 37 | import java.io.BufferedWriter;
|
|
57 | 57 | import joptsimple.OptionParser;
|
58 | 58 | import joptsimple.OptionSet;
|
59 | 59 |
|
60 |
| -import static org.apache.kafka.tools.TestRecordUtils.valuesIterator; |
61 | 60 |
|
62 | 61 | /**
|
63 | 62 | * This is a torture test that runs against an existing broker
|
@@ -146,23 +145,27 @@ private static void createTopics(String brokerUrl, String[] topics) throws Excep
|
146 | 145 |
|
147 | 146 | final List<String> pendingTopics = new ArrayList<>();
|
148 | 147 | TestUtils.waitForCondition(() -> {
|
149 |
| - Set<String> allTopics = adminClient.listTopics().names().get(); |
150 |
| - pendingTopics.clear(); |
151 |
| - pendingTopics.addAll( |
152 |
| - Arrays.stream(topics) |
153 |
| - .filter(topicName -> !allTopics.contains(topicName)) |
154 |
| - .toList() |
155 |
| - ); |
156 |
| - return pendingTopics.isEmpty(); |
| 148 | + try { |
| 149 | + Set<String> allTopics = adminClient.listTopics().names().get(); |
| 150 | + pendingTopics.clear(); |
| 151 | + pendingTopics.addAll( |
| 152 | + Arrays.stream(topics) |
| 153 | + .filter(topicName -> !allTopics.contains(topicName)) |
| 154 | + .toList() |
| 155 | + ); |
| 156 | + return pendingTopics.isEmpty(); |
| 157 | + } catch (InterruptedException | java.util.concurrent.ExecutionException e) { |
| 158 | + throw new RuntimeException(e); |
| 159 | + } |
157 | 160 | }, "timed out waiting for topics: " + pendingTopics);
|
158 | 161 | }
|
159 | 162 | }
|
160 | 163 |
|
161 | 164 | private static void validateOutput(File producedDataFile, File consumedDataFile) {
|
162 | 165 | try (BufferedReader producedReader = externalSort(producedDataFile);
|
163 | 166 | BufferedReader consumedReader = externalSort(consumedDataFile)) {
|
164 |
| - Iterator<TestRecord> produced = valuesIterator(producedReader); |
165 |
| - Iterator<TestRecord> consumed = valuesIterator(consumedReader); |
| 167 | + Iterator<TestRecord> produced = TestRecordUtils.valuesIterator(producedReader); |
| 168 | + Iterator<TestRecord> consumed = TestRecordUtils.valuesIterator(consumedReader); |
166 | 169 |
|
167 | 170 | File producedDedupedFile = new File(producedDataFile.getAbsolutePath() + ".deduped");
|
168 | 171 | File consumedDedupedFile = new File(consumedDataFile.getAbsolutePath() + ".deduped");
|
|
0 commit comments