geode-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GEODE-1897) Users should be able to configure eviction through gfsh
Date Mon, 23 Oct 2017 15:36:01 GMT

    [ https://issues.apache.org/jira/browse/GEODE-1897?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16215307#comment-16215307 ] 

ASF GitHub Bot commented on GEODE-1897:
---------------------------------------

jinmeiliao closed pull request #961: GEODE-1897: refactor GfshParseResult for easy access of converted opt…
URL: https://github.com/apache/geode/pull/961
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 2b19e6aab7..cd991f70a0 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 @@ protected GfshParseResult getParseResult() {
   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 0efea210f7..8e3a58d589 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 @@
 
 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 @@
 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 @@ protected GfshParseResult(final Method method, final Object instance, final Obje
 
       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 String getUserInput() {
     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 3b75977db6..f3c5cd47af 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 Result alterRuntimeConfig(
   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 ba218938f4..03ba084d3f 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 Result changeLogLevel(
   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 9d85957daf..f36c15402b 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 @@
 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 @@ private Result executeFunction(InternalCache cache, Set<DistributedMember> DsMem
   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 c5a0e78fac..057edecd70 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 Result executeFunction(
   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 5482afeeb4..a5e7f87b81 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.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 Result exportConfig(
 
     @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 133f596ddd..8d2425088e 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.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 @@ private CliFunctionResult reCreateCache(DistributedMember server) {
 
     @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 Result postExecution(GfshParseResult parseResult, Result commandResult, P
   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 5f2184889d..5f1378453a 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.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 @@
 
   @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 Result preExecution(GfshParseResult parseResult) {
     }
 
     // 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 Result postExecution(GfshParseResult parseResult, Result commandResult, P
     // 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 c26c97ea39..74f88ce53e 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 Result showMetrics(
   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 Result preExecution(GfshParseResult parseResult) {
             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 79d1b6d53c..0000000000
--- 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 ead4734a9d..7c0f6838ec 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.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 void testStringArrayConverter() {
     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 void testDirConverter() {
     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 void testMultiDirValid() throws Exception {
         + "--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 void testEmptyKey() throws Exception {
     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 38e41180ad..6d18a23b01 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 @@
 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 @@
   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 void testStartJvisulvmOptionWithComma() throws Exception {
   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 void testCommandWithBackSlash() throws Exception {
     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 void testAlterRegion() throws Exception {
     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 void testValueOfJsonWithSpace() throws Exception {
   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 4339b32dd0..7005ce26cb 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.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 void alterRuntime() {
   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 @@ private void validateParsedResults(boolean canHaveMembers, boolean canHaveGroups
     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 @@ private void validateParsedResults(boolean canHaveMembers, boolean canHaveGroups
   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 void gc_onlySupportsMember_returnsNull() {
   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 ec8fdb6a5d..b3bf2ff7e8 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 @@
 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 dd9fd243e8..ac04a61a3a 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.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 @@
 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 void before() {
     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 void testInvalidLogLevel() {
 
   @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 void testGeodeLogLevel() {
 
   @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();


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Users should be able to configure eviction through gfsh
> -------------------------------------------------------
>
>                 Key: GEODE-1897
>                 URL: https://issues.apache.org/jira/browse/GEODE-1897
>             Project: Geode
>          Issue Type: Sub-task
>          Components: docs, gfsh
>            Reporter: Swapnil Bawaskar
>            Assignee: Jens Deppe
>
> While creating a region in gfsh, users should be able to configure eviction for that region.
> All three modes of eviction should be supported:
> 1. Eviction driven by the resource manager:
> {noformat}
> gfsh>create region --name=myRegion --type=REPLICATE --eviction-enabled
> {noformat}
> 2. eviction driven by entry count in the region:
> {noformat}
> gfsh>create region --name=myRegion --type=REPLICATE --eviction-entry-count=1000
> {noformat}
> 3. eviction driven by bytes used:
> {noformat}
> gfsh>create region --name=myRegion --type=REPLICATE --eviction-max-memory=100m
> {noformat}
> And also specify the eviction action as
> {noformat}
> --eviction-action=overflow-to-disk or
> --eviction-action=destroy
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message