mirror of
https://github.com/apache/rocketmq.git
synced 2026-08-30 18:10:44 +08:00
* [ISSUE #9821] Fix getBrokerConfig no response issue for empty parameters * Update * Update test
This commit is contained in:
+6
-7
@@ -25,6 +25,7 @@ import java.util.Properties;
|
||||
|
||||
import org.apache.commons.cli.CommandLine;
|
||||
import org.apache.commons.cli.Option;
|
||||
import org.apache.commons.cli.OptionGroup;
|
||||
import org.apache.commons.cli.Options;
|
||||
import org.apache.rocketmq.client.exception.MQBrokerException;
|
||||
import org.apache.rocketmq.remoting.RPCHook;
|
||||
@@ -50,13 +51,11 @@ public class GetBrokerConfigCommand implements SubCommand {
|
||||
|
||||
@Override
|
||||
public Options buildCommandlineOptions(final Options options) {
|
||||
Option opt = new Option("b", "brokerAddr", true, "get which broker");
|
||||
opt.setRequired(false);
|
||||
options.addOption(opt);
|
||||
|
||||
opt = new Option("c", "clusterName", true, "get which cluster");
|
||||
opt.setRequired(false);
|
||||
options.addOption(opt);
|
||||
OptionGroup group = new OptionGroup();
|
||||
group.addOption(new Option("b", "brokerAddr", true, "get which broker"));
|
||||
group.addOption(new Option("c", "clusterName", true, "get which cluster"));
|
||||
group.setRequired(true);
|
||||
options.addOptionGroup(group);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public class GetBrokerConfigCommandTest extends ServerResponseMocker {
|
||||
public void testExecute() throws SubCommandException {
|
||||
GetBrokerConfigCommand cmd = new GetBrokerConfigCommand();
|
||||
Options options = ServerUtil.buildCommandlineOptions(new Options());
|
||||
String[] subargs = new String[] {"-b 127.0.0.1:" + listenPort(), "-c default-cluster"};
|
||||
String[] subargs = new String[] {"-b 127.0.0.1:" + listenPort()};
|
||||
final CommandLine commandLine =
|
||||
ServerUtil.parseCmdLine("mqadmin " + cmd.commandName(), subargs,
|
||||
cmd.buildCommandlineOptions(options), new DefaultParser());
|
||||
|
||||
Reference in New Issue
Block a user