You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/10/15 12:09:06 UTC

[GitHub] [rocketmq] mxsm opened a new pull request, #5325: [ISSUE #5324]Replace deprecated class PosixParser with DefaultParser for CLI

mxsm opened a new pull request, #5325:
URL: https://github.com/apache/rocketmq/pull/5325

   **Make sure set the target branch to `develop`**
   
   ## What is the purpose of the change
   
   close #5324 
   
   ## Brief changelog
   
   - Replace deprecated class PosixParser with DefaultParser for CLI
   
   ## Verifying this change
   
   XXXX
   
   Follow this checklist to help us incorporate your contribution quickly and easily. Notice, `it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR`.
   
   - [x] Make sure there is a [Github issue](https://github.com/apache/rocketmq/issues) filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue. 
   - [x] Format the pull request title like `[ISSUE #123] Fix UnknownException when host config not exist`. Each commit in the pull request should have a meaningful subject line and body.
   - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [x] Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in [test module](https://github.com/apache/rocketmq/tree/master/test).
   - [x] Run `mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyle` to make sure basic checks pass. Run `mvn clean install -DskipITs` to make sure unit-test pass. Run `mvn clean test-compile failsafe:integration-test`  to make sure integration-test pass.
   - [ ] If this contribution is large, please file an [Apache Individual Contributor License Agreement](http://www.apache.org/licenses/#clas).
   


-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] lizhanhui commented on a diff in pull request #5325: [ISSUE #5324]Replace deprecated class PosixParser with DefaultParser for CLI

Posted by GitBox <gi...@apache.org>.
lizhanhui commented on code in PR #5325:
URL: https://github.com/apache/rocketmq/pull/5325#discussion_r996547510


##########
tools/src/test/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommandTest.java:
##########
@@ -49,7 +49,7 @@ public void testExecute() {
         // Note: Posix parser is capable of handling values that contains '='.
         final CommandLine commandLine =
             ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs,
-                cmd.buildCommandlineOptions(options), new PosixParser());
+                cmd.buildCommandlineOptions(options), new DefaultParser());

Review Comment:
   See this failure case
   1) testExecute(org.apache.rocketmq.tools.command.acl.UpdateAccessConfigSubCommandTest)
   java.lang.SecurityException: Test code should never call System.exit()
   	at com.google.testing.junit.runner.util.GoogleTestSecurityManager.checkExit(GoogleTestSecurityManager.java:34)
   	at java.lang.Runtime.exit(Runtime.java:107)
   	at java.lang.System.exit(System.java:973)
   	at org.apache.rocketmq.srvutil.ServerUtil.parseCmdLine(ServerUtil.java:56)
   	at org.apache.rocketmq.tools.command.acl.UpdateAccessConfigSubCommandTest.testExecute(UpdateAccessConfigSubCommandTest.java:[51](https://github.com/apache/rocketmq/actions/runs/3255627851/jobs/5345142856#step:4:52))



-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] lizhanhui commented on a diff in pull request #5325: [ISSUE #5324]Replace deprecated class PosixParser with DefaultParser for CLI

Posted by GitBox <gi...@apache.org>.
lizhanhui commented on code in PR #5325:
URL: https://github.com/apache/rocketmq/pull/5325#discussion_r996569634


##########
tools/src/test/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommandTest.java:
##########
@@ -49,7 +49,7 @@ public void testExecute() {
         // Note: Posix parser is capable of handling values that contains '='.
         final CommandLine commandLine =
             ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs,
-                cmd.buildCommandlineOptions(options), new PosixParser());
+                cmd.buildCommandlineOptions(options), new DefaultParser());

Review Comment:
   OK. Please look into the failed test case anyway.



-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] mxsm commented on a diff in pull request #5325: [ISSUE #5324]Replace deprecated class PosixParser with DefaultParser for CLI

Posted by GitBox <gi...@apache.org>.
mxsm commented on code in PR #5325:
URL: https://github.com/apache/rocketmq/pull/5325#discussion_r996570336


##########
tools/src/test/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommandTest.java:
##########
@@ -49,7 +49,7 @@ public void testExecute() {
         // Note: Posix parser is capable of handling values that contains '='.
         final CommandLine commandLine =
             ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs,
-                cmd.buildCommandlineOptions(options), new PosixParser());
+                cmd.buildCommandlineOptions(options), new DefaultParser());

Review Comment:
   @lizhanhui  I am watching



-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] mxsm commented on a diff in pull request #5325: [ISSUE #5324]Replace deprecated class PosixParser with DefaultParser for CLI

Posted by GitBox <gi...@apache.org>.
mxsm commented on code in PR #5325:
URL: https://github.com/apache/rocketmq/pull/5325#discussion_r996551579


##########
test/src/main/java/org/apache/rocketmq/test/util/MQAdminTestUtils.java:
##########
@@ -17,10 +17,15 @@
 
 package org.apache.rocketmq.test.util;
 
+import java.util.HashMap;

Review Comment:
   I use idea tool to fromat the code, so maybe change the the order of the previous packages. I think when need to remove the useless import packages,The functionality of idea is recommended instead of manual operation



-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] lizhanhui merged pull request #5325: [ISSUE #5324]Replace deprecated class PosixParser with DefaultParser for CLI

Posted by GitBox <gi...@apache.org>.
lizhanhui merged PR #5325:
URL: https://github.com/apache/rocketmq/pull/5325


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] mxsm commented on a diff in pull request #5325: [ISSUE #5324]Replace deprecated class PosixParser with DefaultParser for CLI

Posted by GitBox <gi...@apache.org>.
mxsm commented on code in PR #5325:
URL: https://github.com/apache/rocketmq/pull/5325#discussion_r996550057


##########
tools/src/test/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommandTest.java:
##########
@@ -49,7 +49,7 @@ public void testExecute() {
         // Note: Posix parser is capable of handling values that contains '='.
         final CommandLine commandLine =
             ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs,
-                cmd.buildCommandlineOptions(options), new PosixParser());
+                cmd.buildCommandlineOptions(options), new DefaultParser());

Review Comment:
   > DefaultParser cannot handle values that contain '='. Need to investigate if there is an option to overcome this issue.
   
   I will



-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] mxsm commented on pull request #5325: [ISSUE #5324]Replace deprecated class PosixParser with DefaultParser for CLI

Posted by GitBox <gi...@apache.org>.
mxsm commented on PR #5325:
URL: https://github.com/apache/rocketmq/pull/5325#issuecomment-1282553176

   Hi @lizhanhui  I have sloved failed test case, PTAL~


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] mxsm commented on a diff in pull request #5325: [ISSUE #5324]Replace deprecated class PosixParser with DefaultParser for CLI

Posted by GitBox <gi...@apache.org>.
mxsm commented on code in PR #5325:
URL: https://github.com/apache/rocketmq/pull/5325#discussion_r996567862


##########
tools/src/test/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommandTest.java:
##########
@@ -49,7 +49,7 @@ public void testExecute() {
         // Note: Posix parser is capable of handling values that contains '='.
         final CommandLine commandLine =
             ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs,
-                cmd.buildCommandlineOptions(options), new PosixParser());
+                cmd.buildCommandlineOptions(options), new DefaultParser());

Review Comment:
   @lizhanhui DefaultParser can handle values that contain '=', The following validation:
   **case1:**
   ![image](https://user-images.githubusercontent.com/15797831/196077246-5026435e-2700-4960-acc3-76734bc18778.png)
   debug result:
   ![image](https://user-images.githubusercontent.com/15797831/196077419-bd9dab1e-d13f-462f-8624-0d66390deed9.png)
   **case 2:**
   ![image](https://user-images.githubusercontent.com/15797831/196077583-0eb69ad5-ce7a-4d83-a86c-5d61de93e059.png)
   debug result:
   ![image](https://user-images.githubusercontent.com/15797831/196077532-18d80f54-5901-48de-aa4f-281a52ca7093.png)
   
   



-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] lizhanhui commented on a diff in pull request #5325: [ISSUE #5324]Replace deprecated class PosixParser with DefaultParser for CLI

Posted by GitBox <gi...@apache.org>.
lizhanhui commented on code in PR #5325:
URL: https://github.com/apache/rocketmq/pull/5325#discussion_r996569990


##########
test/src/main/java/org/apache/rocketmq/test/util/MQAdminTestUtils.java:
##########
@@ -17,10 +17,15 @@
 
 package org.apache.rocketmq.test.util;
 
+import java.util.HashMap;

Review Comment:
   It will be OK if the sort is automatic



-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] Oliverwqcwrw commented on a diff in pull request #5325: [ISSUE #5324]Replace deprecated class PosixParser with DefaultParser for CLI

Posted by GitBox <gi...@apache.org>.
Oliverwqcwrw commented on code in PR #5325:
URL: https://github.com/apache/rocketmq/pull/5325#discussion_r996538288


##########
test/src/main/java/org/apache/rocketmq/test/util/MQAdminTestUtils.java:
##########
@@ -17,10 +17,15 @@
 
 package org.apache.rocketmq.test.util;
 
+import java.util.HashMap;

Review Comment:
   ditto



##########
example/src/main/java/org/apache/rocketmq/example/benchmark/Consumer.java:
##########
@@ -17,11 +17,20 @@
 
 package org.apache.rocketmq.example.benchmark;
 
+import java.io.IOException;

Review Comment:
   I think it's best not to change the order of the previous packages



-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] mxsm commented on a diff in pull request #5325: [ISSUE #5324]Replace deprecated class PosixParser with DefaultParser for CLI

Posted by GitBox <gi...@apache.org>.
mxsm commented on code in PR #5325:
URL: https://github.com/apache/rocketmq/pull/5325#discussion_r996567862


##########
tools/src/test/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommandTest.java:
##########
@@ -49,7 +49,7 @@ public void testExecute() {
         // Note: Posix parser is capable of handling values that contains '='.
         final CommandLine commandLine =
             ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs,
-                cmd.buildCommandlineOptions(options), new PosixParser());
+                cmd.buildCommandlineOptions(options), new DefaultParser());

Review Comment:
   hi @lizhanhui The following validation DefaultParser can handle values that contain '='. Please  see if this validation is correct.
   **case1:**
   ![image](https://user-images.githubusercontent.com/15797831/196077246-5026435e-2700-4960-acc3-76734bc18778.png)
   debug result:
   ![image](https://user-images.githubusercontent.com/15797831/196077419-bd9dab1e-d13f-462f-8624-0d66390deed9.png)
   **case 2:**
   ![image](https://user-images.githubusercontent.com/15797831/196077583-0eb69ad5-ce7a-4d83-a86c-5d61de93e059.png)
   debug result:
   ![image](https://user-images.githubusercontent.com/15797831/196077532-18d80f54-5901-48de-aa4f-281a52ca7093.png)
   
   



-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] lizhanhui commented on a diff in pull request #5325: [ISSUE #5324]Replace deprecated class PosixParser with DefaultParser for CLI

Posted by GitBox <gi...@apache.org>.
lizhanhui commented on code in PR #5325:
URL: https://github.com/apache/rocketmq/pull/5325#discussion_r996547141


##########
tools/src/test/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommandTest.java:
##########
@@ -49,7 +49,7 @@ public void testExecute() {
         // Note: Posix parser is capable of handling values that contains '='.
         final CommandLine commandLine =
             ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs,
-                cmd.buildCommandlineOptions(options), new PosixParser());
+                cmd.buildCommandlineOptions(options), new DefaultParser());

Review Comment:
   DefaultParser cannot handle values that contain '='. Need to investigate if there is an option to overcome this issue.



-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org