kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [kafka] branch trunk updated: KAFKA-8614; Consistent naming for IncrementalAlterConfig and AlterConfig responses (#7022)
Date Sat, 13 Jul 2019 00:18:58 GMT
This is an automated email from the ASF dual-hosted git repository.

jgus pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new ea814d7  KAFKA-8614; Consistent naming for IncrementalAlterConfig and AlterConfig
responses (#7022)
ea814d7 is described below

commit ea814d78690940827e90950282f40a74ca45eb0f
Author: Bob Barrett <bob.barrett@confluent.io>
AuthorDate: Fri Jul 12 17:18:41 2019 -0700

    KAFKA-8614; Consistent naming for IncrementalAlterConfig and AlterConfig responses (#7022)
    
    This patch changes the name of the `Resources` field of AlterConfigsResponse to `Responses`.
This makes it consistent with AlterConfigsResponse, which has a differently-named but structurally-identical
field. Tested with unit tests.
    
    Reviewers: Jason Gustafson <jason@confluent.io>
---
 .../common/requests/IncrementalAlterConfigsRequest.java    |  4 ++--
 .../common/requests/IncrementalAlterConfigsResponse.java   | 14 +++++++-------
 .../resources/common/message/AlterConfigsResponse.json     |  2 +-
 .../common/message/IncrementalAlterConfigsResponse.json    |  2 +-
 .../apache/kafka/clients/admin/KafkaAdminClientTest.java   |  8 ++++----
 .../apache/kafka/common/requests/RequestResponseTest.java  |  4 ++--
 6 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/clients/src/main/java/org/apache/kafka/common/requests/IncrementalAlterConfigsRequest.java
b/clients/src/main/java/org/apache/kafka/common/requests/IncrementalAlterConfigsRequest.java
index 3a87cdb..0c6c0b2 100644
--- a/clients/src/main/java/org/apache/kafka/common/requests/IncrementalAlterConfigsRequest.java
+++ b/clients/src/main/java/org/apache/kafka/common/requests/IncrementalAlterConfigsRequest.java
@@ -20,7 +20,7 @@ package org.apache.kafka.common.requests;
 import org.apache.kafka.common.message.IncrementalAlterConfigsRequestData;
 import org.apache.kafka.common.message.IncrementalAlterConfigsRequestData.AlterConfigsResource;
 import org.apache.kafka.common.message.IncrementalAlterConfigsResponseData;
-import org.apache.kafka.common.message.IncrementalAlterConfigsResponseData.AlterConfigsResourceResult;
+import org.apache.kafka.common.message.IncrementalAlterConfigsResponseData.AlterConfigsResourceResponse;
 import org.apache.kafka.common.protocol.ApiKeys;
 import org.apache.kafka.common.protocol.types.Struct;
 
@@ -80,7 +80,7 @@ public class IncrementalAlterConfigsRequest extends AbstractRequest {
         IncrementalAlterConfigsResponseData response = new IncrementalAlterConfigsResponseData();
         ApiError apiError = ApiError.fromThrowable(e);
         for (AlterConfigsResource resource : data.resources()) {
-            response.responses().add(new AlterConfigsResourceResult()
+            response.responses().add(new AlterConfigsResourceResponse()
                     .setResourceName(resource.resourceName())
                     .setResourceType(resource.resourceType())
                     .setErrorCode(apiError.error().code())
diff --git a/clients/src/main/java/org/apache/kafka/common/requests/IncrementalAlterConfigsResponse.java
b/clients/src/main/java/org/apache/kafka/common/requests/IncrementalAlterConfigsResponse.java
index 1e5aea1..46b1d53 100644
--- a/clients/src/main/java/org/apache/kafka/common/requests/IncrementalAlterConfigsResponse.java
+++ b/clients/src/main/java/org/apache/kafka/common/requests/IncrementalAlterConfigsResponse.java
@@ -19,7 +19,7 @@ package org.apache.kafka.common.requests;
 
 import org.apache.kafka.common.config.ConfigResource;
 import org.apache.kafka.common.message.IncrementalAlterConfigsResponseData;
-import org.apache.kafka.common.message.IncrementalAlterConfigsResponseData.AlterConfigsResourceResult;
+import org.apache.kafka.common.message.IncrementalAlterConfigsResponseData.AlterConfigsResourceResponse;
 import org.apache.kafka.common.protocol.ApiKeys;
 import org.apache.kafka.common.protocol.Errors;
 import org.apache.kafka.common.protocol.types.Struct;
@@ -35,7 +35,7 @@ public class IncrementalAlterConfigsResponse extends AbstractResponse {
         IncrementalAlterConfigsResponseData responseData = new IncrementalAlterConfigsResponseData();
         responseData.setThrottleTimeMs(requestThrottleMs);
         for (Map.Entry<ConfigResource, ApiError> entry : results.entrySet()) {
-            responseData.responses().add(new AlterConfigsResourceResult().
+            responseData.responses().add(new AlterConfigsResourceResponse().
                     setResourceName(entry.getKey().name()).
                     setResourceType(entry.getKey().type().id()).
                     setErrorCode(entry.getValue().error().code()).
@@ -46,9 +46,9 @@ public class IncrementalAlterConfigsResponse extends AbstractResponse {
 
     public static Map<ConfigResource, ApiError> fromResponseData(final IncrementalAlterConfigsResponseData
data) {
         Map<ConfigResource, ApiError> map = new HashMap<>();
-        for (AlterConfigsResourceResult result : data.responses()) {
-            map.put(new ConfigResource(ConfigResource.Type.forId(result.resourceType()),
result.resourceName()),
-                    new ApiError(Errors.forCode(result.errorCode()), result.errorMessage()));
+        for (AlterConfigsResourceResponse response : data.responses()) {
+            map.put(new ConfigResource(ConfigResource.Type.forId(response.resourceType()),
response.resourceName()),
+                    new ApiError(Errors.forCode(response.errorCode()), response.errorMessage()));
         }
         return map;
     }
@@ -70,8 +70,8 @@ public class IncrementalAlterConfigsResponse extends AbstractResponse {
     @Override
     public Map<Errors, Integer> errorCounts() {
         HashMap<Errors, Integer> counts = new HashMap<>();
-        for (AlterConfigsResourceResult result : data.responses()) {
-            Errors error = Errors.forCode(result.errorCode());
+        for (AlterConfigsResourceResponse response : data.responses()) {
+            Errors error = Errors.forCode(response.errorCode());
             counts.put(error, counts.getOrDefault(error, 0) + 1);
         }
         return counts;
diff --git a/clients/src/main/resources/common/message/AlterConfigsResponse.json b/clients/src/main/resources/common/message/AlterConfigsResponse.json
index 135a467..5c559cf 100644
--- a/clients/src/main/resources/common/message/AlterConfigsResponse.json
+++ b/clients/src/main/resources/common/message/AlterConfigsResponse.json
@@ -22,7 +22,7 @@
   "fields": [
     { "name": "ThrottleTimeMs", "type": "int32", "versions": "0+",
       "about": "Duration in milliseconds for which the request was throttled due to a quota
violation, or zero if the request did not violate any quota." },
-    { "name": "Resources", "type": "[]AlterConfigsResourceResponse", "versions": "0+",
+    { "name": "Responses", "type": "[]AlterConfigsResourceResponse", "versions": "0+",
       "about": "The responses for each resource.", "fields": [
       { "name": "ErrorCode", "type": "int16", "versions": "0+",
         "about": "The resource error code." },
diff --git a/clients/src/main/resources/common/message/IncrementalAlterConfigsResponse.json
b/clients/src/main/resources/common/message/IncrementalAlterConfigsResponse.json
index 71aa997..beede24 100644
--- a/clients/src/main/resources/common/message/IncrementalAlterConfigsResponse.json
+++ b/clients/src/main/resources/common/message/IncrementalAlterConfigsResponse.json
@@ -21,7 +21,7 @@
   "fields": [
     { "name": "ThrottleTimeMs", "type": "int32", "versions": "0+",
       "about": "Duration in milliseconds for which the request was throttled due to a quota
violation, or zero if the request did not violate any quota." },
-    { "name": "responses", "type": "[]AlterConfigsResourceResult", "versions": "0+",
+    { "name": "Responses", "type": "[]AlterConfigsResourceResponse", "versions": "0+",
       "about": "The responses for each resource.", "fields": [
       { "name": "ErrorCode", "type": "int16", "versions": "0+",
         "about": "The resource error code." },
diff --git a/clients/src/test/java/org/apache/kafka/clients/admin/KafkaAdminClientTest.java
b/clients/src/test/java/org/apache/kafka/clients/admin/KafkaAdminClientTest.java
index 10722e3..2b7070e 100644
--- a/clients/src/test/java/org/apache/kafka/clients/admin/KafkaAdminClientTest.java
+++ b/clients/src/test/java/org/apache/kafka/clients/admin/KafkaAdminClientTest.java
@@ -60,7 +60,7 @@ import org.apache.kafka.common.message.DescribeGroupsResponseData;
 import org.apache.kafka.common.message.DescribeGroupsResponseData.DescribedGroupMember;
 import org.apache.kafka.common.message.ElectLeadersResponseData.PartitionResult;
 import org.apache.kafka.common.message.ElectLeadersResponseData.ReplicaElectionResult;
-import org.apache.kafka.common.message.IncrementalAlterConfigsResponseData.AlterConfigsResourceResult;
+import org.apache.kafka.common.message.IncrementalAlterConfigsResponseData.AlterConfigsResourceResponse;
 import org.apache.kafka.common.message.IncrementalAlterConfigsResponseData;
 import org.apache.kafka.common.message.ListGroupsResponseData;
 import org.apache.kafka.common.protocol.Errors;
@@ -1490,13 +1490,13 @@ public class KafkaAdminClientTest {
 
             //test error scenarios
             IncrementalAlterConfigsResponseData responseData =  new IncrementalAlterConfigsResponseData();
-            responseData.responses().add(new AlterConfigsResourceResult()
+            responseData.responses().add(new AlterConfigsResourceResponse()
                     .setResourceName("")
                     .setResourceType(ConfigResource.Type.BROKER.id())
                     .setErrorCode(Errors.CLUSTER_AUTHORIZATION_FAILED.code())
                     .setErrorMessage("authorization error"));
 
-            responseData.responses().add(new AlterConfigsResourceResult()
+            responseData.responses().add(new AlterConfigsResourceResponse()
                     .setResourceName("topic1")
                     .setResourceType(ConfigResource.Type.TOPIC.id())
                     .setErrorCode(Errors.INVALID_REQUEST.code())
@@ -1525,7 +1525,7 @@ public class KafkaAdminClientTest {
 
             // Test a call where there are no errors.
             responseData =  new IncrementalAlterConfigsResponseData();
-            responseData.responses().add(new AlterConfigsResourceResult()
+            responseData.responses().add(new AlterConfigsResourceResponse()
                     .setResourceName("")
                     .setResourceType(ConfigResource.Type.BROKER.id())
                     .setErrorCode(Errors.NONE.code())
diff --git a/clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java
b/clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java
index f8d45ab..75d9720 100644
--- a/clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java
+++ b/clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java
@@ -59,7 +59,7 @@ import org.apache.kafka.common.message.HeartbeatResponseData;
 import org.apache.kafka.common.message.IncrementalAlterConfigsRequestData.AlterConfigsResource;
 import org.apache.kafka.common.message.IncrementalAlterConfigsRequestData.AlterableConfig;
 import org.apache.kafka.common.message.IncrementalAlterConfigsRequestData;
-import org.apache.kafka.common.message.IncrementalAlterConfigsResponseData.AlterConfigsResourceResult;
+import org.apache.kafka.common.message.IncrementalAlterConfigsResponseData.AlterConfigsResourceResponse;
 import org.apache.kafka.common.message.IncrementalAlterConfigsResponseData;
 import org.apache.kafka.common.message.InitProducerIdRequestData;
 import org.apache.kafka.common.message.InitProducerIdResponseData;
@@ -1604,7 +1604,7 @@ public class RequestResponseTest {
     private IncrementalAlterConfigsResponse createIncrementalAlterConfigsResponse() {
         IncrementalAlterConfigsResponseData data = new IncrementalAlterConfigsResponseData();
 
-        data.responses().add(new AlterConfigsResourceResult()
+        data.responses().add(new AlterConfigsResourceResponse()
                 .setResourceName("testtopic")
                 .setResourceType(ResourceType.TOPIC.code())
                 .setErrorCode(Errors.INVALID_REQUEST.code())


Mime
View raw message