|
21 | 21 | import org.apache.kafka.clients.admin.ConfigEntry; |
22 | 22 | import org.apache.kafka.clients.admin.DescribeConfigsResult; |
23 | 23 | import org.apache.kafka.clients.admin.DescribeTopicsResult; |
24 | | -import org.apache.kafka.clients.admin.NewTopic; |
25 | 24 | import org.apache.kafka.clients.admin.TopicDescription; |
26 | 25 | import org.apache.kafka.common.KafkaFuture; |
27 | 26 | import org.apache.kafka.common.TopicIdPartition; |
@@ -94,10 +93,9 @@ public void teardown() throws IOException { |
94 | 93 |
|
95 | 94 | @ClusterTest |
96 | 95 | public void testDoesTopicExist() throws ExecutionException, InterruptedException { |
| 96 | + String topic = "test-topic-exist"; |
| 97 | + clusterInstance.createTopic(topic, 1, (short) 1); |
97 | 98 | try (Admin admin = clusterInstance.admin()) { |
98 | | - String topic = "test-topic-exist"; |
99 | | - admin.createTopics(List.of(new NewTopic(topic, 1, (short) 1))).all().get(); |
100 | | - clusterInstance.waitTopicCreation(topic, 1); |
101 | 99 | boolean doesTopicExist = topicBasedRlmm().doesTopicExist(admin, topic); |
102 | 100 | assertTrue(doesTopicExist); |
103 | 101 | } |
@@ -144,13 +142,9 @@ public void testNewPartitionUpdates() throws Exception { |
144 | 142 | // Create topics. |
145 | 143 | String leaderTopic = "new-leader"; |
146 | 144 | String followerTopic = "new-follower"; |
147 | | - try (Admin admin = clusterInstance.admin()) { |
148 | | - // Set broker id 0 as the first entry which is taken as the leader. |
149 | | - admin.createTopics(List.of(new NewTopic(leaderTopic, Map.of(0, List.of(0, 1, 2))))).all().get(); |
150 | | - clusterInstance.waitTopicCreation(leaderTopic, 1); |
151 | | - admin.createTopics(List.of(new NewTopic(followerTopic, Map.of(0, List.of(1, 2, 0))))).all().get(); |
152 | | - clusterInstance.waitTopicCreation(followerTopic, 1); |
153 | | - } |
| 145 | + // Set broker id 0 as the first entry which is taken as the leader. |
| 146 | + clusterInstance.createTopicWithAssignment(leaderTopic, Map.of(0, List.of(0, 1, 2))); |
| 147 | + clusterInstance.createTopicWithAssignment(followerTopic, Map.of(0, List.of(1, 2, 0))); |
154 | 148 |
|
155 | 149 | final TopicIdPartition newLeaderTopicIdPartition = new TopicIdPartition(Uuid.randomUuid(), new TopicPartition(leaderTopic, 0)); |
156 | 150 | final TopicIdPartition newFollowerTopicIdPartition = new TopicIdPartition(Uuid.randomUuid(), new TopicPartition(followerTopic, 0)); |
|
0 commit comments