Oliverwqcwrw commented on code in PR #4498:
URL: https://github.com/apache/rocketmq/pull/4498#discussion_r913326243


##########
client/src/test/java/org/apache/rocketmq/client/ValidatorsTest.java:
##########
@@ -106,4 +110,63 @@ public void testIsNotAllowedSendTopic() {
             }
         }
     }
+
+    @Test
+    public void testTopicConfigValid() throws MQClientException {
+        TopicConfig topicConfig = new TopicConfig();
+        topicConfig.setPerm(PermName.PERM_INHERIT | PermName.PERM_WRITE | 
PermName.PERM_READ);
+        Validators.checkTopicConfig(topicConfig);
+
+        topicConfig.setPerm(PermName.PERM_WRITE | PermName.PERM_READ);
+        Validators.checkTopicConfig(topicConfig);
+
+        topicConfig.setPerm(PermName.PERM_READ);
+        Validators.checkTopicConfig(topicConfig);
+
+        try {
+            topicConfig.setPerm(PermName.PERM_PRIORITY);
+            Validators.checkTopicConfig(topicConfig);
+        } catch (MQClientException e) {
+            
assertThat(e.getResponseCode()).isEqualTo(ResponseCode.NO_PERMISSION);
+            
assertThat(e.getErrorMessage()).isEqualTo(String.format("brokerPermission 
value: %s is invalid.", topicConfig.getPerm()));

Review Comment:
   `brokerPermission value` should be `topicPermisson value`, and is more 
accurate



##########
client/src/test/java/org/apache/rocketmq/client/ValidatorsTest.java:
##########
@@ -106,4 +110,63 @@ public void testIsNotAllowedSendTopic() {
             }
         }
     }
+
+    @Test
+    public void testTopicConfigValid() throws MQClientException {
+        TopicConfig topicConfig = new TopicConfig();
+        topicConfig.setPerm(PermName.PERM_INHERIT | PermName.PERM_WRITE | 
PermName.PERM_READ);
+        Validators.checkTopicConfig(topicConfig);
+
+        topicConfig.setPerm(PermName.PERM_WRITE | PermName.PERM_READ);
+        Validators.checkTopicConfig(topicConfig);
+
+        topicConfig.setPerm(PermName.PERM_READ);
+        Validators.checkTopicConfig(topicConfig);
+
+        try {
+            topicConfig.setPerm(PermName.PERM_PRIORITY);
+            Validators.checkTopicConfig(topicConfig);
+        } catch (MQClientException e) {
+            
assertThat(e.getResponseCode()).isEqualTo(ResponseCode.NO_PERMISSION);
+            
assertThat(e.getErrorMessage()).isEqualTo(String.format("brokerPermission 
value: %s is invalid.", topicConfig.getPerm()));
+        }
+
+        try {
+            topicConfig.setPerm(PermName.PERM_PRIORITY | PermName.PERM_WRITE);
+            Validators.checkTopicConfig(topicConfig);
+        } catch (MQClientException e) {
+            
assertThat(e.getResponseCode()).isEqualTo(ResponseCode.NO_PERMISSION);
+            
assertThat(e.getErrorMessage()).isEqualTo(String.format("brokerPermission 
value: %s is invalid.", topicConfig.getPerm()));

Review Comment:
   `brokerPermission value` should be `topicPermisson value`, and is more 
accurate



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to