geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinmeil...@apache.org
Subject [2/9] geode git commit: GEODE-1597: use Spring shell's parser and delete our own parsing code
Date Thu, 27 Apr 2017 20:18:12 GMT
http://git-wip-us.apache.org/repos/asf/geode/blob/1fc0f0ca/geode-core/src/test/java/org/apache/geode/management/internal/cli/JoptOptionParserTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/JoptOptionParserTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/JoptOptionParserTest.java
deleted file mode 100644
index 9815a9c..0000000
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/JoptOptionParserTest.java
+++ /dev/null
@@ -1,527 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.management.internal.cli;
-
-import static org.assertj.core.api.Assertions.*;
-import static org.mockito.Mockito.*;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import junitparams.JUnitParamsRunner;
-import junitparams.Parameters;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-
-import org.apache.geode.management.internal.cli.exceptions.CliCommandOptionException;
-import org.apache.geode.management.internal.cli.exceptions.CliCommandOptionMissingException;
-import org.apache.geode.management.internal.cli.exceptions.CliCommandOptionNotApplicableException;
-import org.apache.geode.management.internal.cli.parser.Argument;
-import org.apache.geode.management.internal.cli.parser.Option;
-import org.apache.geode.management.internal.cli.parser.OptionSet;
-import org.apache.geode.management.internal.cli.parser.jopt.JoptOptionParser;
-import org.apache.geode.test.junit.categories.UnitTest;
-
-@Category(UnitTest.class)
-@RunWith(JUnitParamsRunner.class)
-public class JoptOptionParserTest {
-
-  private JoptOptionParser emptyOptionParser;
-  private OptionSet emptyOptionSet;
-
-  private Argument requiredArgument;
-  private Argument optionalArgument;
-
-  private Option requiredOption;
-  private Option optionalOption;
-
-  private JoptOptionParser simpleOptionParser;
-  private JoptOptionParser exampleOptionParser;
-
-  @Before
-  public void setUp() throws Exception {
-    this.emptyOptionParser = new JoptOptionParser();
-    this.emptyOptionSet = new OptionSet();
-    defineSimpleOptionParser();
-    defineExampleOptionParser();
-  }
-
-  @Test
-  public void getArgumentsIsEmptyByDefault() throws Exception {
-    assertThat(this.emptyOptionParser.getArguments()).isEmpty();
-  }
-
-  @Test
-  public void getOptionsIsNullByDefault() throws Exception {
-    assertThat(this.emptyOptionParser.getOptions()).isNull();
-  }
-
-  @Test
-  public void parseNullReturnsDefaultOptionSet() throws Exception {
-    OptionSet optionSet = this.emptyOptionParser.parse(null);
-    assertThat(optionSet.areArgumentsPresent()).isEqualTo(emptyOptionSet.areArgumentsPresent());
-    assertThat(optionSet.areOptionsPresent()).isEqualTo(emptyOptionSet.areOptionsPresent());
-    assertThat(optionSet.getNoOfSpacesRemoved()).isEqualTo(emptyOptionSet.getNoOfSpacesRemoved());
-    assertThat(optionSet.getSplit()).isEqualTo(emptyOptionSet.getSplit());
-    assertThat(optionSet.getNoOfSpacesRemoved()).isEqualTo(emptyOptionSet.getNoOfSpacesRemoved());
-    assertThat(optionSet.getUserInput()).isEqualTo(""); // emptyOptionSet.getUserInput());
-    assertThat(optionSet.getValue((Argument) null))
-        .isEqualTo(emptyOptionSet.getValue((Argument) null));
-    assertThat(optionSet.getValue((Option) null)).isEqualTo(emptyOptionSet.getValue((Option) null));
-  }
-
-  @Test
-  public void parseEmptyThrowsNullPointerException() throws Exception {
-    assertThatThrownBy(() -> this.emptyOptionParser.parse(""))
-        .isInstanceOf(NullPointerException.class);
-  }
-
-  @Test
-  public void setArgumentsShouldCreateCopy() throws Exception {
-    Argument argument = mock(Argument.class);
-    when(argument.isRequired()).thenReturn(true);
-
-    LinkedList<Argument> arguments = new LinkedList<>();
-    arguments.add(argument);
-
-    this.emptyOptionParser.setArguments(arguments);
-
-    assertThat(this.emptyOptionParser.getArguments()).isNotSameAs(arguments);
-    assertThat(this.emptyOptionParser.getArguments()).hasSize(1);
-
-    arguments.clear();
-
-    assertThat(arguments).hasSize(0);
-    assertThat(this.emptyOptionParser.getArguments()).hasSize(1);
-  }
-
-  @Test
-  public void setArgumentsShouldKeepRequiredBeforeOptional() throws Exception {
-    Argument requiredArgument1 = mock(Argument.class);
-    when(requiredArgument1.isRequired()).thenReturn(true);
-    Argument optionalArgument1 = mock(Argument.class);
-    when(optionalArgument1.isRequired()).thenReturn(false);
-
-    LinkedList<Argument> arguments = new LinkedList<>();
-    arguments.add(requiredArgument1);
-    arguments.add(optionalArgument1);
-
-    this.emptyOptionParser.setArguments(arguments);
-
-    LinkedList<Argument> argumentsReturned = this.emptyOptionParser.getArguments();
-
-    assertThat(argumentsReturned).hasSize(2);
-    assertThat(argumentsReturned.getFirst()).isSameAs(requiredArgument1);
-    assertThat(argumentsReturned.getLast()).isSameAs(optionalArgument1);
-  }
-
-  @Test
-  public void setArgumentsShouldMoveRequiredBeforeOptional() throws Exception {
-    Argument requiredArgument1 = mock(Argument.class);
-    when(requiredArgument1.isRequired()).thenReturn(true);
-    Argument optionalArgument1 = mock(Argument.class);
-    when(optionalArgument1.isRequired()).thenReturn(false);
-
-    LinkedList<Argument> arguments = new LinkedList<>();
-    arguments.add(optionalArgument1);
-    arguments.add(requiredArgument1);
-
-    this.emptyOptionParser.setArguments(arguments);
-
-    LinkedList<Argument> argumentsReturned = this.emptyOptionParser.getArguments();
-
-    assertThat(argumentsReturned).hasSize(2);
-    assertThat(argumentsReturned.getFirst()).isSameAs(requiredArgument1);
-    assertThat(argumentsReturned.getLast()).isSameAs(optionalArgument1);
-  }
-
-  @Test
-  public void setOptionsShouldKeepSameInstance() throws Exception {
-    Option option = mock(Option.class);
-    ArrayList aggregate = new ArrayList<String>();
-    aggregate.add("option");
-    when(option.getAggregate()).thenReturn(aggregate);
-    when(option.getHelp()).thenReturn("help text");
-
-    LinkedList<Option> options = new LinkedList<>();
-    options.add(option);
-
-    this.emptyOptionParser.setOptions(options);
-
-    assertThat(this.emptyOptionParser.getOptions()).isSameAs(options);
-    assertThat(this.emptyOptionParser.getOptions()).hasSize(1);
-
-    options.clear();
-
-    assertThat(options).hasSize(0);
-    assertThat(this.emptyOptionParser.getOptions()).hasSize(0);
-  }
-
-  @Test
-  public void parseInputWithDefinedArgumentShouldWork() throws Exception {
-    LinkedList<Argument> arguments = new LinkedList<>();
-    LinkedList<Option> options = new LinkedList<>();
-
-    arguments.add(this.requiredArgument);
-
-    JoptOptionParser optionParser = new JoptOptionParser();
-    optionParser.setArguments(arguments);
-    optionParser.setOptions(options);
-
-    OptionSet optionSet = optionParser.parse("command1 argument1_value");
-    assertThat(optionSet.areArgumentsPresent()).isTrue();
-    assertThat(optionSet.hasArgument(this.requiredArgument)).isTrue();
-  }
-
-  @Test
-  public void parseInputWithOneArgumentShouldFindJustOneArgument() throws Exception {
-    LinkedList<Argument> arguments = new LinkedList<>();
-    LinkedList<Option> options = new LinkedList<>();
-
-    arguments.add(this.requiredArgument);
-
-    JoptOptionParser optionParser = new JoptOptionParser();
-    optionParser.setArguments(arguments);
-    optionParser.setOptions(options);
-
-    OptionSet optionSet = optionParser.parse("command1 argument1_value");
-    assertThat(optionSet.areArgumentsPresent()).isTrue();
-    assertThat(optionSet.hasArgument(this.requiredArgument)).isTrue();
-    assertThat(optionSet.hasArgument(this.optionalArgument)).isFalse();
-  }
-
-  @Test
-  public void parseInputWithTwoArgumentsShouldFindTwoArguments() throws Exception {
-    LinkedList<Argument> arguments = new LinkedList<>();
-    LinkedList<Option> options = new LinkedList<>();
-
-    arguments.add(this.requiredArgument);
-    arguments.add(this.optionalArgument);
-
-    JoptOptionParser optionParser = new JoptOptionParser();
-    optionParser.setArguments(arguments);
-    optionParser.setOptions(options);
-
-    OptionSet optionSet = optionParser.parse("command1 argument1_value? argument2_value");
-    assertThat(optionSet.areArgumentsPresent()).isTrue();
-    assertThat(optionSet.hasArgument(this.requiredArgument)).isTrue();
-    assertThat(optionSet.hasArgument(this.optionalArgument)).isTrue();
-  }
-
-  @Test
-  public void parseInputWithUndefinedArgumentShouldNotThrow() throws Exception {
-    LinkedList<Argument> arguments = new LinkedList<>();
-    LinkedList<Option> options = new LinkedList<>();
-
-    arguments.add(this.requiredArgument);
-
-    JoptOptionParser optionParser = new JoptOptionParser();
-    optionParser.setArguments(arguments);
-    optionParser.setOptions(options);
-
-    OptionSet optionSet = optionParser.parse("command1 argument1_value? argument2_value");
-    assertThat(optionSet.getUserInput()).isEqualTo("command1 argument1_value? argument2_value");
-  }
-
-  @Test
-  public void parseInputShouldIgnoreUndefinedOption() throws Exception {
-    // one fix for GEODE-1598 has a side effect of preventing our detection of undefined options
-    OptionSet optionSet =
-        this.simpleOptionParser.parse("command1 argument1_value argument2_value --undefinedOption");
-    assertThat(optionSet.areOptionsPresent()).isFalse();
-    assertThat(optionSet.hasOption(this.requiredOption)).isFalse();
-    assertThat(optionSet.hasOption(this.optionalOption)).isFalse();
-  }
-
-  @Test
-  public void parseInputWithOneOptionShouldFindOneOption() throws Exception {
-    OptionSet optionSet = this.simpleOptionParser.parse("command1 argument1_value --option1");
-    assertThat(optionSet.areOptionsPresent()).isTrue();
-    assertThat(optionSet.hasOption(this.requiredOption)).isTrue();
-    assertThat(optionSet.hasOption(this.optionalOption)).isFalse();
-  }
-
-  @Test
-  public void parseInputWithTwoOptionsShouldFindTwoOptions() throws Exception {
-    OptionSet optionSet =
-        this.simpleOptionParser.parse("command1 argument1_value --option1 --option2");
-    assertThat(optionSet.areOptionsPresent()).isTrue();
-    assertThat(optionSet.hasOption(this.requiredOption)).isTrue();
-    assertThat(optionSet.hasOption(this.optionalOption)).isTrue();
-  }
-
-  @Test
-  public void parseInputWithOptionWithValueShouldFindOption() throws Exception {
-    OptionSet optionSet = this.simpleOptionParser.parse("command1 argument1_value --option1=value");
-    assertThat(optionSet.areOptionsPresent()).isTrue();
-    assertThat(optionSet.hasOption(this.requiredOption)).isTrue();
-  }
-
-  @Test
-  public void parseInputWithOptionWithoutValueShouldFindOption() throws Exception {
-    OptionSet optionSet = this.simpleOptionParser.parse("command1 argument1_value --option1");
-    assertThat(optionSet.areOptionsPresent()).isTrue();
-    assertThat(optionSet.hasOption(this.requiredOption)).isTrue();
-  }
-
-  @Test
-  public void parseInputWithoutOptionShouldNotFindOptions() throws Exception {
-    LinkedList<Argument> arguments = new LinkedList<>();
-    LinkedList<Option> options = new LinkedList<>();
-
-    arguments.add(this.requiredArgument);
-
-    JoptOptionParser optionParser = new JoptOptionParser();
-    optionParser.setArguments(arguments);
-    optionParser.setOptions(options);
-
-    OptionSet optionSet = optionParser.parse("command1 argument1_value");
-    assertThat(optionSet.areOptionsPresent()).isFalse();
-    assertThat(optionSet.hasOption(this.requiredOption)).isFalse();
-  }
-
-  @Test
-  @Parameters(method = "exampleInputParameters")
-  public void parseInputWithExampleInputParametesr(String command, boolean expectException,
-      boolean hasArguments, boolean hasOptions) throws Exception {
-    if (expectException) {
-      assertThatThrownBy(() -> this.exampleOptionParser.parse(command))
-          .isExactlyInstanceOf(CliCommandOptionMissingException.class);
-      return;
-    }
-
-    OptionSet options = this.exampleOptionParser.parse(command);
-    assertThat(options).isNotNull();
-    assertThat(options.areArgumentsPresent()).isEqualTo(hasArguments);
-    assertThat(options.areOptionsPresent()).isEqualTo(hasOptions);
-  }
-
-  private static Object[] exampleInputParameters() {
-    return new Object[] {
-        // 0
-        new Object[] {" ARGUMENT1_VALUE —option1=somevalue", false, true, false},
-        // 1
-        new Object[] {" ARGUMENT1_VALUE?      ARGUMENT2_VALUE -- ----------", false, true, false},
-        // 2
-        new Object[] {" --option1=value", false, false, true},
-        // 3
-        new Object[] {
-            "         ARGUMENT1_VALUE?       ARGUMENT2_VALUE --option1=option1value --option2",
-            false, true, true},
-        // 4
-        new Object[] {
-            "         ARGUMENT1_VALUE?       ARGUMENT2_VALUE --option1=option1value --option2=option2value --option3=option3value",
-            false, true, true},
-        // 5
-        new Object[] {
-            " --string=string1 --stringArray=1,2 --stringArray=3,4 --stringList=11,12,13 --integer=10 --stringArray=5 --stringList=14,15",
-            false, false, true},
-        // 6
-        new Object[] {" --stringArray=1,2 --stringArray='3,4'", false, false, true},
-        // 7
-        new Object[] {
-            " --string=\"1\" --colonArray=2:3:4 --stringArray=5,\"6,7\",8 --stringList=\"9,10,11,12\"",
-            false, false, true},
-        // 8
-        new Object[] {" --string=string1 --stringArray=1,2 --string=string2", false, false, true},
-        // 9
-        new Object[] {" this is just one argument?this is a second argument", false, true, false}};
-  }
-
-  private void defineSimpleOptionParser() {
-    LinkedList<Argument> arguments = new LinkedList<Argument>();
-    LinkedList<Option> options = new LinkedList<Option>();
-
-    this.requiredArgument = mock(Argument.class);
-    when(this.requiredArgument.getArgumentName()).thenReturn("argument1");
-    when(this.requiredArgument.getContext()).thenReturn("context for argument1");
-    when(this.requiredArgument.getHelp()).thenReturn("help for argument1");
-    when(this.requiredArgument.isRequired()).thenReturn(true);
-    arguments.add(this.requiredArgument);
-
-    this.optionalArgument = mock(Argument.class);
-    when(this.optionalArgument.getArgumentName()).thenReturn("argument2");
-    when(this.optionalArgument.getContext()).thenReturn("context for argument2");
-    when(this.optionalArgument.getHelp()).thenReturn("help for argument2");
-    when(this.optionalArgument.isRequired()).thenReturn(false);
-    when(this.optionalArgument.getUnspecifiedDefaultValue())
-        .thenReturn("{unspecified default value for argument2}");
-    when(this.optionalArgument.isSystemProvided()).thenReturn(false);
-    arguments.add(this.optionalArgument);
-
-    this.requiredOption = mock(Option.class);
-    when(this.requiredOption.getLongOption()).thenReturn("--option1");
-    List<String> aggregate = new ArrayList<>();
-    aggregate.add("option1");
-    when(this.requiredOption.getAggregate()).thenReturn(aggregate);
-    when(this.requiredOption.getLongOption()).thenReturn("option1");
-    when(this.requiredOption.getHelp()).thenReturn("help for option1");
-    when(this.requiredOption.getValueSeparator()).thenReturn("=");
-    when(this.requiredOption.isRequired()).thenReturn(true);
-    assertThat(this.requiredOption.getAggregate()).isNotEmpty();
-    options.add(this.requiredOption);
-
-    this.optionalOption = mock(Option.class);
-    when(this.optionalOption.getLongOption()).thenReturn("--option2");
-    aggregate = new ArrayList<>();
-    aggregate.add("option2");
-    when(this.optionalOption.getAggregate()).thenReturn(aggregate);
-    when(this.optionalOption.getLongOption()).thenReturn("option2");
-    when(this.optionalOption.getHelp()).thenReturn("help for option2");
-    when(this.optionalOption.getValueSeparator()).thenReturn("=");
-    when(this.optionalOption.isRequired()).thenReturn(false);
-    assertThat(this.optionalOption.getAggregate()).isNotEmpty();
-    options.add(this.optionalOption);
-
-    this.simpleOptionParser = new JoptOptionParser();
-    this.simpleOptionParser.setArguments(arguments);
-    this.simpleOptionParser.setOptions(options);
-  }
-
-  private void defineExampleOptionParser() {
-    LinkedList<Argument> arguments = new LinkedList<Argument>();
-    LinkedList<Option> options = new LinkedList<Option>();
-
-    Argument argument1 = mock(Argument.class);
-    when(argument1.getArgumentName()).thenReturn("argument1");
-    when(argument1.getContext()).thenReturn("context for argument1");
-    when(argument1.getHelp()).thenReturn("help for argument1");
-    when(argument1.isRequired()).thenReturn(true);
-    arguments.add(argument1);
-
-    Argument argument2 = mock(Argument.class);
-    when(argument2.getArgumentName()).thenReturn("argument2");
-    when(argument2.getContext()).thenReturn("context for argument2");
-    when(argument2.getHelp()).thenReturn("help for argument2");
-    when(argument2.isRequired()).thenReturn(false);
-    when(argument2.getUnspecifiedDefaultValue())
-        .thenReturn("{unspecified default value for argument2}");
-    when(argument2.isSystemProvided()).thenReturn(false);
-    arguments.add(argument2);
-
-    Argument argument3 = mock(Argument.class);
-    when(argument3.getArgumentName()).thenReturn("argument3");
-    when(argument3.getContext()).thenReturn("context for argument3");
-    when(argument3.getHelp()).thenReturn("help for argument3");
-    when(argument3.isRequired()).thenReturn(false);
-    when(argument3.getUnspecifiedDefaultValue())
-        .thenReturn("{unspecified default value for argument3}");
-    when(argument2.isSystemProvided()).thenReturn(false);
-    arguments.add(argument3);
-
-    Option option1 = mock(Option.class);
-    when(option1.getLongOption()).thenReturn("--option1");
-    List<String> aggregate1 = new ArrayList<>();
-    aggregate1.add("option1");
-    when(option1.getAggregate()).thenReturn(aggregate1);
-    when(option1.getLongOption()).thenReturn("option1");
-    when(option1.getHelp()).thenReturn("help for option1");
-    when(option1.getValueSeparator()).thenReturn("=");
-    when(option1.isRequired()).thenReturn(false);
-    assertThat(option1.getAggregate()).isNotEmpty();
-    options.add(option1);
-
-    Option option2 = mock(Option.class);
-    when(option2.getLongOption()).thenReturn("--option2");
-    List<String> aggregate2 = new ArrayList<>();
-    aggregate2.add("option2");
-    when(option2.getAggregate()).thenReturn(aggregate2);
-    when(option2.getLongOption()).thenReturn("option2");
-    when(option2.getHelp()).thenReturn("help for option2");
-    when(option2.getValueSeparator()).thenReturn("=");
-    when(option2.isRequired()).thenReturn(false);
-    assertThat(option2.getAggregate()).isNotEmpty();
-    options.add(option2);
-
-    Option option3 = mock(Option.class);
-    when(option3.getLongOption()).thenReturn("--option3");
-    List<String> aggregate3 = new ArrayList<>();
-    aggregate3.add("option3");
-    when(option3.getAggregate()).thenReturn(aggregate3);
-    when(option3.getLongOption()).thenReturn("option3");
-    when(option3.getHelp()).thenReturn("help for option3");
-    when(option3.getValueSeparator()).thenReturn("=");
-    when(option3.isRequired()).thenReturn(false);
-    assertThat(option3.getAggregate()).isNotEmpty();
-    options.add(option3);
-
-    Option stringOption = mock(Option.class);
-    when(stringOption.getLongOption()).thenReturn("--string");
-    List<String> aggregateStringOption = new ArrayList<>();
-    aggregateStringOption.add("string");
-    when(stringOption.getAggregate()).thenReturn(aggregateStringOption);
-    when(stringOption.getLongOption()).thenReturn("string");
-    when(stringOption.getHelp()).thenReturn("help for string");
-    when(stringOption.getValueSeparator()).thenReturn("=");
-    when(stringOption.isRequired()).thenReturn(false);
-    assertThat(stringOption.getAggregate()).isNotEmpty();
-    options.add(stringOption);
-
-    Option stringArrayOption = mock(Option.class);
-    when(stringArrayOption.getLongOption()).thenReturn("--stringArray");
-    List<String> aggregateStringArrayOption = new ArrayList<>();
-    aggregateStringArrayOption.add("stringArray");
-    when(stringArrayOption.getAggregate()).thenReturn(aggregateStringArrayOption);
-    when(stringArrayOption.getLongOption()).thenReturn("stringArray");
-    when(stringArrayOption.getHelp()).thenReturn("help for stringArray");
-    when(stringArrayOption.getValueSeparator()).thenReturn("=");
-    when(stringArrayOption.isRequired()).thenReturn(false);
-    assertThat(stringArrayOption.getAggregate()).isNotEmpty();
-    options.add(stringArrayOption);
-
-    Option stringListOption = mock(Option.class);
-    when(stringListOption.getLongOption()).thenReturn("--stringList");
-    List<String> aggregateStringListOption = new ArrayList<>();
-    aggregateStringListOption.add("stringList");
-    when(stringListOption.getAggregate()).thenReturn(aggregateStringListOption);
-    when(stringListOption.getLongOption()).thenReturn("stringList");
-    when(stringListOption.getHelp()).thenReturn("help for stringList");
-    when(stringListOption.getValueSeparator()).thenReturn("=");
-    when(stringListOption.isRequired()).thenReturn(false);
-    assertThat(stringListOption.getAggregate()).isNotEmpty();
-    options.add(stringListOption);
-
-    Option integerOption = mock(Option.class);
-    when(integerOption.getLongOption()).thenReturn("--integer");
-    List<String> aggregateIntegerOption = new ArrayList<>();
-    aggregateIntegerOption.add("integer");
-    when(integerOption.getAggregate()).thenReturn(aggregateIntegerOption);
-    when(integerOption.getLongOption()).thenReturn("integer");
-    when(integerOption.getHelp()).thenReturn("help for integer");
-    when(integerOption.getValueSeparator()).thenReturn("=");
-    when(integerOption.isRequired()).thenReturn(false);
-    assertThat(integerOption.getAggregate()).isNotEmpty();
-    options.add(integerOption);
-
-    Option colonArrayOption = mock(Option.class);
-    when(colonArrayOption.getLongOption()).thenReturn("--colonArray");
-    List<String> aggregateColonArrayOption = new ArrayList<>();
-    aggregateColonArrayOption.add("colonArray");
-    when(colonArrayOption.getAggregate()).thenReturn(aggregateColonArrayOption);
-    when(colonArrayOption.getLongOption()).thenReturn("colonArray");
-    when(colonArrayOption.getHelp()).thenReturn("help for colonArray");
-    when(colonArrayOption.getValueSeparator()).thenReturn("=");
-    when(colonArrayOption.isRequired()).thenReturn(false);
-    assertThat(colonArrayOption.getAggregate()).isNotEmpty();
-    options.add(colonArrayOption);
-
-    this.exampleOptionParser = new JoptOptionParser();
-    this.exampleOptionParser.setArguments(arguments);
-    this.exampleOptionParser.setOptions(options);
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/1fc0f0ca/geode-core/src/test/java/org/apache/geode/management/internal/cli/annotations/CliArgumentJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/annotations/CliArgumentJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/annotations/CliArgumentJUnitTest.java
deleted file mode 100644
index 161f7c6..0000000
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/annotations/CliArgumentJUnitTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.management.internal.cli.annotations;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.management.internal.cli.annotation.CliArgument;
-import org.apache.geode.test.junit.categories.UnitTest;
-
-/**
- * Includes tests for checking assignment of {@link CliArgument}
- */
-@Category(UnitTest.class)
-public class CliArgumentJUnitTest {
-
-  private static final String ARGUMENT_NAME = "ARGUMENT_NAME";
-  private static final String ARGUMENT_HELP = "ARGUMENT_HELP";
-  private static final boolean ARGUMENT_MANDATORY = true;
-  private static final String ARGUMENT_CONTEXT = "ARGUMENT_CONTEXT";
-  private static final boolean SYSTEM_PROVIDED = true;
-  private static final String ARGUMENT_UNSPECIFIED_DEFAULT_VALUE =
-      "ARGUMENT_UNSPECIFIED_DEFAULT_VALUE";
-  private static final String MESSAGE_FOR_DEFAULT_ARGUMENT = "Testing for argument with defaults";
-  private static final String MESSAGE_FOR_ARGUMENT = "Testing for argument without defaults";
-
-  /**
-   * Test for {@link CliArgument#name()}
-   */
-  @Test
-  public void testName() throws Exception {
-    String name = ((CliArgument) (ArgumentTestingClass.class
-        .getMethod("defaultArgumentTestingMethod", String.class).getParameterAnnotations()[0][0]))
-            .name();
-    assertNotNull(name);
-    assertEquals(MESSAGE_FOR_DEFAULT_ARGUMENT, name, ARGUMENT_NAME);
-    name = ((CliArgument) (ArgumentTestingClass.class
-        .getMethod("argumentTestingMethod", String.class).getParameterAnnotations()[0][0])).name();
-    assertNotNull(name);
-    assertEquals(MESSAGE_FOR_ARGUMENT, name, ARGUMENT_NAME);
-  }
-
-  /**
-   * Test for {@link CliArgument#help()}
-   */
-  @Test
-  public void testHelp() throws Exception {
-    String help = ((CliArgument) (ArgumentTestingClass.class
-        .getMethod("defaultArgumentTestingMethod", String.class).getParameterAnnotations()[0][0]))
-            .help();
-    assertNotNull(help);
-    assertEquals(MESSAGE_FOR_DEFAULT_ARGUMENT, help, "");
-    help = ((CliArgument) (ArgumentTestingClass.class
-        .getMethod("argumentTestingMethod", String.class).getParameterAnnotations()[0][0])).help();
-    assertNotNull(help);
-    assertEquals(MESSAGE_FOR_ARGUMENT, help, ARGUMENT_HELP);
-  }
-
-  /**
-   * Test for {@link CliArgument#mandatory()}
-   */
-  @Test
-  public void testMandatory() throws Exception {
-    boolean mandatory = ((CliArgument) (ArgumentTestingClass.class
-        .getMethod("defaultArgumentTestingMethod", String.class).getParameterAnnotations()[0][0]))
-            .mandatory();
-    assertEquals(MESSAGE_FOR_DEFAULT_ARGUMENT, mandatory, false);
-    mandatory =
-        ((CliArgument) (ArgumentTestingClass.class.getMethod("argumentTestingMethod", String.class)
-            .getParameterAnnotations()[0][0])).mandatory();
-    assertEquals(MESSAGE_FOR_ARGUMENT, mandatory, ARGUMENT_MANDATORY);
-  }
-
-  /**
-   * Test for {@link CliArgument#argumentContext()}
-   */
-  @Test
-  public void testArgumentContext() throws Exception {
-    String argumentContext = ((CliArgument) (ArgumentTestingClass.class
-        .getMethod("defaultArgumentTestingMethod", String.class).getParameterAnnotations()[0][0]))
-            .argumentContext();
-    assertNotNull(argumentContext);
-    assertEquals(MESSAGE_FOR_DEFAULT_ARGUMENT, argumentContext, "");
-    argumentContext =
-        ((CliArgument) (ArgumentTestingClass.class.getMethod("argumentTestingMethod", String.class)
-            .getParameterAnnotations()[0][0])).argumentContext();
-    assertNotNull(argumentContext);
-    assertEquals(MESSAGE_FOR_ARGUMENT, argumentContext, ARGUMENT_CONTEXT);
-  }
-
-  /**
-   * Test for {@link CliArgument#systemProvided()}
-   */
-  @Test
-  public void testSystemProvided() throws Exception {
-    boolean systemProvided = ((CliArgument) (ArgumentTestingClass.class
-        .getMethod("defaultArgumentTestingMethod", String.class).getParameterAnnotations()[0][0]))
-            .systemProvided();
-    assertEquals(MESSAGE_FOR_DEFAULT_ARGUMENT, systemProvided, false);
-    systemProvided =
-        ((CliArgument) (ArgumentTestingClass.class.getMethod("argumentTestingMethod", String.class)
-            .getParameterAnnotations()[0][0])).systemProvided();
-    assertEquals(MESSAGE_FOR_ARGUMENT, systemProvided, SYSTEM_PROVIDED);
-  }
-
-  /**
-   * Test for {@link CliArgument#unspecifiedDefaultValue()}
-   */
-  @Test
-  public void testUnspecifiedDefaultValue() throws Exception {
-    String unspecifiedDefaultValue = ((CliArgument) (ArgumentTestingClass.class
-        .getMethod("defaultArgumentTestingMethod", String.class).getParameterAnnotations()[0][0]))
-            .unspecifiedDefaultValue();
-    assertEquals(MESSAGE_FOR_DEFAULT_ARGUMENT, unspecifiedDefaultValue, "__NULL__");
-    unspecifiedDefaultValue =
-        ((CliArgument) (ArgumentTestingClass.class.getMethod("argumentTestingMethod", String.class)
-            .getParameterAnnotations()[0][0])).unspecifiedDefaultValue();
-    assertEquals(MESSAGE_FOR_ARGUMENT, unspecifiedDefaultValue, ARGUMENT_UNSPECIFIED_DEFAULT_VALUE);
-  }
-
-  /**
-   * Class used by the tests
-   */
-  private static class ArgumentTestingClass {
-
-    @SuppressWarnings("unused")
-    public static Object defaultArgumentTestingMethod(
-        @CliArgument(name = ARGUMENT_NAME) String defaultArgument) {
-      return null;
-    }
-
-    @SuppressWarnings("unused")
-    public static Object argumentTestingMethod(
-        @CliArgument(name = ARGUMENT_NAME, help = ARGUMENT_HELP, mandatory = ARGUMENT_MANDATORY,
-            argumentContext = ARGUMENT_CONTEXT, systemProvided = SYSTEM_PROVIDED,
-            unspecifiedDefaultValue = ARGUMENT_UNSPECIFIED_DEFAULT_VALUE) String argument) {
-      return null;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/1fc0f0ca/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CliCommandTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CliCommandTestBase.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CliCommandTestBase.java
index 165f664..afdb706 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CliCommandTestBase.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CliCommandTestBase.java
@@ -32,7 +32,6 @@ import org.apache.geode.management.ManagementService;
 import org.apache.geode.management.internal.cli.CommandManager;
 import org.apache.geode.management.internal.cli.HeadlessGfsh;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.parser.CommandTarget;
 import org.apache.geode.management.internal.cli.result.CommandResult;
 import org.apache.geode.management.internal.cli.shell.Gfsh;
 import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
@@ -43,42 +42,61 @@ import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
 import org.apache.geode.test.dunit.rules.DistributedRestoreSystemProperties;
 import org.junit.Rule;
 import org.junit.rules.TemporaryFolder;
+import org.springframework.shell.core.CommandMarker;
 
 import java.io.IOException;
 import java.io.PrintStream;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.Map;
+import java.util.List;
 import java.util.Properties;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 /**
  * Base class for all the CLI/gfsh command dunit tests.
- * 
+ *
  * @deprecated use LocatorServerStartupRule and GfshShellConnectorRule instead.
  */
 public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
 
   public static final String USE_HTTP_SYSTEM_PROPERTY = "useHTTP";
-
-  private boolean useHttpOnConnect = Boolean.getBoolean(USE_HTTP_SYSTEM_PROPERTY);
-
-  private ManagementService managementService;
-
-  private transient HeadlessGfsh shell;
-
+  @Rule
+  public transient DistributedRestoreSystemProperties restoreSystemProperties =
+      new DistributedRestoreSystemProperties();
+  @Rule
+  public transient TemporaryFolder temporaryFolder = new TemporaryFolder();
   protected transient int httpPort;
   protected transient int jmxPort;
   protected transient String jmxHost;
   protected transient String gfshDir;
+  private boolean useHttpOnConnect = Boolean.getBoolean(USE_HTTP_SYSTEM_PROPERTY);
+  private ManagementService managementService;
+  private transient HeadlessGfsh shell;
 
-  @Rule
-  public transient DistributedRestoreSystemProperties restoreSystemProperties =
-      new DistributedRestoreSystemProperties();
+  public static boolean checkIfCommandsAreLoadedOrNot() {
+    CommandManager manager = new CommandManager();
+    List<CommandMarker> commands = manager.getCommandMarkers();
+    return commands.size() >= 1;
 
-  @Rule
-  public transient TemporaryFolder temporaryFolder = new TemporaryFolder();
+  }
+
+  protected static String commandResultToString(final CommandResult commandResult) {
+    assertNotNull(commandResult);
+
+    commandResult.resetToFirstLine();
+
+    StringBuilder buffer = new StringBuilder(commandResult.getHeader());
+
+    while (commandResult.hasNextLine()) {
+      buffer.append(commandResult.nextLine());
+    }
+
+    buffer.append(commandResult.getFooter());
+
+    return buffer.toString();
+  }
 
   @Override
   public final void postSetUp() throws Exception {
@@ -204,20 +222,6 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
     assertTrue(checkIfCommandsAreLoadedOrNot());
   }
 
-  public static boolean checkIfCommandsAreLoadedOrNot() {
-    CommandManager manager;
-    try {
-      manager = CommandManager.getInstance();
-      Map<String, CommandTarget> commands = manager.getCommands();
-      if (commands.size() < 1) {
-        return false;
-      }
-      return true;
-    } catch (ClassNotFoundException | IOException e) {
-      throw new RuntimeException("Could not load commands", e);
-    }
-  }
-
   /**
    * Stop the default management service.
    */
@@ -353,15 +357,6 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
   protected CommandResult executeCommandWithoutClear(HeadlessGfsh shell, String command) {
     assert (shell != null);
     assert (command != null);
-
-    try {
-      info("Executing command " + command + " with command Mgr " + CommandManager.getInstance());
-    } catch (ClassNotFoundException cnfex) {
-      throw new AssertionError(cnfex);
-    } catch (IOException ioex) {
-      throw new AssertionError(ioex);
-    }
-
     shell.executeCommand(command);
     if (shell.hasError()) {
       error("executeCommand completed with error : " + shell.getError());
@@ -396,22 +391,6 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
     printStream.print(commandResultToString(commandResult));
   }
 
-  protected static String commandResultToString(final CommandResult commandResult) {
-    assertNotNull(commandResult);
-
-    commandResult.resetToFirstLine();
-
-    StringBuilder buffer = new StringBuilder(commandResult.getHeader());
-
-    while (commandResult.hasNextLine()) {
-      buffer.append(commandResult.nextLine());
-    }
-
-    buffer.append(commandResult.getFooter());
-
-    return buffer.toString();
-  }
-
   /**
    * Utility method for finding the CommandResult object in the Map of CommandOutput objects.
    *

http://git-wip-us.apache.org/repos/asf/geode/blob/1fc0f0ca/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommandsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommandsDUnitTest.java
index 5f885e1..791e02b 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommandsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommandsDUnitTest.java
@@ -906,11 +906,7 @@ public class CreateAlterDestroyRegionCommandsDUnitTest extends CliCommandTestBas
     CommandStringBuilder commandStringBuilder = new CommandStringBuilder(CliStrings.ALTER_REGION);
     commandStringBuilder.addOption(CliStrings.ALTER_REGION__REGION, "/" + this.alterRegionName);
     commandStringBuilder.addOption(CliStrings.ALTER_REGION__CACHELISTENER,
-        "com.cadrdunit.RegionAlterCacheListenerA");
-    commandStringBuilder.addOption(CliStrings.ALTER_REGION__CACHELISTENER,
-        "com.cadrdunit.RegionAlterCacheListenerB");
-    commandStringBuilder.addOption(CliStrings.ALTER_REGION__CACHELISTENER,
-        "com.cadrdunit.RegionAlterCacheListenerC");
+        "com.cadrdunit.RegionAlterCacheListenerA,com.cadrdunit.RegionAlterCacheListenerB,com.cadrdunit.RegionAlterCacheListenerC");
 
     cmdResult = executeCommand(commandStringBuilder.toString());
     assertEquals(Result.Status.OK, cmdResult.getStatus());

http://git-wip-us.apache.org/repos/asf/geode/blob/1fc0f0ca/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandsDUnitTest.java
index 9ed5bed..3a88faa 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandsDUnitTest.java
@@ -18,16 +18,13 @@ import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
 import static org.apache.geode.test.dunit.Host.getHost;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertNotNull;
 
 import org.apache.geode.internal.ClassBuilder;
 import org.apache.geode.internal.ClassPathLoader;
 import org.apache.geode.management.internal.cli.result.CommandResult;
 import org.apache.geode.test.dunit.rules.GfshShellConnectionRule;
-import org.apache.geode.test.dunit.rules.Locator;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
-import org.apache.geode.test.dunit.rules.Server;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.junit.Before;
 import org.junit.Rule;
@@ -213,7 +210,7 @@ public class DeployCommandsDUnitTest implements Serializable {
     });
 
     gfshConnector
-        .executeAndVerifyCommand("undeploy --jars=" + jar3.getName() + "," + jar4.getName());
+        .executeAndVerifyCommand("undeploy --jar=" + jar3.getName() + "," + jar4.getName());
     server1.invoke(() -> {
       assertThatCannotLoad(jarName3, class3);
       assertThatCannotLoad(jarName4, class4);
@@ -239,10 +236,10 @@ public class DeployCommandsDUnitTest implements Serializable {
   @Test
   public void testListDeployed() throws Exception {
     // Deploy a couple of JAR files which can be listed
-    gfshConnector.executeAndVerifyCommand(
-        "deploy jar --group=" + GROUP1 + " --jar=" + jar1.getCanonicalPath());
-    gfshConnector.executeAndVerifyCommand(
-        "deploy jar --group=" + GROUP2 + " --jar=" + jar2.getCanonicalPath());
+    gfshConnector
+        .executeAndVerifyCommand("deploy --group=" + GROUP1 + " --jar=" + jar1.getCanonicalPath());
+    gfshConnector
+        .executeAndVerifyCommand("deploy --group=" + GROUP2 + " --jar=" + jar2.getCanonicalPath());
 
     // List for all members
     gfshConnector.executeAndVerifyCommand("list deployed");

http://git-wip-us.apache.org/repos/asf/geode/blob/1fc0f0ca/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsDUnitTest.java
index 5b07f28..e9c61c5 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsDUnitTest.java
@@ -1190,9 +1190,7 @@ public class DiskStoreCommandsDUnitTest extends CliCommandTestBase {
     commandStringBuilder.addOption(CliStrings.CREATE_DISK_STORE__TIME_INTERVAL, "2023");
     commandStringBuilder.addOption(CliStrings.CREATE_DISK_STORE__WRITE_BUFFER_SIZE, "3110");
     commandStringBuilder.addOption(CliStrings.CREATE_DISK_STORE__DIRECTORY_AND_SIZE,
-        diskStore1Dir1.getAbsolutePath() + "#1452637463");
-    commandStringBuilder.addOption(CliStrings.CREATE_DISK_STORE__DIRECTORY_AND_SIZE,
-        diskStore1Dir2.getAbsolutePath());
+        diskStore1Dir1.getAbsolutePath() + "#1452637463," + diskStore1Dir2.getAbsolutePath());
     cmdResult = executeCommand(commandStringBuilder.toString());
     assertEquals(Result.Status.OK, cmdResult.getStatus());
     String stringResult = commandResultToString(cmdResult);

http://git-wip-us.apache.org/repos/asf/geode/blob/1fc0f0ca/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
index e99a7fb..0e2a41e 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
@@ -14,34 +14,23 @@
  */
 package org.apache.geode.management.internal.cli.commands;
 
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.apache.geode.test.dunit.Assert.*;
-import static org.apache.geode.test.dunit.IgnoredException.*;
-import static org.apache.geode.test.dunit.LogWriterUtils.*;
-import static org.apache.geode.test.dunit.Wait.*;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Random;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.geode.cache.CacheListener;
-import org.apache.geode.cache.EntryEvent;
-import org.apache.geode.cache.util.CacheListenerAdapter;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.apache.geode.test.dunit.Assert.assertEquals;
+import static org.apache.geode.test.dunit.Assert.assertFalse;
+import static org.apache.geode.test.dunit.Assert.assertNotEquals;
+import static org.apache.geode.test.dunit.Assert.assertNotNull;
+import static org.apache.geode.test.dunit.Assert.assertNotSame;
+import static org.apache.geode.test.dunit.Assert.assertTrue;
+import static org.apache.geode.test.dunit.Assert.fail;
+import static org.apache.geode.test.dunit.IgnoredException.addIgnoredException;
+import static org.apache.geode.test.dunit.LogWriterUtils.getLogWriter;
+import static org.apache.geode.test.dunit.Wait.waitForCriterion;
 
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.CacheListener;
 import org.apache.geode.cache.DataPolicy;
+import org.apache.geode.cache.EntryEvent;
 import org.apache.geode.cache.PartitionAttributes;
 import org.apache.geode.cache.PartitionAttributesFactory;
 import org.apache.geode.cache.Region;
@@ -51,6 +40,7 @@ import org.apache.geode.cache.query.QueryInvalidException;
 import org.apache.geode.cache.query.data.Portfolio;
 import org.apache.geode.cache.query.internal.CompiledValue;
 import org.apache.geode.cache.query.internal.QCompiler;
+import org.apache.geode.cache.util.CacheListenerAdapter;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.lang.StringUtils;
@@ -84,6 +74,21 @@ import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.WaitCriterion;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.FlakyTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Random;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
 
 /**
  * Dunit class for testing gemfire data commands : get, put, remove, select, rebalance
@@ -790,7 +795,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
     // Remove empty key entry using gfsh remove command
     String command = "remove ";
 
-    command = command + " " + "--key=\"'" + key + "'\" --region=" + DATA_REGION_NAME_PATH;
+    command = command + " " + "--key=\"" + key + "\" --region=" + DATA_REGION_NAME_PATH;
     CommandResult cmdResult = executeCommand(command);
     printCommandOutput(cmdResult);
 

http://git-wip-us.apache.org/repos/asf/geode/blob/1fc0f0ca/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/HelpCommandsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/HelpCommandsIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/HelpCommandsIntegrationTest.java
deleted file mode 100644
index b91a1f3..0000000
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/HelpCommandsIntegrationTest.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.management.internal.cli.commands;
-
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.internal.AvailablePortHelper;
-import org.apache.geode.management.internal.cli.CommandManager;
-import org.apache.geode.management.internal.cli.parser.CommandTarget;
-import org.apache.geode.management.internal.cli.result.CommandResult;
-import org.apache.geode.management.internal.cli.shell.Gfsh;
-import org.apache.geode.management.internal.cli.shell.GfshConfig;
-import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.contrib.java.lang.system.ProvideSystemProperty;
-import org.junit.experimental.categories.Category;
-
-import java.util.Map;
-import java.util.Properties;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.apache.geode.management.internal.cli.commands.CliCommandTestBase.commandResultToString;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-@Category(IntegrationTest.class)
-public class HelpCommandsIntegrationTest {
-
-  private int jmxPort;
-
-  private Gfsh gfsh;
-
-  @ClassRule
-  public static final ProvideSystemProperty isGfsh = new ProvideSystemProperty("gfsh", "true");
-
-  @Before
-  public void setup() throws Exception {
-    jmxPort = AvailablePortHelper.getRandomAvailableTCPPort();
-
-    Properties localProps = new Properties();
-    localProps.setProperty(LOCATORS, "");
-    localProps.setProperty(MCAST_PORT, "0");
-    localProps.setProperty(JMX_MANAGER, "true");
-    localProps.setProperty(JMX_MANAGER_START, "true");
-    localProps.setProperty(JMX_MANAGER_PORT, String.valueOf(jmxPort));
-
-    new CacheFactory(localProps).create();
-
-    gfsh = Gfsh.getInstance(false, new String[0], new GfshConfig());
-  }
-
-  @After
-  public void teardown() {
-    InternalDistributedSystem ids = InternalDistributedSystem.getConnectedInstance();
-    if (ids != null) {
-      ids.disconnect();
-    }
-  }
-
-  /**
-   * TODO:GEODE-1466: update golden file to geode.properties
-   */
-  @Test
-  public void testOfflineHelp() throws Exception {
-    Properties helpProps = new Properties();
-    helpProps.load(
-        HelpCommandsIntegrationTest.class.getResourceAsStream("golden-help-offline.properties"));
-
-    CommandManager cm = CommandManager.getInstance();
-    for (Map.Entry<String, CommandTarget> e : cm.getCommands().entrySet()) {
-      // Mock commands may have been produced in the VM by other tests
-      // 'quit' is an alias for 'exit' and doesn't produce help
-      if (e.getKey().contains("mock") || e.getKey().contains("quit")) {
-        continue;
-      }
-
-      CommandResult cr = (CommandResult) gfsh.executeCommand("help " + e.getKey()).getResult();
-      String gfshResult = commandResultToString(cr);
-
-      String goldParam = e.getKey().replace(" ", "-") + ".help";
-      String goldResult = helpProps.getProperty(goldParam);
-      assertNotNull("No golden text for: " + goldParam, goldResult);
-      assertEquals(goldResult.trim(), gfshResult.trim());
-
-      helpProps.remove(goldParam);
-    }
-
-    // No help should remain unchecked
-    assertEquals(0, helpProps.size());
-  }
-
-  @Test
-  public void testOnlineHelp() throws Exception {
-    Properties helpProps = new Properties();
-    helpProps.load(
-        HelpCommandsIntegrationTest.class.getResourceAsStream("golden-help-online.properties"));
-
-    gfsh.executeCommand("connect --jmx-manager=localhost[" + jmxPort + "]");
-
-    CommandManager cm = CommandManager.getInstance();
-    for (Map.Entry<String, CommandTarget> e : cm.getCommands().entrySet()) {
-      // Mock commands may have been produced in the VM by other tests
-      // 'quit' is an alias for 'exit' and doesn't produce help
-      if (e.getKey().contains("mock") || e.getKey().contains("quit")) {
-        continue;
-      }
-
-      CommandResult cr = (CommandResult) gfsh.executeCommand("help " + e.getKey()).getResult();
-      String gfshResult = commandResultToString(cr);
-
-      String goldParam = e.getKey().replace(" ", "-") + ".help";
-      String goldResult = helpProps.getProperty(goldParam);
-      assertNotNull("No golden text for: " + goldParam, goldResult);
-
-      String[] lines = gfshResult.split("\n");
-      gfshResult = String.join("\n", lines[0], lines[1], lines[2], lines[3]);
-
-      assertEquals(goldResult.trim(), gfshResult.trim());
-
-      helpProps.remove(goldParam);
-    }
-
-    // No help should remain unchecked
-    assertEquals(0, helpProps.size());
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/1fc0f0ca/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/QueueCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/QueueCommandsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/QueueCommandsDUnitTest.java
index 42a0624..04a8c13 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/QueueCommandsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/QueueCommandsDUnitTest.java
@@ -193,9 +193,7 @@ public class QueueCommandsDUnitTest extends CliCommandTestBase {
     commandStringBuilder.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__LISTENER,
         "com.qcdunit.QueueCommandsDUnitTestHelper");
     commandStringBuilder.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__LISTENER_PARAM_AND_VALUE,
-        "param1");
-    commandStringBuilder.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__LISTENER_PARAM_AND_VALUE,
-        "param2#value2");
+        "param1,param2#value2");
     cmdResult = executeCommand(commandStringBuilder.toString());
     assertEquals(Result.Status.OK, cmdResult.getStatus());
     stringResult = commandResultToString(cmdResult);

http://git-wip-us.apache.org/repos/asf/geode/blob/1fc0f0ca/geode-core/src/test/java/org/apache/geode/management/internal/cli/help/HelpBlockUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/help/HelpBlockUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/help/HelpBlockUnitTest.java
new file mode 100644
index 0000000..4eb4abf
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/help/HelpBlockUnitTest.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.geode.management.internal.cli.help;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class HelpBlockUnitTest {
+  private HelpBlock firstBlock, secondBlock, thirdBlock;
+
+  @Before
+  public void before() {
+    firstBlock = new HelpBlock("First Line");
+    secondBlock = new HelpBlock("Second Line");
+    thirdBlock = new HelpBlock("Third Line");
+    assertThat(firstBlock.getLevel()).isEqualTo(0);
+    assertThat(secondBlock.getLevel()).isEqualTo(0);
+    assertThat(thirdBlock.getLevel()).isEqualTo(0);
+  }
+
+  @Test
+  public void testChildLevel() {
+    HelpBlock block = new HelpBlock();
+    assertThat(block.getLevel()).isEqualTo(-1);
+
+    firstBlock.addChild(secondBlock);
+    assertThat(firstBlock.getLevel()).isEqualTo(0);
+    assertThat(secondBlock.getLevel()).isEqualTo(1);
+
+    secondBlock.addChild(thirdBlock);
+    assertThat(firstBlock.getLevel()).isEqualTo(0);
+    assertThat(secondBlock.getLevel()).isEqualTo(1);
+    assertThat(thirdBlock.getLevel()).isEqualTo(2);
+
+    assertThat(firstBlock.getChildren()).contains(secondBlock);
+    assertThat(firstBlock.getChildren().size()).isEqualTo(1);
+    assertThat(secondBlock.getChildren()).contains(thirdBlock);
+    assertThat(secondBlock.getChildren().size()).isEqualTo(1);
+
+    // after manually set the level of the first block
+    firstBlock.setLevel(10);
+    assertThat(firstBlock.getLevel()).isEqualTo(10);
+    assertThat(firstBlock.getData()).isEqualTo("First Line");
+    assertThat(secondBlock.getLevel()).isEqualTo(11);
+    assertThat(secondBlock.getData()).isEqualTo("Second Line");
+    assertThat(thirdBlock.getLevel()).isEqualTo(12);
+    assertThat(thirdBlock.getData()).isEqualTo("Third Line");
+  }
+
+  @Test
+  public void testToString() {
+    firstBlock.addChild(secondBlock);
+    secondBlock.addChild(thirdBlock);
+
+    String result = firstBlock.toString(-1);
+    assertThat(result).isEqualTo("First Line\nSecond Line\nThird Line\n");
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/1fc0f0ca/geode-core/src/test/java/org/apache/geode/management/internal/cli/help/HelperUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/help/HelperUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/help/HelperUnitTest.java
new file mode 100644
index 0000000..82d8d71
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/help/HelperUnitTest.java
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.geode.management.internal.cli.help;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.springframework.shell.core.CommandMarker;
+import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
+@Category(UnitTest.class)
+public class HelperUnitTest {
+  private Helper helper;
+  private CliCommand cliCommand;
+  private Method method;
+  private CliAvailabilityIndicator availabilityIndicator;
+  private CommandMarker commandMarker;
+
+  private Annotation[][] annotations;
+  private CliOption cliOption;
+
+  private Class<?>[] parameterType;
+  private HelpBlock optionBlock;
+
+  @Before
+  public void before() throws Exception {
+    helper = new Helper();
+    cliCommand = mock(CliCommand.class);
+    when(cliCommand.value()).thenReturn("test,test-synonym".split(","));
+    when(cliCommand.help()).thenReturn("This is a test description");
+
+    // the tests will test with one parameter and one annotation at a time.
+    cliOption = mock(CliOption.class);
+    when(cliOption.key()).thenReturn("option".split(","));
+    when(cliOption.help()).thenReturn("help of option");
+    when(cliOption.mandatory()).thenReturn(true);
+
+    annotations = new Annotation[1][1];
+    annotations[0][0] = cliOption;
+
+    parameterType = new Class[1];
+    parameterType[0] = String.class;
+
+    availabilityIndicator = mock(CliAvailabilityIndicator.class);
+
+  }
+
+  @Test
+  public void testGetHelp() {
+    HelpBlock helpBlock = helper.getHelp(cliCommand, annotations, parameterType);
+    String[] helpLines = helpBlock.toString().split("\n");
+    assertThat(helpLines.length).isEqualTo(14);
+    assertThat(helpLines[0]).isEqualTo(Helper.NAME_NAME);
+    assertThat(helpLines[2]).isEqualTo(Helper.IS_AVAILABLE_NAME);
+    assertThat(helpLines[4]).isEqualTo(Helper.SYNONYMS_NAME);
+    assertThat(helpLines[6]).isEqualTo(Helper.SYNOPSIS_NAME);
+    assertThat(helpLines[8]).isEqualTo(Helper.SYNTAX_NAME);
+    assertThat(helpLines[10]).isEqualTo(Helper.OPTIONS_NAME);
+  }
+
+  @Test
+  public void testGetSyntaxStringWithMandatory() {
+    String syntax = helper.getSyntaxString("test", annotations, parameterType);
+    assertThat(syntax).isEqualTo("test --option=value");
+    optionBlock = helper.getOptionDetail(cliOption);
+    assertThat(optionBlock.toString())
+        .isEqualTo("option\n" + "help of option\n" + "Required: true\n");
+  }
+
+  @Test
+  public void testGetSyntaxStringWithOutMandatory() {
+    when(cliOption.mandatory()).thenReturn(false);
+    String syntax = helper.getSyntaxString("test", annotations, parameterType);
+    assertThat(syntax).isEqualTo("test [--option=value]");
+    optionBlock = helper.getOptionDetail(cliOption);
+    assertThat(optionBlock.toString())
+        .isEqualTo("option\n" + "help of option\n" + "Required: false\n");
+  }
+
+  @Test
+  public void testGetSyntaxStringWithSecondaryOptionNameIgnored() {
+    when(cliOption.key()).thenReturn("option,option2".split(","));
+    String syntax = helper.getSyntaxString("test", annotations, parameterType);
+    assertThat(syntax).isEqualTo("test --option=value");
+    optionBlock = helper.getOptionDetail(cliOption);
+    assertThat(optionBlock.toString())
+        .isEqualTo("option\n" + "help of option\n" + "Synonyms: option2\n" + "Required: true\n");
+  }
+
+  @Test
+  public void testGetSyntaxStringWithSecondaryOptionName() {
+    when(cliOption.key()).thenReturn(",option2".split(","));
+    when(cliOption.mandatory()).thenReturn(true);
+    String syntax = helper.getSyntaxString("test", annotations, parameterType);
+    assertThat(syntax).isEqualTo("test option2");
+    optionBlock = helper.getOptionDetail(cliOption);
+    assertThat(optionBlock.toString())
+        .isEqualTo("option2\n" + "help of option\n" + "Required: true\n");
+  }
+
+  @Test
+  public void testGetSyntaxStringWithOptionalSecondaryOptionName() {
+    when(cliOption.key()).thenReturn(",option2".split(","));
+    when(cliOption.mandatory()).thenReturn(false);
+    String syntax = helper.getSyntaxString("test", annotations, parameterType);
+    assertThat(syntax).isEqualTo("test [option2]");
+    optionBlock = helper.getOptionDetail(cliOption);
+    assertThat(optionBlock.toString())
+        .isEqualTo("option2\n" + "help of option\n" + "Required: false\n");
+  }
+
+  @Test
+  public void testGetSyntaxStringWithStringArray() {
+    parameterType[0] = String[].class;
+    String syntax = helper.getSyntaxString("test", annotations, parameterType);
+    assertThat(syntax).isEqualTo("test --option=value(,value)*");
+    optionBlock = helper.getOptionDetail(cliOption);
+    assertThat(optionBlock.toString())
+        .isEqualTo("option\n" + "help of option\n" + "Required: true\n");
+  }
+
+  @Test
+  public void testGetSyntaxStringWithSpecifiedDefault() {
+    when(cliOption.specifiedDefaultValue()).thenReturn("true");
+    String syntax = helper.getSyntaxString("test", annotations, parameterType);
+    assertThat(syntax).isEqualTo("test --option(=value)?");
+
+    optionBlock = helper.getOptionDetail(cliOption);
+    assertThat(optionBlock.toString()).isEqualTo("option\n" + "help of option\n"
+        + "Required: true\n" + "Default (if the parameter is specified without value): true\n");
+
+  }
+
+  @Test
+  public void testGetSyntaxStringWithDefaultAndStringArray() {
+    parameterType[0] = String[].class;
+    when(cliOption.specifiedDefaultValue()).thenReturn("value1,value2");
+    String syntax = helper.getSyntaxString("test", annotations, parameterType);
+    assertThat(syntax).isEqualTo("test --option(=value)?(,value)*");
+
+    optionBlock = helper.getOptionDetail(cliOption);
+    assertThat(optionBlock.toString())
+        .isEqualTo("option\n" + "help of option\n" + "Required: true\n"
+            + "Default (if the parameter is specified without value): value1,value2\n");
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/1fc0f0ca/geode-core/src/test/java/org/apache/geode/management/internal/cli/parser/ParserUtilsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/parser/ParserUtilsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/parser/ParserUtilsJUnitTest.java
deleted file mode 100644
index 9b22e64..0000000
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/parser/ParserUtilsJUnitTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.management.internal.cli.parser;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.test.junit.categories.UnitTest;
-
-/**
- * Includes tests for all utility methods in {@link ParserUtils}
- */
-@Category(UnitTest.class)
-public class ParserUtilsJUnitTest {
-
-  /**
-   * Test for {@link ParserUtils#split(String, String)}
-   */
-  @Test
-  public void testSplit() {
-    String input = "something::{::}::nothing";
-    String[] split = ParserUtils.split(input, "::");
-    assertEquals("Size of the split", 3, split.length);
-    assertEquals("First string", "something", split[0]);
-    assertEquals("Second string", "{::}", split[1]);
-    assertEquals("Third string", "nothing", split[2]);
-  }
-
-  /**
-   * Test for {@link ParserUtils#splitValues(String, String)}
-   */
-  @Test
-  public void testSplitValues() {
-    String input = "something::{::}::nothing::";
-    String[] split = ParserUtils.splitValues(input, "::");
-    assertEquals("Size of the split", 4, split.length);
-    assertEquals("First string", "something", split[0]);
-    assertEquals("Second string", "{::}", split[1]);
-    assertEquals("Third string", "nothing", split[2]);
-    assertEquals("Fourth string", "", split[3]);
-  }
-
-  /**
-   * Test for {@link ParserUtils#contains(String, String)}
-   */
-  @Test
-  public void testContains() {
-    String input = "something::{::}::nothing::";
-    assertTrue("Check Boolean", ParserUtils.contains(input, "::"));
-    input = "{something::{::}::nothing::}";
-    assertFalse("Check Boolean", ParserUtils.contains(input, "::"));
-  }
-
-  /**
-   * Test for {@link ParserUtils#lastIndexOf(String, String)}
-   */
-  @Test
-  public void testLastIndexOf() {
-    String input = "something::{::}::nothing::";
-    assertEquals("lastIndex", 24, ParserUtils.lastIndexOf(input, "::"));
-    input = "something::{::}::\"nothing::\"";
-    assertEquals("lastIndex", 15, ParserUtils.lastIndexOf(input, "::"));
-    input = "{something::{::}::\"nothing::\"}";
-    assertEquals("lastIndex", -1, ParserUtils.lastIndexOf(input, "::"));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/1fc0f0ca/geode-core/src/test/java/org/apache/geode/management/internal/cli/parser/preprocessor/PreprocessorJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/parser/preprocessor/PreprocessorJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/parser/preprocessor/PreprocessorJUnitTest.java
deleted file mode 100644
index 97325cb..0000000
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/parser/preprocessor/PreprocessorJUnitTest.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.management.internal.cli.parser.preprocessor;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.test.junit.categories.UnitTest;
-
-/**
- * Test for Preprocessor
- */
-@Category(UnitTest.class)
-public class PreprocessorJUnitTest {
-
-  @Test
-  public void test1Arg() {
-    String input = "arg1";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 1, split.length);
-    assertEquals("First string", "arg1", split[0]);
-  }
-
-  @Test
-  public void test2Args() {
-    String input = "arg1?arg2";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 2, split.length);
-    assertEquals("First string", "arg1", split[0]);
-    assertEquals("Second string", "arg2", split[1]);
-  }
-
-  @Test
-  public void test1SpacedArg() {
-    String input = "arg1-1 arg1-2  ";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 1, split.length);
-    assertEquals("First string", "arg1-1 arg1-2", split[0]);
-  }
-
-  @Test
-  public void test1SpacedArg1Option() {
-    String input = "arg1-1 arg1-2 --option1=value1";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 3, split.length);
-    assertEquals("First string", "arg1-1 arg1-2", split[0]);
-    assertEquals("Second string", "--option1", split[1]);
-    assertEquals("Third string", "value1", split[2]);
-  }
-
-  @Test
-  public void test1OptionNoValue() {
-    String input = "--option1";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 1, split.length);
-    assertEquals("First string", "--option1", split[0]);
-  }
-
-  @Test
-  public void test2OptionsNoValue() {
-    String input = "--option1 --option2";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 2, split.length);
-    assertEquals("First string", "--option1", split[0]);
-    assertEquals("Second string", "--option2", split[1]);
-  }
-
-  @Test
-  public void test2Options1Value() {
-    String input = "--option1=value1 --option2";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 3, split.length);
-    assertEquals("First string", "--option1", split[0]);
-    assertEquals("Second string", "value1", split[1]);
-    assertEquals("Third string", "--option2", split[2]);
-  }
-
-  @Test
-  public void test1OptionHasValue() {
-    String input = "--option1=value1";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 2, split.length);
-    assertEquals("First string", "--option1", split[0]);
-    assertEquals("Second string", "value1", split[1]);
-  }
-
-  @Test
-  public void test1Arg1OptionHasValue() {
-    String input = "arg1 --option1=value1";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 3, split.length);
-    assertEquals("First string", "arg1", split[0]);
-    assertEquals("Second string", "--option1", split[1]);
-    assertEquals("Third string", "value1", split[2]);
-  }
-
-  @Test
-  public void test1OptionMissingValue() {
-    String input = "--option1=";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 2, split.length);
-    assertEquals("First string", "--option1", split[0]);
-    assertEquals("Second string", "__NULL__", split[1]);
-  }
-
-  @Test
-  public void test2OptionsMissingFirstValue() {
-    String input = "--option1= --option2=value2";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 4, split.length);
-    assertEquals("First string", "--option1", split[0]);
-    assertEquals("Second string", "__NULL__", split[1]);
-    assertEquals("Third string", "--option2", split[2]);
-    assertEquals("Fourth string", "value2", split[3]);
-  }
-
-  @Test
-  public void testSingleQuotedArg() {
-    String input = "\'arg1-1= arg1-2\'?arg2";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 2, split.length);
-    assertEquals("First string", "\'arg1-1= arg1-2\'", split[0]);
-    assertEquals("Second string", "arg2", split[1]);
-  }
-
-  @Test
-  public void testDoubleQuotedArg() {
-    String input = "\"   \'arg1-1 =arg1-2   \"?arg2";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 2, split.length);
-    assertEquals("First string", "\"   \'arg1-1 =arg1-2   \"", split[0]);
-    assertEquals("Second string", "arg2", split[1]);
-  }
-
-  @Test
-  public void testSingleQuotedOption() {
-    String input = "--option1=\'value1-1 =value1-2\"\' --option2";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 3, split.length);
-    assertEquals("First string", "--option1", split[0]);
-    assertEquals("Second string", "\'value1-1 =value1-2\"\'", split[1]);
-    assertEquals("Third string", "--option2", split[2]);
-  }
-
-  @Test
-  public void testDoubleQuotedOption() {
-    String input = "--option1= --option2=\"value2\"";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 4, split.length);
-    assertEquals("First string", "--option1", split[0]);
-    assertEquals("Second string", "__NULL__", split[1]);
-    assertEquals("Third string", "--option2", split[2]);
-    assertEquals("Fourth string", "\"value2\"", split[3]);
-  }
-
-  @Test
-  public void testSingleQuoteInsideDoubleQuote() {
-    String input = "--option1=\"   \'  value1  \'   \"";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 2, split.length);
-    assertEquals("First string", "--option1", split[0]);
-    assertEquals("Second string", "\"   \'  value1  \'   \"", split[1]);
-  }
-
-  @Test
-  public void testQuotedStringWithAdditonalData() {
-    String input = "--option1=\"   \'  value1  \'   \",moreData,\"  even more data\"";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 2, split.length);
-    assertEquals("First string", "--option1", split[0]);
-    assertEquals("Second string", "\"   \'  value1  \'   \",moreData,\"  even more data\"",
-        split[1]);
-  }
-
-  @Test
-  public void testBadOption() {
-    String input = "--option1=value1 -option2=value2";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 4, split.length);
-    assertEquals("First string", "--option1", split[0]);
-    assertEquals("Second string", "value1", split[1]);
-    assertEquals("Third string", "-option2", split[2]);
-    assertEquals("Third string", "value2", split[3]);
-  }
-
-  @Test
-  public void testBadOptions() {
-    String input = "--option1=value1 -option3 -option4";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 4, split.length);
-    assertEquals("First string", "--option1", split[0]);
-    assertEquals("Second string", "value1", split[1]);
-    assertEquals("Third string", "-option3", split[2]);
-    assertEquals("Third string", "-option4", split[3]);
-  }
-
-  @Test
-  public void testExtraArgSpaces() {
-    String input = "   arg1?  arg2   ";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 2, split.length);
-    assertEquals("First string", "arg1", split[0]);
-    assertEquals("Second string", "arg2", split[1]);
-  }
-
-  @Test
-  public void testExtraOptionSpaces() {
-    String input = "   --option1=value1    --option2=value2   ";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 4, split.length);
-    assertEquals("First string", "--option1", split[0]);
-    assertEquals("Second string", "value1", split[1]);
-    assertEquals("Third string", "--option2", split[2]);
-    assertEquals("Fourth string", "value2", split[3]);
-  }
-
-  @Test
-  public void testExtraArgAndOptionSpaces() {
-    String input = "   arg1   --option1=value1   ";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 3, split.length);
-    assertEquals("First string", "arg1", split[0]);
-    assertEquals("Second string", "--option1", split[1]);
-    assertEquals("Third string", "value1", split[2]);
-  }
-
-  @Test
-  public void testValueSpecifierAsPartOfValue() {
-    String input = "--option1=-Dprop1=value1 --option2=-Dprop2=value2 --option3";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 5, split.length);
-    assertEquals("First string", "--option1", split[0]);
-    assertEquals("Second string", "-Dprop1=value1", split[1]);
-    assertEquals("Third string", "--option2", split[2]);
-    assertEquals("Fourth string", "-Dprop2=value2", split[3]);
-    assertEquals("Fifth string", "--option3", split[4]);
-  }
-
-  @Test
-  public void testMissingOption() {
-    String input = "--option1=value1 value2";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 3, split.length);
-    assertEquals("First string", "--option1", split[0]);
-    assertEquals("Second string", "value1", split[1]);
-    assertEquals("Third string", "value2", split[2]);
-  }
-
-  @Test
-  public void testUnclosedQuoteArg() {
-    String input = "\"arg1-1 arg1-2 --option1=value1 --option2=value2";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 1, split.length);
-    assertEquals("First string", "\"arg1-1 arg1-2 --option1=value1 --option2=value2", split[0]);
-  }
-
-  @Test
-  public void testUnclosedQuoteOption() {
-    String input = "--option1=\"value1 --option2=value2";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 2, split.length);
-    assertEquals("First string", "--option1", split[0]);
-    assertEquals("Second string", "\"value1 --option2=value2", split[1]);
-  }
-
-  @Test
-  public void testArgWithQuotedLongOptionSpec() {
-    String input = "\"--arg=value\"";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 1, split.length);
-    assertEquals("First string", "\"--arg=value\"", split[0]);
-  }
-
-  @Test
-  public void testOptionWithQuotedLongOptionSpec() {
-    String input = "--option1=\"--arg=value\"";
-    String[] split = Preprocessor.split(input);
-    assertEquals("Size of the split", 2, split.length);
-    assertEquals("First string", "--option1", split[0]);
-    assertEquals("Second", "\"--arg=value\"", split[1]);
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/1fc0f0ca/geode-core/src/test/java/org/apache/geode/management/internal/cli/parser/preprocessor/PreprocessorUtilsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/parser/preprocessor/PreprocessorUtilsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/parser/preprocessor/PreprocessorUtilsJUnitTest.java
deleted file mode 100644
index b56cff2..0000000
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/parser/preprocessor/PreprocessorUtilsJUnitTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.management.internal.cli.parser.preprocessor;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.internal.lang.SystemUtils;
-import org.apache.geode.test.junit.categories.UnitTest;
-
-/**
- * Includes tests for all utility methods in {@link PreprocessorUtils}
- */
-@Category(UnitTest.class)
-public class PreprocessorUtilsJUnitTest {
-
-  /**
-   * Test for {@link PreprocessorUtils#simpleTrim(String)}
-   */
-  @Test
-  public void testSimpleTrim() {
-    String input = " 1 2 3 ";
-    TrimmedInput simpleTrim = PreprocessorUtils.simpleTrim(input);
-    assertEquals("No of spaces removed", 1, simpleTrim.getNoOfSpacesRemoved());
-    assertEquals("input after trimming", "1 2 3", simpleTrim.getString());
-
-    input = " 1 2 3      ";
-    simpleTrim = PreprocessorUtils.simpleTrim(input);
-    assertEquals("No of spaces removed", 1, simpleTrim.getNoOfSpacesRemoved());
-    assertEquals("input after trimming", "1 2 3", simpleTrim.getString());
-  }
-
-  /**
-   * Test for {@link PreprocessorUtils#trim(String)}
-   */
-  @Test
-  public void testTrim() {
-    String input = " command argument1 argument2 ";
-    TrimmedInput trim = PreprocessorUtils.trim(input);
-    assertEquals("No of spaces removed", 1, trim.getNoOfSpacesRemoved());
-    assertEquals("input after trimming", "command argument1 argument2", trim.getString());
-
-    input = "   command   argument1   argument2 ";
-    trim = PreprocessorUtils.trim(input);
-    assertEquals("No of spaces removed", 7, trim.getNoOfSpacesRemoved());
-    assertEquals("input after trimming", "command argument1 argument2", trim.getString());
-
-    input = "command argument1 argument2 -- -- - - - -- -- -- -- -- --- --------- - - - --- --";
-    trim = PreprocessorUtils.trim(input);
-    assertEquals("No of spaces removed", 0, trim.getNoOfSpacesRemoved());
-    assertEquals("input after trimming", "command argument1 argument2", trim.getString());
-
-    input = "command argument1 argument2 --";
-    trim = PreprocessorUtils.trim(input);
-    assertEquals("No of spaces removed", 0, trim.getNoOfSpacesRemoved());
-    assertEquals("input after trimming", "command argument1 argument2", trim.getString());
-
-    input = "command argument1 argument2 -";
-    trim = PreprocessorUtils.trim(input);
-    assertEquals("No of spaces removed", 0, trim.getNoOfSpacesRemoved());
-    assertEquals("input after trimming", "command argument1 argument2", trim.getString());
-  }
-
-  /**
-   * Test for {@link PreprocessorUtils#removeWhiteSpaces(String)}
-   */
-  @Test
-  public void testRemoveWhiteSpaces() {
-    String input = "1 2 3   ";
-    String output = PreprocessorUtils.removeWhiteSpaces(input);
-    assertEquals("Output after removing white spaces", "123", output);
-  }
-
-  /**
-   * Test for {@link PreprocessorUtils#isSyntaxValid(String)}
-   */
-  @Test
-  public void testIsSyntaxValid() {
-    assertTrue(PreprocessorUtils.isSyntaxValid("{}"));
-    assertFalse(PreprocessorUtils.isSyntaxValid("{{]}"));
-    assertTrue(PreprocessorUtils.isSyntaxValid("\"\""));
-    assertTrue(PreprocessorUtils.isSyntaxValid("\"{\'[]\'}\""));
-    assertFalse(PreprocessorUtils.isSyntaxValid("{\"}\""));
-  }
-
-  /**
-   * Test for {@link PreprocessorUtils#containsOnlyWhiteSpaces(String)}
-   */
-  @Test
-  public void testContainsOnlyWhiteSpaces() {
-    assertTrue(PreprocessorUtils
-        .containsOnlyWhiteSpaces("                                                  "));
-    assertFalse(PreprocessorUtils.containsOnlyWhiteSpaces("              d       "));
-  }
-
-  /**
-   * Test for {@link PreprocessorUtils#isWhitespace(char)}
-   */
-  @Test
-  public void testIsWhitespace() {
-    assertTrue(PreprocessorUtils.isWhitespace(' '));
-    assertTrue(PreprocessorUtils.isWhitespace('\t'));
-    assertTrue(PreprocessorUtils.isWhitespace('\n'));
-    assertEquals(SystemUtils.isWindows(), PreprocessorUtils.isWhitespace('\r'));
-  }
-
-}


Mime
View raw message