You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/06/13 01:37:36 UTC

[GitHub] [kafka] kkonstantine commented on a change in pull request #8866: HOTFIX: fix compile error in o.a.k.c.u.TopicAdminTest

kkonstantine commented on a change in pull request #8866:
URL: https://github.com/apache/kafka/pull/8866#discussion_r439697258



##########
File path: connect/runtime/src/test/java/org/apache/kafka/connect/util/TopicAdminTest.java
##########
@@ -568,18 +570,20 @@ private DescribeConfigsResponse describeConfigsResponseWithTopicAuthorizationExc
 
     private DescribeConfigsResponse describeConfigsResponse(ApiError error, NewTopic... topics) {
         if (error == null) error = new ApiError(Errors.NONE, "");
-        Map<ConfigResource, DescribeConfigsResponse.Config> configs = new HashMap<>();
+        List<DescribeConfigsResponseData.DescribeConfigsResult> results = new ArrayList<>();
         for (NewTopic topic : topics) {
-            ConfigResource resource = new ConfigResource(ConfigResource.Type.TOPIC, topic.name());
-            DescribeConfigsResponse.ConfigSource source = DescribeConfigsResponse.ConfigSource.TOPIC_CONFIG;
-            Collection<DescribeConfigsResponse.ConfigEntry> entries = new ArrayList<>();
-            topic.configs().forEach((k, v) -> new DescribeConfigsResponse.ConfigEntry(
-                    k, v, source, false, false, Collections.emptySet()
-            ));
-            DescribeConfigsResponse.Config config = new DescribeConfigsResponse.Config(error, entries);
-            configs.put(resource, config);
-        }
-        return new DescribeConfigsResponse(1000, configs);
+            results.add(new DescribeConfigsResponseData.DescribeConfigsResult()
+                    .setErrorCode(error.error().code())
+                    .setErrorMessage(error.message())
+                    .setResourceType(ConfigResource.Type.TOPIC.id())
+                    .setResourceName(topic.name())
+                    .setConfigs(topic.configs().entrySet().stream().map(e -> new DescribeConfigsResponseData.DescribeConfigsResourceResult()
+                            .setName(e.getKey())
+                            .setValue(e.getValue())).collect(Collectors.toList())));
+        }
+        return new DescribeConfigsResponse(new DescribeConfigsResponseData()
+        .setThrottleTimeMs(1000)

Review comment:
       nit: indentation is off here. You may break at the second `new` and have the argument in one line probably

##########
File path: connect/runtime/src/test/java/org/apache/kafka/connect/util/TopicAdminTest.java
##########
@@ -568,18 +570,20 @@ private DescribeConfigsResponse describeConfigsResponseWithTopicAuthorizationExc
 
     private DescribeConfigsResponse describeConfigsResponse(ApiError error, NewTopic... topics) {
         if (error == null) error = new ApiError(Errors.NONE, "");
-        Map<ConfigResource, DescribeConfigsResponse.Config> configs = new HashMap<>();
+        List<DescribeConfigsResponseData.DescribeConfigsResult> results = new ArrayList<>();
         for (NewTopic topic : topics) {

Review comment:
       let's stream the topics and use a collector in the end. 




----------------------------------------------------------------
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:
users@infra.apache.org