cameronlee314 commented on a change in pull request #951: SAMZA-2127: Upgrade 
to Kafka 2.0
URL: https://github.com/apache/samza/pull/951#discussion_r267882631
 
 

 ##########
 File path: 
samza-test/src/test/java/org/apache/samza/test/processor/TestZkLocalApplicationRunner.java
 ##########
 @@ -159,42 +152,25 @@ public void setUp() {
     zkUtils = new ZkUtils(zkKeyBuilder, zkClient, ZK_CONNECTION_TIMEOUT_MS, 
ZK_SESSION_TIMEOUT_MS, new NoOpMetricsRegistry());
     zkUtils.connect();
 
-    for (String kafkaTopic : ImmutableList.of(inputKafkaTopic, 
outputKafkaTopic)) {
-      LOGGER.info("Creating kafka topic: {}.", kafkaTopic);
-      TestUtils.createTopic(kafkaZkClient(), kafkaTopic, 5, 1, servers(), new 
Properties());
-      if (AdminUtils.topicExists(zkUtils(), kafkaTopic)) {
-        LOGGER.info("Topic: {} was created", kafkaTopic);
-      } else {
-        Assert.fail(String.format("Unable to create kafka topic: %s.", 
kafkaTopic));
-      }
-    }
-    for (String kafkaTopic : ImmutableList.of(inputSinglePartitionKafkaTopic, 
outputSinglePartitionKafkaTopic)) {
-      LOGGER.info("Creating kafka topic: {}.", kafkaTopic);
-      TestUtils.createTopic(kafkaZkClient(), kafkaTopic, 1, 1, servers(), new 
Properties());
-      if (AdminUtils.topicExists(zkUtils(), kafkaTopic)) {
-        LOGGER.info("Topic: {} was created", kafkaTopic);
-      } else {
-        Assert.fail(String.format("Unable to create kafka topic: %s.", 
kafkaTopic));
-      }
-    }
+    List<NewTopic> newTopics =
+        ImmutableList.of(inputKafkaTopic, outputKafkaTopic, 
inputSinglePartitionKafkaTopic, outputSinglePartitionKafkaTopic)
+            .stream()
+            .map(topic -> new NewTopic(topic, 5, (short) 1))
+            .collect(Collectors.toList());
+
+    createTopics(newTopics);
 
 Review comment:
   Should this fail if `createTopics` returns false?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to