geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinmeil...@apache.org
Subject [geode] branch develop updated: GEODE-1897: refactor GfshParseResult for easy access of converted opt… (#961)
Date Mon, 23 Oct 2017 15:35:41 GMT
This is an automated email from the ASF dual-hosted git repository.

jinmeiliao pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 0e21c08  GEODE-1897: refactor GfshParseResult for easy access of converted opt… (#961)
0e21c08 is described below

commit 0e21c088ac2bb76dbce77afc162a34e235137c6f
Author: jinmeiliao <jiliao@pivotal.io>
AuthorDate: Mon Oct 23 08:35:39 2017 -0700

    GEODE-1897: refactor GfshParseResult for easy access of converted opt… (#961)
    
    * GEODE-1897: refactor GfshParseResult for easy access of converted option value
    
    * fix test errors
---
 .../management/internal/cli/CommandRequest.java    |   5 -
 .../management/internal/cli/GfshParseResult.java   |  39 ++---
 .../cli/commands/AlterRuntimeConfigCommand.java    |   3 +-
 .../cli/commands/ChangeLogLevelCommand.java        |   4 +-
 .../cli/commands/DestroyFunctionCommand.java       |  23 ++-
 .../cli/commands/ExecuteFunctionCommand.java       |   8 +-
 .../internal/cli/commands/ExportConfigCommand.java |   4 +-
 .../ExportImportClusterConfigurationCommands.java  |   8 +-
 .../cli/commands/ExportLogsInterceptor.java        |  34 ++---
 .../internal/cli/commands/ShowMetricsCommand.java  |   8 +-
 .../internal/cli/CommandRequestTest.java           | 162 ---------------------
 .../internal/cli/GfshParserConverterTest.java      |  10 +-
 .../internal/cli/GfshParserParsingTest.java        | 112 +++++++-------
 .../internal/cli/OptionAliasesParsingTest.java     |  12 +-
 .../commands/ExportLogsInterceptorJUnitTest.java   |  36 +++--
 .../cli/commands/LogLevelInterceptorTest.java      |  21 ++-
 16 files changed, 152 insertions(+), 337 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/CommandRequest.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/CommandRequest.java
index 2b19e6a..cd991f7 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/CommandRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/CommandRequest.java
@@ -88,9 +88,4 @@ public class CommandRequest {
   public String getUserInput() {
     return getParseResult().getUserInput();
   }
-
-  @TestingOnly
-  public Map<String, String> getParameters() {
-    return getParseResult().getParamValueStrings();
-  }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/GfshParseResult.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/GfshParseResult.java
index 0efea21..8e3a58d 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/GfshParseResult.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/GfshParseResult.java
@@ -16,7 +16,6 @@ package org.apache.geode.management.internal.cli;
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -45,7 +44,7 @@ import org.apache.geode.management.internal.cli.shell.OperationInvoker;
 public class GfshParseResult extends ParseResult {
   private String userInput;
   private String commandName;
-  private Map<String, String> paramValueStringMap = new HashMap<>();
+  private Map<String, Object> paramValueMap = new HashMap<>();
 
   /**
    * Creates a GfshParseResult instance to represent parsing outcome.
@@ -76,16 +75,16 @@ public class GfshParseResult extends ParseResult {
 
       CliOption cliOption = getCliOption(parameterAnnotations, i);
 
+      // this maps are used for easy access of option values.
+      // It's used in tests and validation of option values in pre-execution
+      paramValueMap.put(cliOption.key()[0], argument);
+
       String argumentAsString;
       if (argument instanceof Object[]) {
         argumentAsString = StringUtils.join((Object[]) argument, ",");
       } else {
         argumentAsString = argument.toString();
       }
-
-      // this maps are used for easy access of option values in String form.
-      // It's used in tests and validation of option values in pre-execution
-      paramValueStringMap.put(cliOption.key()[0], argumentAsString);
     }
   }
 
@@ -96,20 +95,24 @@ public class GfshParseResult extends ParseResult {
     return userInput;
   }
 
-  /**
-   * Used only in tests and command pre-execution for validating arguments
-   */
-  public String getParamValue(String param) {
-    return paramValueStringMap.get(param);
+  public Object getParamValue(String param) {
+    return paramValueMap.get(param);
   }
 
-  /**
-   * Used only in tests and command pre-execution for validating arguments
-   * 
-   * @return the unmodifiable paramValueStringMap
-   */
-  public Map<String, String> getParamValueStrings() {
-    return Collections.unmodifiableMap(paramValueStringMap);
+
+  public String getParamValueAsString(String param) {
+    Object argument = paramValueMap.get(param);
+    if (argument == null) {
+      return null;
+    }
+
+    String argumentAsString;
+    if (argument instanceof Object[]) {
+      argumentAsString = StringUtils.join((Object[]) argument, ",");
+    } else {
+      argumentAsString = argument.toString();
+    }
+    return argumentAsString;
   }
 
   public String getCommandName() {
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AlterRuntimeConfigCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AlterRuntimeConfigCommand.java
index 3b75977..f3c5cd4 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AlterRuntimeConfigCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AlterRuntimeConfigCommand.java
@@ -234,9 +234,8 @@ public class AlterRuntimeConfigCommand implements GfshCommand {
   public static class AlterRuntimeInterceptor extends AbstractCliAroundInterceptor {
     @Override
     public Result preExecution(GfshParseResult parseResult) {
-      Map<String, String> arguments = parseResult.getParamValueStrings();
       // validate log level
-      String logLevel = arguments.get("log-level");
+      String logLevel = parseResult.getParamValueAsString("log-level");
       if (StringUtils.isNotBlank(logLevel) && (LogLevel.getLevel(logLevel) == null)) {
         return ResultBuilder.createUserErrorResult("Invalid log level: " + logLevel);
       }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ChangeLogLevelCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ChangeLogLevelCommand.java
index ba21893..03ba084 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ChangeLogLevelCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ChangeLogLevelCommand.java
@@ -15,7 +15,6 @@
 
 package org.apache.geode.management.internal.cli.commands;
 
-import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -152,9 +151,8 @@ public class ChangeLogLevelCommand implements GfshCommand {
   public static class ChangeLogLevelCommandInterceptor extends AbstractCliAroundInterceptor {
     @Override
     public Result preExecution(GfshParseResult parseResult) {
-      Map<String, String> arguments = parseResult.getParamValueStrings();
       // validate log level
-      String logLevel = arguments.get("loglevel");
+      String logLevel = parseResult.getParamValueAsString("loglevel");
       if (StringUtils.isBlank(logLevel) || LogLevel.getLevel(logLevel) == null) {
         return ResultBuilder.createUserErrorResult("Invalid log level: " + logLevel);
       }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyFunctionCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyFunctionCommand.java
index 9d85957..f36c154 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyFunctionCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyFunctionCommand.java
@@ -18,7 +18,6 @@ package org.apache.geode.management.internal.cli.commands;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 
 import org.springframework.shell.core.annotation.CliCommand;
@@ -139,24 +138,22 @@ public class DestroyFunctionCommand implements GfshCommand {
   public static class Interceptor extends AbstractCliAroundInterceptor {
     @Override
     public Result preExecution(GfshParseResult parseResult) {
-      Map<String, String> paramValueMap = parseResult.getParamValueStrings();
-      paramValueMap.entrySet();
-      String onGroup = paramValueMap.get(CliStrings.GROUP);
-      String onMember = paramValueMap.get(CliStrings.MEMBER);
+      String onGroup = parseResult.getParamValueAsString(CliStrings.GROUP);
+      String onMember = parseResult.getParamValueAsString(CliStrings.MEMBER);
+
+      String functionId = parseResult.getParamValueAsString(CliStrings.DESTROY_FUNCTION__ID);
 
       if ((onGroup == null && onMember == null)) {
-        Response response = readYesNo("Do you really want to destroy "
-            + paramValueMap.get(CliStrings.DESTROY_FUNCTION__ID) + " on entire DS?", Response.NO);
+        Response response = readYesNo(
+            "Do you really want to destroy " + functionId + " on entire DS?", Response.NO);
         if (response == Response.NO) {
-          return ResultBuilder.createShellClientAbortOperationResult(
-              "Aborted destroy of " + paramValueMap.get(CliStrings.DESTROY_FUNCTION__ID));
-        } else {
           return ResultBuilder
-              .createInfoResult("Destroying " + paramValueMap.get(CliStrings.DESTROY_FUNCTION__ID));
+              .createShellClientAbortOperationResult("Aborted destroy of " + functionId);
+        } else {
+          return ResultBuilder.createInfoResult("Destroying " + functionId);
         }
       } else {
-        return ResultBuilder
-            .createInfoResult("Destroying " + paramValueMap.get(CliStrings.DESTROY_FUNCTION__ID));
+        return ResultBuilder.createInfoResult("Destroying " + functionId);
       }
     }
   }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExecuteFunctionCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExecuteFunctionCommand.java
index c5a0e78..057edec 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExecuteFunctionCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExecuteFunctionCommand.java
@@ -94,10 +94,10 @@ public class ExecuteFunctionCommand implements GfshCommand {
   public static class ExecuteFunctionCommandInterceptor implements CliAroundInterceptor {
     @Override
     public Result preExecution(GfshParseResult parseResult) {
-      String onRegion = parseResult.getParamValue(CliStrings.EXECUTE_FUNCTION__ONREGION);
-      String onMember = parseResult.getParamValue(CliStrings.MEMBER);
-      String onGroup = parseResult.getParamValue(CliStrings.GROUP);
-      String filter = parseResult.getParamValue(CliStrings.EXECUTE_FUNCTION__FILTER);
+      String onRegion = parseResult.getParamValueAsString(CliStrings.EXECUTE_FUNCTION__ONREGION);
+      String onMember = parseResult.getParamValueAsString(CliStrings.MEMBER);
+      String onGroup = parseResult.getParamValueAsString(CliStrings.GROUP);
+      String filter = parseResult.getParamValueAsString(CliStrings.EXECUTE_FUNCTION__FILTER);
 
       boolean moreThanOne =
           Stream.of(onRegion, onMember, onGroup).filter(Objects::nonNull).count() > 1;
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportConfigCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportConfigCommand.java
index 5482afe..a5e7f87 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportConfigCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportConfigCommand.java
@@ -18,7 +18,6 @@ import java.io.File;
 import java.io.IOException;
 import java.nio.file.Path;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 
 import org.apache.commons.lang.StringUtils;
@@ -103,8 +102,7 @@ public class ExportConfigCommand implements GfshCommand {
 
     @Override
     public Result preExecution(GfshParseResult parseResult) {
-      Map<String, String> paramValueMap = parseResult.getParamValueStrings();
-      String dir = paramValueMap.get("dir");
+      String dir = parseResult.getParamValueAsString("dir");
       if (StringUtils.isBlank(dir)) {
         saveDirString = new File(".").getAbsolutePath();
         return ResultBuilder.createInfoResult("OK");
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportImportClusterConfigurationCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportImportClusterConfigurationCommands.java
index 133f596..8d24250 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportImportClusterConfigurationCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportImportClusterConfigurationCommands.java
@@ -24,7 +24,6 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.Collection;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 
 import org.apache.commons.io.FileUtils;
@@ -229,8 +228,7 @@ public class ExportImportClusterConfigurationCommands implements GfshCommand {
 
     @Override
     public Result preExecution(GfshParseResult parseResult) {
-      Map<String, String> paramValueMap = parseResult.getParamValueStrings();
-      String zip = paramValueMap.get(CliStrings.EXPORT_SHARED_CONFIG__FILE);
+      String zip = parseResult.getParamValueAsString(CliStrings.EXPORT_SHARED_CONFIG__FILE);
 
       if (!zip.endsWith(".zip")) {
         return ResultBuilder
@@ -259,9 +257,7 @@ public class ExportImportClusterConfigurationCommands implements GfshCommand {
   public static class ImportInterceptor extends AbstractCliAroundInterceptor {
 
     public Result preExecution(GfshParseResult parseResult) {
-      Map<String, String> paramValueMap = parseResult.getParamValueStrings();
-
-      String zip = paramValueMap.get(CliStrings.IMPORT_SHARED_CONFIG__ZIP);
+      String zip = parseResult.getParamValueAsString(CliStrings.IMPORT_SHARED_CONFIG__ZIP);
 
       zip = StringUtils.trim(zip);
 
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportLogsInterceptor.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportLogsInterceptor.java
index 5f21848..5f13784 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportLogsInterceptor.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportLogsInterceptor.java
@@ -14,8 +14,16 @@
  */
 package org.apache.geode.management.internal.cli.commands;
 
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.time.LocalDateTime;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
+import org.apache.logging.log4j.Logger;
+
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.logging.log4j.LogLevel;
 import org.apache.geode.management.cli.Result;
@@ -23,15 +31,6 @@ import org.apache.geode.management.internal.cli.AbstractCliAroundInterceptor;
 import org.apache.geode.management.internal.cli.GfshParseResult;
 import org.apache.geode.management.internal.cli.functions.ExportLogsFunction;
 import org.apache.geode.management.internal.cli.result.ResultBuilder;
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Logger;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.time.LocalDateTime;
-import java.util.Map;
 
 /**
  * after the export logs, will need to copy the tempFile to the desired location and delete the temp
@@ -42,23 +41,22 @@ public class ExportLogsInterceptor extends AbstractCliAroundInterceptor {
 
   @Override
   public Result preExecution(GfshParseResult parseResult) {
-    // the arguments are in the order of it's being declared
-    Map<String, String> arguments = parseResult.getParamValueStrings();
 
     // validates groupId and memberIds not both set
-    if (arguments.get("group") != null && arguments.get("member") != null) {
+    if (parseResult.getParamValueAsString("group") != null
+        && parseResult.getParamValueAsString("member") != null) {
       return ResultBuilder.createUserErrorResult("Can't specify both group and member.");
     }
 
     // validate log level
-    String logLevel = arguments.get("log-level");
+    String logLevel = parseResult.getParamValueAsString("log-level");
     if (StringUtils.isBlank(logLevel) || LogLevel.getLevel(logLevel) == null) {
       return ResultBuilder.createUserErrorResult("Invalid log level: " + logLevel);
     }
 
     // validate start date and end date
-    String start = arguments.get("start-time");
-    String end = arguments.get("end-time");
+    String start = parseResult.getParamValueAsString("start-time");
+    String end = parseResult.getParamValueAsString("end-time");
     if (start != null && end != null) {
       // need to make sure end is later than start
       LocalDateTime startTime = ExportLogsFunction.parseTime(start);
@@ -69,8 +67,8 @@ public class ExportLogsInterceptor extends AbstractCliAroundInterceptor {
     }
 
     // validate onlyLogs and onlyStats
-    boolean onlyLogs = Boolean.parseBoolean(arguments.get("logs-only"));
-    boolean onlyStats = Boolean.parseBoolean(arguments.get("stats-only"));
+    boolean onlyLogs = (boolean) parseResult.getParamValue("logs-only");
+    boolean onlyStats = (boolean) parseResult.getParamValue("stats-only");
     if (onlyLogs && onlyStats) {
       return ResultBuilder.createUserErrorResult("logs-only and stats-only can't both be true");
     }
@@ -83,7 +81,7 @@ public class ExportLogsInterceptor extends AbstractCliAroundInterceptor {
     // in the command over http case, the command result is in the downloaded temp file
     if (tempFile != null) {
       Path dirPath;
-      String dirName = parseResult.getParamValueStrings().get("dir");
+      String dirName = parseResult.getParamValueAsString("dir");
       if (StringUtils.isBlank(dirName)) {
         dirPath = Paths.get(System.getProperty("user.dir")).toAbsolutePath();
       } else {
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShowMetricsCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShowMetricsCommand.java
index c26c97e..74f88ce 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShowMetricsCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShowMetricsCommand.java
@@ -110,14 +110,14 @@ public class ShowMetricsCommand implements GfshCommand {
   public static class Interceptor extends AbstractCliAroundInterceptor {
     @Override
     public Result preExecution(GfshParseResult parseResult) {
-      String export_to_report_to = parseResult.getParamValue(CliStrings.SHOW_METRICS__FILE);
+      String export_to_report_to = parseResult.getParamValueAsString(CliStrings.SHOW_METRICS__FILE);
       if (export_to_report_to != null && !export_to_report_to.endsWith(".csv")) {
         return ResultBuilder
             .createUserErrorResult(CliStrings.format(CliStrings.INVALID_FILE_EXTENSION, ".csv"));
       }
 
-      String regionName = parseResult.getParamValue(CliStrings.SHOW_METRICS__REGION);
-      String port = parseResult.getParamValue(CliStrings.SHOW_METRICS__CACHESERVER__PORT);
+      String regionName = parseResult.getParamValueAsString(CliStrings.SHOW_METRICS__REGION);
+      String port = parseResult.getParamValueAsString(CliStrings.SHOW_METRICS__CACHESERVER__PORT);
 
       if (port != null) {
         try {
@@ -132,7 +132,7 @@ public class ShowMetricsCommand implements GfshCommand {
             CliStrings.SHOW_METRICS__CANNOT__USE__REGION__WITH__CACHESERVERPORT);
       }
 
-      String member = parseResult.getParamValue(CliStrings.MEMBER);
+      String member = parseResult.getParamValueAsString(CliStrings.MEMBER);
       if (port != null && member == null) {
         return ResultBuilder
             .createUserErrorResult(CliStrings.SHOW_METRICS__CANNOT__USE__CACHESERVERPORT);
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/CommandRequestTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/CommandRequestTest.java
deleted file mode 100644
index 79d1b6d..0000000
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/CommandRequestTest.java
+++ /dev/null
@@ -1,162 +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.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.management.internal.cli.commands.RebalanceCommand;
-import org.apache.geode.test.junit.categories.UnitTest;
-
-@Category(UnitTest.class)
-public class CommandRequestTest {
-
-  private Map<String, String> paramValues;
-  private GfshParseResult mockParseResult;
-  private Map<String, String> mockEnvironment;
-  private CommandRequest commandRequest;
-
-  @Before
-  public void setUp() throws Exception {
-    this.paramValues = new HashMap<>();
-
-    this.mockParseResult = mock(GfshParseResult.class);
-    when(this.mockParseResult.getUserInput()).thenReturn("rebalance --simulate=true --time-out=-1");
-    when(this.mockParseResult.getParamValueStrings()).thenReturn(this.paramValues);
-    when(this.mockParseResult.getMethod()).thenReturn(RebalanceCommand.class.getMethod("rebalance",
-        String[].class, String[].class, long.class, boolean.class));
-
-    this.mockEnvironment = new HashMap<>();
-    this.commandRequest = new CommandRequest(this.mockParseResult, this.mockEnvironment, null);
-  }
-
-  @Test
-  public void getParametersRemovesQuotesAroundNegativeNumbers() {
-    String key = "time-out";
-    String value = "\"-1\"";
-    this.paramValues.put(key, value);
-
-    Map<String, String> parameters = this.commandRequest.getParameters();
-    assertThat(parameters).containsKey(key);
-    assertThat(parameters.get(key)).isEqualTo(value);
-  }
-
-  @Test
-  public void getParametersWithNullValue() {
-    String key = "key-with-null-value";
-    String value = null;
-    this.paramValues.put(key, value);
-
-    Map<String, String> parameters = this.commandRequest.getParameters();
-    assertThat(parameters).containsKey(key);
-    assertThat(parameters.get(key)).isNull();
-  }
-
-  @Test
-  public void getParametersWithEmptyValue() {
-    String key = "key-with-empty-value";
-    String value = "";
-    this.paramValues.put(key, value);
-
-    Map<String, String> parameters = this.commandRequest.getParameters();
-    assertThat(parameters).containsKey(key);
-    assertThat(parameters.get(key)).isEmpty();
-  }
-
-  @Test
-  public void getParametersWithEmptyQuotesValue() {
-    String key = "key-with-empty-quotes-value";
-    String value = "\"\"";
-    this.paramValues.put(key, value);
-
-    Map<String, String> parameters = this.commandRequest.getParameters();
-    assertThat(parameters).containsKey(key);
-    assertThat(parameters.get(key)).isEqualTo(value);
-  }
-
-  @Test
-  public void getParametersWithNumberValue() {
-    String key = "key-with-number-value";
-    String value = "1";
-    this.paramValues.put(key, value);
-
-    Map<String, String> parameters = this.commandRequest.getParameters();
-    assertThat(parameters).containsKey(key);
-    assertThat(parameters.get(key)).isEqualTo(value);
-  }
-
-  @Test
-  public void getParametersWithNegativeNumberValue() {
-    String key = "key-with-negative-number-value";
-    String value = "-1";
-    this.paramValues.put(key, value);
-
-    Map<String, String> parameters = this.commandRequest.getParameters();
-    assertThat(parameters).containsKey(key);
-    assertThat(parameters.get(key)).isEqualTo(value);
-  }
-
-  @Test
-  public void getParametersWithHyphenAlphaValue() {
-    String key = "key-with-hyphen-alpha-value";
-    String value = "-A";
-    this.paramValues.put(key, value);
-
-    Map<String, String> parameters = this.commandRequest.getParameters();
-    assertThat(parameters).containsKey(key);
-    assertThat(parameters.get(key)).isEqualTo(value);
-  }
-
-  @Test
-  public void getParametersWithHyphenHyphenNumberValue() {
-    String key = "key-with-hyphen-alpha-value";
-    String value = "--1";
-    this.paramValues.put(key, value);
-
-    Map<String, String> parameters = this.commandRequest.getParameters();
-    assertThat(parameters).containsKey(key);
-    assertThat(parameters.get(key)).isEqualTo(value);
-  }
-
-  @Test
-  public void getParametersWithQuotesAndMoreValue() {
-    String key = "key-with-hyphen-alpha-value";
-    String value = "\"-1 this is giberish\"";
-    this.paramValues.put(key, value);
-
-    Map<String, String> parameters = this.commandRequest.getParameters();
-    assertThat(parameters).containsKey(key);
-    assertThat(parameters.get(key)).isEqualTo(value);
-  }
-
-  @Test
-  public void getParametersWithLotsaQuotesValue() {
-    String key = "key-with-hyphen-alpha-value";
-    String value = "\"\"-1\"\"";
-    this.paramValues.put(key, value);
-
-    Map<String, String> parameters = this.commandRequest.getParameters();
-    assertThat(parameters).containsKey(key);
-    assertThat(parameters.get(key)).isEqualTo(value);
-  }
-}
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/GfshParserConverterTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/GfshParserConverterTest.java
index ead4734..7c0f683 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/GfshParserConverterTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/GfshParserConverterTest.java
@@ -32,8 +32,8 @@ import org.apache.geode.management.internal.cli.converters.DiskStoreNameConverte
 import org.apache.geode.management.internal.cli.converters.FilePathConverter;
 import org.apache.geode.management.internal.cli.converters.FilePathStringConverter;
 import org.apache.geode.management.internal.cli.converters.RegionPathConverter;
-import org.apache.geode.test.junit.rules.GfshParserRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.apache.geode.test.junit.rules.GfshParserRule;
 
 @Category(IntegrationTest.class)
 public class GfshParserConverterTest {
@@ -48,7 +48,7 @@ public class GfshParserConverterTest {
     String command = "create disk-store --name=foo --dir=bar";
     GfshParseResult result = parser.parse(command);
     assertThat(result).isNotNull();
-    assertThat(result.getParamValue("dir")).isEqualTo("bar");
+    assertThat(result.getParamValueAsString("dir")).isEqualTo("bar");
   }
 
   @Test
@@ -56,7 +56,7 @@ public class GfshParserConverterTest {
     String command = "compact offline-disk-store --name=foo --disk-dirs=bar";
     GfshParseResult result = parser.parse(command);
     assertThat(result).isNotNull();
-    assertThat(result.getParamValue("disk-dirs")).isEqualTo("bar");
+    assertThat(result.getParamValueAsString("disk-dirs")).isEqualTo("bar");
   }
 
   @Test
@@ -77,7 +77,7 @@ public class GfshParserConverterTest {
         + "--dir=/testCreateDiskStore1.1#1452637463,/testCreateDiskStore1.2";
     GfshParseResult result = parser.parse(command);
     assertThat(result).isNotNull();
-    assertThat(result.getParamValue("dir"))
+    assertThat(result.getParamValueAsString("dir"))
         .isEqualTo("/testCreateDiskStore1.1#1452637463,/testCreateDiskStore1.2");
   }
 
@@ -86,7 +86,7 @@ public class GfshParserConverterTest {
     String command = "remove  --key=\"\" --region=/GemfireDataCommandsTestRegion";
     GfshParseResult result = parser.parse(command);
     assertThat(result).isNotNull();
-    assertThat(result.getParamValue("key")).isEqualTo("");
+    assertThat(result.getParamValueAsString("key")).isEqualTo("");
   }
 
   @Test
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/GfshParserParsingTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/GfshParserParsingTest.java
index 38e4118..6d18a23 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/GfshParserParsingTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/GfshParserParsingTest.java
@@ -17,8 +17,6 @@ package org.apache.geode.management.internal.cli;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.Assert.assertEquals;
 
-import java.util.Map;
-
 import org.junit.ClassRule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -35,19 +33,15 @@ public class GfshParserParsingTest {
   private String buffer;
 
 
-  private Map<String, String> parseParams(String input, String commandMethod) {
+  private GfshParseResult parseParams(String input, String commandMethod) {
     ParseResult parseResult = parser.parse(input);
 
     GfshParseResult gfshParseResult = (GfshParseResult) parseResult;
-    Map<String, String> params = gfshParseResult.getParamValueStrings();
-    for (String param : params.keySet()) {
-      System.out.println(param + "=" + params.get(param));
-    }
 
     assertThat(gfshParseResult.getMethod().getName()).isEqualTo(commandMethod);
     assertThat(gfshParseResult.getUserInput()).isEqualTo(input.trim());
 
-    return params;
+    return gfshParseResult;
   }
 
   @Test
@@ -152,96 +146,100 @@ public class GfshParserParsingTest {
   public void testParseOptionStartsWithHyphenWithoutQuotes() throws Exception {
     String input =
         "rebalance --exclude-region=/GemfireDataCommandsDUnitTestRegion2 --simulate=true --time-out=-1";
-    Map<String, String> params = parseParams(input, "rebalance");
-    assertThat(params.get("exclude-region")).isEqualTo("/GemfireDataCommandsDUnitTestRegion2");
-    assertThat(params.get("simulate")).isEqualTo("true");
-    assertThat(params.get("time-out")).isEqualTo("-1");
+    GfshParseResult result = parseParams(input, "rebalance");
+    assertThat(result.getParamValueAsString("exclude-region"))
+        .isEqualTo("/GemfireDataCommandsDUnitTestRegion2");
+    assertThat(result.getParamValueAsString("simulate")).isEqualTo("true");
+    assertThat(result.getParamValueAsString("time-out")).isEqualTo("-1");
   }
 
   @Test
   public void testParseOptionStartsWithHyphenWithQuotes() throws Exception {
     String input =
         "rebalance --exclude-region=/GemfireDataCommandsDUnitTestRegion2 --simulate=true --time-out=\"-1\"";
-    Map<String, String> params = parseParams(input, "rebalance");
+    GfshParseResult result = parseParams(input, "rebalance");
 
-    assertThat(params.get("exclude-region")).isEqualTo("/GemfireDataCommandsDUnitTestRegion2");
-    assertThat(params.get("simulate")).isEqualTo("true");
-    assertThat(params.get("time-out")).isEqualTo("-1");
+    assertThat(result.getParamValueAsString("exclude-region"))
+        .isEqualTo("/GemfireDataCommandsDUnitTestRegion2");
+    assertThat(result.getParamValueAsString("simulate")).isEqualTo("true");
+    assertThat(result.getParamValueAsString("time-out")).isEqualTo("-1");
   }
 
   @Test
   public void testParseOptionContainingHyphen() throws Exception {
     String input = "rebalance --exclude-region=/The-Region --simulate=true";
-    Map<String, String> params = parseParams(input, "rebalance");
+    GfshParseResult result = parseParams(input, "rebalance");
 
-    assertThat(params.get("exclude-region")).isEqualTo("/The-Region");
-    assertThat(params.get("simulate")).isEqualTo("true");
+    assertThat(result.getParamValueAsString("exclude-region")).isEqualTo("/The-Region");
+    assertThat(result.getParamValueAsString("simulate")).isEqualTo("true");
   }
 
   @Test
   public void testParseOptionContainingUnderscore() throws Exception {
     String input = "rebalance --exclude-region=/The_region --simulate=true";
-    Map<String, String> params = parseParams(input, "rebalance");
+    GfshParseResult result = parseParams(input, "rebalance");
 
-    assertThat(params.get("exclude-region")).isEqualTo("/The_region");
-    assertThat(params.get("simulate")).isEqualTo("true");
+    assertThat(result.getParamValueAsString("exclude-region")).isEqualTo("/The_region");
+    assertThat(result.getParamValueAsString("simulate")).isEqualTo("true");
   }
 
   @Test
   public void testParseOneJOptionWithQuotes() throws Exception {
     String input = "start locator  --J=\"-Dgemfire.http-service-port=8080\" --name=loc1";
-    Map<String, String> params = parseParams(input, "startLocator");
+    GfshParseResult result = parseParams(input, "startLocator");
 
-    assertThat(params.get("name")).isEqualTo("loc1");
-    assertThat(params.get("J")).isEqualTo("-Dgemfire.http-service-port=8080");
+    assertThat(result.getParamValueAsString("name")).isEqualTo("loc1");
+    assertThat(result.getParamValueAsString("J")).isEqualTo("-Dgemfire.http-service-port=8080");
   }
 
   @Test
   public void testParseOneJOptionWithSpaceInQuotes() throws Exception {
     String input = "start locator  --J=\"-Dgemfire.http-service-port= 8080\" --name=loc1";
-    Map<String, String> params = parseParams(input, "startLocator");
+    GfshParseResult result = parseParams(input, "startLocator");
 
-    assertThat(params.get("name")).isEqualTo("loc1");
-    assertThat(params.get("J")).isEqualTo("-Dgemfire.http-service-port= 8080");
+    assertThat(result.getParamValueAsString("name")).isEqualTo("loc1");
+    assertThat(result.getParamValueAsString("J")).isEqualTo("-Dgemfire.http-service-port= 8080");
   }
 
   @Test
   public void testParseOneJOption() throws Exception {
     String input = "start locator --J=-Dgemfire.http-service-port=8080 --name=loc1";
-    Map<String, String> params = parseParams(input, "startLocator");
+    GfshParseResult result = parseParams(input, "startLocator");
 
-    assertThat(params.get("name")).isEqualTo("loc1");
-    assertThat(params.get("J")).isEqualTo("-Dgemfire.http-service-port=8080");
+    assertThat(result.getParamValueAsString("name")).isEqualTo("loc1");
+    assertThat(result.getParamValueAsString("J")).isEqualTo("-Dgemfire.http-service-port=8080");
   }
 
   @Test
   public void testParseTwoJOptions() throws Exception {
     String input =
         "start locator --J=-Dgemfire.http-service-port=8080 --name=loc1 --J=-Ddummythinghere";
-    Map<String, String> params = parseParams(input, "startLocator");
+    GfshParseResult result = parseParams(input, "startLocator");
 
-    assertThat(params.get("name")).isEqualTo("loc1");
-    assertThat(params.get("J")).isEqualTo("-Dgemfire.http-service-port=8080,-Ddummythinghere");
+    assertThat(result.getParamValueAsString("name")).isEqualTo("loc1");
+    assertThat(result.getParamValueAsString("J"))
+        .isEqualTo("-Dgemfire.http-service-port=8080,-Ddummythinghere");
   }
 
   @Test
   public void testParseTwoJOptionsOneWithQuotesOneWithout() throws Exception {
     String input =
         "start locator --J=\"-Dgemfire.http-service-port=8080\" --name=loc1 --J=-Ddummythinghere";
-    Map<String, String> params = parseParams(input, "startLocator");
+    GfshParseResult result = parseParams(input, "startLocator");
 
-    assertThat(params.get("name")).isEqualTo("loc1");
-    assertThat(params.get("J")).isEqualTo("-Dgemfire.http-service-port=8080,-Ddummythinghere");
+    assertThat(result.getParamValueAsString("name")).isEqualTo("loc1");
+    assertThat(result.getParamValueAsString("J"))
+        .isEqualTo("-Dgemfire.http-service-port=8080,-Ddummythinghere");
   }
 
   @Test
   public void testParseOneJOptionWithQuotesAndLotsOfSpaces() throws Exception {
     String input =
         "start locator       --J=\"-Dgemfire.http-service-port=8080\"      --name=loc1         ";
-    Map<String, String> params = parseParams(input, "startLocator");
+    GfshParseResult result = parseParams(input, "startLocator");
 
-    assertThat(params.get("name")).isEqualTo("loc1");
-    assertThat(params.get("J")).isEqualTo("-Dgemfire.http-service-port=8080");
+    assertThat(result.getParamValueAsString("name")).isEqualTo("loc1");
+    assertThat(result.getParamValueAsString("J")).isEqualTo("-Dgemfire.http-service-port=8080");
   }
 
   @Test
@@ -268,28 +266,28 @@ public class GfshParserParsingTest {
     String command =
         "describe offline-disk-store --name=testDiskStore --disk-dirs=R:\\regrResults\\test";
     GfshParseResult result = parser.parse(command);
-    assertThat(result.getParamValue("disk-dirs")).isEqualTo("R:\\regrResults\\test");
+    assertThat(result.getParamValueAsString("disk-dirs")).isEqualTo("R:\\regrResults\\test");
   }
 
   @Test
   public void testCommandWithBackSlashTwo() throws Exception {
     String command = "start locator --name=\\test";
     GfshParseResult result = parser.parse(command);
-    assertThat(result.getParamValue("name")).isEqualTo("\\test");
+    assertThat(result.getParamValueAsString("name")).isEqualTo("\\test");
   }
 
   @Test
   public void testCommandWithBackSlashThree() throws Exception {
     String command = "start locator --name=\\myName";
     GfshParseResult result = parser.parse(command);
-    assertThat(result.getParamValue("name")).isEqualTo("\\myName");
+    assertThat(result.getParamValueAsString("name")).isEqualTo("\\myName");
   }
 
   @Test
   public void testCommandWithBackSlashFour() throws Exception {
     String command = "start locator --name=\\u0005Name";
     GfshParseResult result = parser.parse(command);
-    assertThat(result.getParamValue("name")).isEqualTo("\\u0005Name");
+    assertThat(result.getParamValueAsString("name")).isEqualTo("\\u0005Name");
   }
 
   @Test
@@ -297,16 +295,16 @@ public class GfshParserParsingTest {
     String command =
         "alter region --name=/Person --cache-writer='' --cache-listener='' --cache-loader=''";
     GfshParseResult result = parser.parse(command);
-    assertThat(result.getParamValue("cache-writer")).isNotNull().isEmpty();
-    assertThat(result.getParamValue("cache-listener")).isNotNull().isEmpty();
-    assertThat(result.getParamValue("cache-loader")).isNotNull().isEmpty();
+    assertThat(result.getParamValueAsString("cache-writer")).isNotNull().isEmpty();
+    assertThat(result.getParamValueAsString("cache-listener")).isNotNull().isEmpty();
+    assertThat(result.getParamValueAsString("cache-loader")).isNotNull().isEmpty();
   }
 
   @Test
   public void testValueOfJsonWithoutOuterQuoteAndSpace() throws Exception {
     String command = "put --key=('name':'id') --value=456 --region=/test";
     GfshParseResult result = parser.parse(command);
-    assertThat(result.getParamValue("key")).isEqualTo("('name':'id')");
+    assertThat(result.getParamValueAsString("key")).isEqualTo("('name':'id')");
   }
 
   @Test
@@ -321,45 +319,45 @@ public class GfshParserParsingTest {
   public void testValueOfJsonWithSpaceAndOuterQuotes() throws Exception {
     String command = "put --key=\"('name' : 'id')\" --value=456 --region=/test";
     GfshParseResult result = parser.parse(command);
-    assertThat(result.getParamValue("key")).isEqualTo("('name' : 'id')");
+    assertThat(result.getParamValueAsString("key")).isEqualTo("('name' : 'id')");
   }
 
   @Test
   public void optionValueWillNotBeTrimmedIfInQuotes() throws Exception {
     String command = "start locator --name=' test '";
     GfshParseResult result = parser.parse(command);
-    assertThat(result.getParamValue("name")).isEqualTo(" test ");
+    assertThat(result.getParamValueAsString("name")).isEqualTo(" test ");
   }
 
   @Test
   public void optionValueWithExtraSpaceInBetween() throws Exception {
     String command = "start locator --name= test    --bind-address=123";
     GfshParseResult result = parser.parse(command);
-    assertThat(result.getParamValue("name")).isEqualTo("test");
-    assertThat(result.getParamValue("bind-address")).isEqualTo("123");
+    assertThat(result.getParamValueAsString("name")).isEqualTo("test");
+    assertThat(result.getParamValueAsString("bind-address")).isEqualTo("123");
   }
 
   @Test
   public void optionValueWithEmptyString() throws Exception {
     String command = "start locator --name= --bind-address=123";
     GfshParseResult result = parser.parse(command);
-    assertThat(result.getParamValue("name")).isNull();
-    assertThat(result.getParamValue("bind-address")).isEqualTo("123");
+    assertThat(result.getParamValueAsString("name")).isNull();
+    assertThat(result.getParamValueAsString("bind-address")).isEqualTo("123");
   }
 
   @Test
   public void optionValueWithQuotedEmptyString() throws Exception {
     String command = "start locator --name='' --bind-address=123";
     GfshParseResult result = parser.parse(command);
-    assertThat(result.getParamValue("name")).isNull();
-    assertThat(result.getParamValue("bind-address")).isEqualTo("123");
+    assertThat(result.getParamValueAsString("name")).isNull();
+    assertThat(result.getParamValueAsString("bind-address")).isEqualTo("123");
   }
 
   @Test
   public void testMultiLineCommand() throws Exception {
     String command = "start server " + GfshParser.LINE_SEPARATOR + "--name=test";
     GfshParseResult result = parser.parse(command);
-    assertThat(result.getParamValue("name")).isEqualTo("test");
+    assertThat(result.getParamValueAsString("name")).isEqualTo("test");
     assertThat(result.getCommandName()).isEqualTo("start server");
   }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/OptionAliasesParsingTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/OptionAliasesParsingTest.java
index 4339b32..7005ce2 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/OptionAliasesParsingTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/OptionAliasesParsingTest.java
@@ -20,8 +20,8 @@ import org.junit.ClassRule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import org.apache.geode.test.junit.rules.GfshParserRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.apache.geode.test.junit.rules.GfshParserRule;
 
 @Category(IntegrationTest.class)
 public class OptionAliasesParsingTest {
@@ -283,10 +283,10 @@ public class OptionAliasesParsingTest {
   private void validateParsedResults(boolean canHaveMembers, boolean canHaveGroups) {
     GfshParseResult result = parser.parse(buffer);
     if (canHaveMembers) {
-      assertThat(result.getParamValue("member")).isEqualTo("m1,m2");
+      assertThat(result.getParamValueAsString("member")).isEqualTo("m1,m2");
     }
     if (canHaveGroups) {
-      assertThat(result.getParamValue("group")).isEqualTo("g1,g2");
+      assertThat(result.getParamValueAsString("group")).isEqualTo("g1,g2");
     }
   }
 
@@ -295,7 +295,7 @@ public class OptionAliasesParsingTest {
     GfshParseResult result = parser.parse(buffer);
     validateParsedResults(canHaveMembers, canHaveGroups);
     if (canHaveJars) {
-      assertThat(result.getParamValue("jar")).isEqualTo("j1,j2");
+      assertThat(result.getParamValueAsString("jar")).isEqualTo("j1,j2");
     }
   }
 
@@ -306,7 +306,7 @@ public class OptionAliasesParsingTest {
   public void gc_memberWithCommas() {
     buffer = "gc --member=m1,m2";
     GfshParseResult result = parser.parse(buffer);
-    assertThat(result.getParamValue("member")).isEqualTo("m1,m2");
+    assertThat(result.getParamValueAsString("member")).isEqualTo("m1,m2");
   }
 
   @Test
@@ -319,7 +319,7 @@ public class OptionAliasesParsingTest {
   public void destroyFunction_memberWithCommas() {
     buffer = "destroy function --id=function1 --member=m1,m2";
     GfshParseResult result = parser.parse(buffer);
-    assertThat(result.getParamValue("member")).isEqualTo("m1,m2");
+    assertThat(result.getParamValueAsString("member")).isEqualTo("m1,m2");
   }
 
   @Test
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsInterceptorJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsInterceptorJUnitTest.java
index ec8fdb6..b3bf2ff 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsInterceptorJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsInterceptorJUnitTest.java
@@ -18,63 +18,61 @@ package org.apache.geode.management.internal.cli.commands;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.when;
 
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.GfshParseResult;
-import org.apache.geode.test.junit.categories.UnitTest;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.mockito.Mockito;
 
-import java.util.HashMap;
-import java.util.Map;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.GfshParseResult;
+import org.apache.geode.test.junit.categories.UnitTest;
 
 @Category(UnitTest.class)
 public class ExportLogsInterceptorJUnitTest {
   private ExportLogsInterceptor interceptor;
   private GfshParseResult parseResult;
-  private Map<String, String> arguments;
   private Result result;
 
   @Before
   public void before() {
     interceptor = new ExportLogsInterceptor();
     parseResult = Mockito.mock(GfshParseResult.class);
-    arguments = new HashMap<>();
-    arguments.put("log-level", "info");
-    when(parseResult.getParamValueStrings()).thenReturn(arguments);
+    when(parseResult.getParamValueAsString("log-level")).thenReturn("info");
+    when(parseResult.getParamValue("logs-only")).thenReturn(true);
+    when(parseResult.getParamValue("stats-only")).thenReturn(false);
   }
 
   @Test
   public void testGroupAndMember() {
-    arguments.put("group", "group");
-    arguments.put("member", "member");
+    when(parseResult.getParamValueAsString("group")).thenReturn("group");
+    when(parseResult.getParamValueAsString("member")).thenReturn("group");
     result = interceptor.preExecution(parseResult);
     assertThat(result.nextLine()).contains("Can't specify both group and member");
   }
 
+
   @Test
   public void testStartEnd() {
-    arguments.put("start-time", "2000/01/01");
-    arguments.put("end-time", "2000/01/02");
+    when(parseResult.getParamValueAsString("start-time")).thenReturn("2000/01/01");
+    when(parseResult.getParamValueAsString("end-time")).thenReturn("2000/01/02");
     result = interceptor.preExecution(parseResult);
     assertThat(result.nextLine()).isEmpty();
 
-    arguments.put("start-time", "2000/01/02");
-    arguments.put("end-time", "2000/01/01");
+    when(parseResult.getParamValueAsString("start-time")).thenReturn("2000/01/02");
+    when(parseResult.getParamValueAsString("end-time")).thenReturn("2000/01/01");
     result = interceptor.preExecution(parseResult);
     assertThat(result.nextLine()).contains("start-time has to be earlier than end-time");
   }
 
   @Test
   public void testInclideStats() {
-    arguments.put("logs-only", "true");
-    arguments.put("stats-only", "false");
+    when(parseResult.getParamValue("logs-only")).thenReturn(true);
+    when(parseResult.getParamValue("stats-only")).thenReturn(false);
     result = interceptor.preExecution(parseResult);
     assertThat(result.nextLine()).isEmpty();
 
-    arguments.put("logs-only", "true");
-    arguments.put("stats-only", "true");
+    when(parseResult.getParamValue("logs-only")).thenReturn(true);
+    when(parseResult.getParamValue("stats-only")).thenReturn(true);
     result = interceptor.preExecution(parseResult);
     assertThat(result.nextLine()).contains("logs-only and stats-only can't both be true");
 
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/LogLevelInterceptorTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/LogLevelInterceptorTest.java
index dd9fd24..ac04a61 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/LogLevelInterceptorTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/LogLevelInterceptorTest.java
@@ -19,9 +19,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.when;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -37,7 +35,6 @@ import org.apache.geode.test.junit.categories.UnitTest;
 public class LogLevelInterceptorTest {
   private List<AbstractCliAroundInterceptor> interceptors = new ArrayList<>();
   private GfshParseResult parseResult;
-  private Map<String, String> arguments;
   private Result result;
 
   @Before
@@ -45,16 +42,16 @@ public class LogLevelInterceptorTest {
     interceptors.add(new ExportLogsInterceptor());
     interceptors.add(new AlterRuntimeConfigCommand.AlterRuntimeInterceptor());
     interceptors.add(new ChangeLogLevelCommand.ChangeLogLevelCommandInterceptor());
-
     parseResult = Mockito.mock(GfshParseResult.class);
-    arguments = new HashMap<>();
-    when(parseResult.getParamValueStrings()).thenReturn(arguments);
+    when(parseResult.getParamValue("logs-only")).thenReturn(true);
+    when(parseResult.getParamValue("stats-only")).thenReturn(false);
+
   }
 
   @Test
   public void testInvalidLogLevel() {
-    arguments.put("log-level", "test");
-    arguments.put("loglevel", "test");
+    when(parseResult.getParamValueAsString("log-level")).thenReturn("test");
+    when(parseResult.getParamValueAsString("loglevel")).thenReturn("test");
     for (AbstractCliAroundInterceptor interceptor : interceptors) {
       result = interceptor.preExecution(parseResult);
       assertThat(result.nextLine()).contains("Invalid log level: test");
@@ -63,8 +60,8 @@ public class LogLevelInterceptorTest {
 
   @Test
   public void testGeodeLogLevel() {
-    arguments.put("log-level", "fine");
-    arguments.put("loglevel", "fine");
+    when(parseResult.getParamValueAsString("log-level")).thenReturn("fine");
+    when(parseResult.getParamValueAsString("loglevel")).thenReturn("fine");
     for (AbstractCliAroundInterceptor interceptor : interceptors) {
       result = interceptor.preExecution(parseResult);
       assertThat(result.nextLine()).isEmpty();
@@ -73,8 +70,8 @@ public class LogLevelInterceptorTest {
 
   @Test
   public void testLog4JLevel() {
-    arguments.put("log-level", "trace");
-    arguments.put("loglevel", "trace");
+    when(parseResult.getParamValueAsString("log-level")).thenReturn("trace");
+    when(parseResult.getParamValueAsString("loglevel")).thenReturn("trace");
     for (AbstractCliAroundInterceptor interceptor : interceptors) {
       result = interceptor.preExecution(parseResult);
       assertThat(result.nextLine()).isEmpty();

-- 
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <commits@geode.apache.org>'].

Mime
View raw message