@@ -0,0 +1,3458 @@
+/*%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements.  See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You under the Apache License, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License.  You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.apache.rocketmq.tools.command.namesrv;%0A%0Aimport org.apache.commons.cli.CommandLine;%0Aimport org.apache.commons.cli.Options;%0Aimport org.apache.commons.cli.PosixParser;%0Aimport org.apache.rocketmq.client.ClientConfig;%0Aimport org.apache.rocketmq.client.impl.MQClientAPIImpl;%0Aimport org.apache.rocketmq.client.impl.MQClientManager;%0Aimport org.apache.rocketmq.client.impl.factory.MQClientInstance;%0Aimport org.apache.rocketmq.srvutil.ServerUtil;%0Aimport org.apache.rocketmq.tools.admin.DefaultMQAdminExt;%0Aimport org.apache.rocketmq.tools.admin.DefaultMQAdminExtImpl;%0Aimport org.apache.rocketmq.tools.command.SubCommandException;%0Aimport org.junit.AfterClass;%0Aimport org.junit.BeforeClass;%0Aimport org.junit.Ignore;%0Aimport org.junit.Test;%0A%0Aimport java.lang.reflect.Field;%0A%0Aimport static org.mockito.Mockito.mock;%0A%0Apublic class UpdateKvConfigCommandTest %7B%0A    private static DefaultMQAdminExt defaultMQAdminExt;%0A    private static DefaultMQAdminExtImpl defaultMQAdminExtImpl;%0A    private static MQClientInstance mqClientInstance = MQClientManager.getInstance().getAndCreateMQClientInstance(new ClientConfig());%0A    private static MQClientAPIImpl mQClientAPIImpl;%0A%0A    @BeforeClass%0A    public static void init() throws NoSuchFieldException, IllegalAccessException %7B%0A        mQClientAPIImpl = mock(MQClientAPIImpl.class);%0A        defaultMQAdminExt = new DefaultMQAdminExt();%0A        defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000);%0A%0A        Field field = DefaultMQAdminExtImpl.class.getDeclaredField(%22mqClientInstance%22);%0A        field.setAccessible(true);%0A        field.set(defaultMQAdminExtImpl, mqClientInstance);%0A        field = MQClientInstance.class.getDeclaredField(%22mQClientAPIImpl%22);%0A        field.setAccessible(true);%0A        field.set(mqClientInstance, mQClientAPIImpl);%0A        field = DefaultMQAdminExt.class.getDeclaredField(%22defaultMQAdminExtImpl%22);%0A        field.setAccessible(true);%0A        field.set(defaultMQAdminExt, defaultMQAdminExtImpl);%0A    %7D%0A%0A    @AfterClass%0A    public static void terminate() %7B%0A        defaultMQAdminExt.shutdown();%0A    %7D%0A%0A    @Ignore%0A    @Test%0A    public void testExecute() throws SubCommandException %7B%0A        UpdateKvConfigCommand cmd = new UpdateKvConfigCommand();%0A        Options options = ServerUtil.buildCommandlineOptions(new Options());%0A        String%5B%5D subargs = new String%5B%5D%7B%22-s namespace%22, %22-k topicname%22, %22-v unit_test%22%7D;%0A        final CommandLine commandLine =%0A                ServerUtil.parseCmdLine(%22mqadmin %22 + cmd.commandName() + cmd.commandDesc(), subargs, cmd.buildCommandlineOptions(options), new PosixParser());%0A        cmd.execute(commandLine, options, null);%0A    %7D%0A%7D%0A

Add test cases for UpdateKvConfigCommand (#929)