From 1902fd1a1225fd68f65d1bba7b28716a9ba58fd2 Mon Sep 17 00:00:00 2001 From: zhaoyuhan Date: Thu, 12 Dec 2024 15:56:32 +0800 Subject: [PATCH 1/3] fix repeat code --- .../rocketmq/remoting/protocol/ResponseCode.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/remoting/src/main/java/org/apache/rocketmq/remoting/protocol/ResponseCode.java b/remoting/src/main/java/org/apache/rocketmq/remoting/protocol/ResponseCode.java index b19355487e5..ffa327d1b6b 100644 --- a/remoting/src/main/java/org/apache/rocketmq/remoting/protocol/ResponseCode.java +++ b/remoting/src/main/java/org/apache/rocketmq/remoting/protocol/ResponseCode.java @@ -72,12 +72,6 @@ public class ResponseCode extends RemotingSysResponseCode { public static final int NO_MESSAGE = 208; - public static final int UPDATE_AND_CREATE_ACL_CONFIG_FAILED = 209; - - public static final int DELETE_ACL_CONFIG_FAILED = 210; - - public static final int UPDATE_GLOBAL_WHITE_ADDRS_CONFIG_FAILED = 211; - public static final int POLLING_FULL = 209; public static final int POLLING_TIMEOUT = 210; @@ -134,4 +128,10 @@ public class ResponseCode extends RemotingSysResponseCode { public static final int USER_NOT_EXIST = 3001; public static final int POLICY_NOT_EXIST = 3002; + + public static final int UPDATE_AND_CREATE_ACL_CONFIG_FAILED = 4001; + + public static final int DELETE_ACL_CONFIG_FAILED = 4002; + + public static final int UPDATE_GLOBAL_WHITE_ADDRS_CONFIG_FAILED = 4003; } From bd20b0fb1a4c58af96ce9953b5014c597b654ef6 Mon Sep 17 00:00:00 2001 From: zhaoyuhan Date: Thu, 12 Dec 2024 19:54:33 +0800 Subject: [PATCH 2/3] fix ut --- .../org/apache/rocketmq/client/impl/MQClientAPIImplTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/test/java/org/apache/rocketmq/client/impl/MQClientAPIImplTest.java b/client/src/test/java/org/apache/rocketmq/client/impl/MQClientAPIImplTest.java index c76d0c734a0..e3cc01a58db 100644 --- a/client/src/test/java/org/apache/rocketmq/client/impl/MQClientAPIImplTest.java +++ b/client/src/test/java/org/apache/rocketmq/client/impl/MQClientAPIImplTest.java @@ -389,7 +389,7 @@ public void testCreatePlainAccessConfig_Exception() throws InterruptedException, try { mqClientAPI.createPlainAccessConfig(brokerAddr, config, 3 * 1000); } catch (MQClientException ex) { - assertThat(ex.getResponseCode()).isEqualTo(209); + assertThat(ex.getResponseCode()).isEqualTo(ResponseCode.UPDATE_AND_CREATE_ACL_CONFIG_FAILED); assertThat(ex.getErrorMessage()).isEqualTo("corresponding to accessConfig has been updated failed"); } } @@ -419,7 +419,7 @@ public void testDeleteAccessConfig_Exception() throws InterruptedException, Remo try { mqClientAPI.deleteAccessConfig(brokerAddr, "11111", 3 * 1000); } catch (MQClientException ex) { - assertThat(ex.getResponseCode()).isEqualTo(210); + assertThat(ex.getResponseCode()).isEqualTo(ResponseCode.DELETE_ACL_CONFIG_FAILED); assertThat(ex.getErrorMessage()).isEqualTo("corresponding to accessConfig has been deleted failed"); } } From b75f678bf5e679806325df4fb49807b6b72af458 Mon Sep 17 00:00:00 2001 From: zhaoyuhan Date: Mon, 16 Dec 2024 17:32:13 +0800 Subject: [PATCH 3/3] modify code --- .../rocketmq/remoting/protocol/ResponseCode.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/remoting/src/main/java/org/apache/rocketmq/remoting/protocol/ResponseCode.java b/remoting/src/main/java/org/apache/rocketmq/remoting/protocol/ResponseCode.java index ffa327d1b6b..a77f4d406e0 100644 --- a/remoting/src/main/java/org/apache/rocketmq/remoting/protocol/ResponseCode.java +++ b/remoting/src/main/java/org/apache/rocketmq/remoting/protocol/ResponseCode.java @@ -84,6 +84,12 @@ public class ResponseCode extends RemotingSysResponseCode { public static final int FLOW_CONTROL = 215; + public static final int UPDATE_AND_CREATE_ACL_CONFIG_FAILED = 216; + + public static final int DELETE_ACL_CONFIG_FAILED = 217; + + public static final int UPDATE_GLOBAL_WHITE_ADDRS_CONFIG_FAILED = 218; + public static final int NOT_LEADER_FOR_QUEUE = 501; public static final int ILLEGAL_OPERATION = 604; @@ -129,9 +135,4 @@ public class ResponseCode extends RemotingSysResponseCode { public static final int POLICY_NOT_EXIST = 3002; - public static final int UPDATE_AND_CREATE_ACL_CONFIG_FAILED = 4001; - - public static final int DELETE_ACL_CONFIG_FAILED = 4002; - - public static final int UPDATE_GLOBAL_WHITE_ADDRS_CONFIG_FAILED = 4003; }