You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by js...@apache.org on 2017/06/01 16:06:21 UTC

[3/5] geode git commit: GEODE-2966: RefactorLauncherLifecycleCommands

http://git-wip-us.apache.org/repos/asf/geode/blob/9046c8dc/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartJVisualVMCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartJVisualVMCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartJVisualVMCommand.java
new file mode 100644
index 0000000..de6522c
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartJVisualVMCommand.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.commands.lifecycle;
+
+import static org.apache.geode.internal.process.ProcessStreamReader.waitAndCaptureProcessStandardErrorStream;
+
+import org.apache.geode.GemFireException;
+import org.apache.geode.SystemFailure;
+import org.apache.geode.internal.lang.StringUtils;
+import org.apache.geode.management.cli.CliMetaData;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.GfshParser;
+import org.apache.geode.management.internal.cli.commands.GfshCommand;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.InfoResultData;
+import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.cli.util.JdkTool;
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class StartJVisualVMCommand implements GfshCommand {
+  @CliCommand(value = CliStrings.START_JVISUALVM, help = CliStrings.START_JVISUALVM__HELP)
+  @CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GEODE_MANAGER,
+      CliStrings.TOPIC_GEODE_JMX, CliStrings.TOPIC_GEODE_M_AND_M})
+  public Result startJVisualVM(
+      @CliOption(key = CliStrings.START_JCONSOLE__J, optionContext = GfshParser.J_OPTION_CONTEXT,
+          help = CliStrings.START_JCONSOLE__J__HELP) final List<String> jvmArgs) {
+    try {
+      String[] jvisualvmCommandLine = createJVisualVMCommandLine(jvmArgs);
+
+      if (isDebugging()) {
+        getGfsh().printAsInfo(
+            String.format("JVisualVM command-line (%1$s)", Arrays.toString(jvisualvmCommandLine)));
+      }
+
+      Process jvisualvmProcess = Runtime.getRuntime().exec(jvisualvmCommandLine);
+
+      getGfsh().printAsInfo(CliStrings.START_JVISUALVM__RUN);
+
+      String jvisualvmProcessOutput = waitAndCaptureProcessStandardErrorStream(jvisualvmProcess);
+
+      InfoResultData infoResultData = ResultBuilder.createInfoResultData();
+
+      if (StringUtils.isNotBlank(jvisualvmProcessOutput)) {
+        infoResultData.addLine(StringUtils.LINE_SEPARATOR);
+        infoResultData.addLine(jvisualvmProcessOutput);
+      }
+
+      return ResultBuilder.buildResult(infoResultData);
+    } catch (GemFireException | IllegalStateException | IllegalArgumentException e) {
+      return ResultBuilder.createShellClientErrorResult(e.getMessage());
+    } catch (VirtualMachineError e) {
+      SystemFailure.initiateFailure(e);
+      throw e;
+    } catch (Throwable t) {
+      SystemFailure.checkFailure();
+      return ResultBuilder.createShellClientErrorResult(
+          String.format(CliStrings.START_JVISUALVM__ERROR_MESSAGE, toString(t, false)));
+    }
+  }
+
+  protected String[] createJVisualVMCommandLine(final List<String> jvmArgs) {
+    List<String> commandLine = new ArrayList<>();
+
+    commandLine.add(JdkTool.getJVisualVMPathname());
+
+    if (jvmArgs != null) {
+      for (final String arg : jvmArgs) {
+        commandLine.add("-J" + arg);
+      }
+    }
+
+    return commandLine.toArray(new String[commandLine.size()]);
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/9046c8dc/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartPulseCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartPulseCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartPulseCommand.java
new file mode 100644
index 0000000..b5c6148
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartPulseCommand.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.commands.lifecycle;
+
+import static org.apache.geode.internal.Assert.assertState;
+
+import org.apache.geode.SystemFailure;
+import org.apache.geode.internal.lang.StringUtils;
+import org.apache.geode.management.cli.CliMetaData;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.ManagementConstants;
+import org.apache.geode.management.internal.cli.commands.GfshCommand;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.cli.shell.OperationInvoker;
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import java.awt.Desktop;
+import java.io.IOException;
+import java.net.URI;
+import javax.management.ObjectName;
+
+public class StartPulseCommand implements GfshCommand {
+
+  @CliCommand(value = CliStrings.START_PULSE, help = CliStrings.START_PULSE__HELP)
+  @CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GEODE_MANAGER,
+      CliStrings.TOPIC_GEODE_JMX, CliStrings.TOPIC_GEODE_M_AND_M})
+  public Result startPulse(@CliOption(key = CliStrings.START_PULSE__URL,
+      unspecifiedDefaultValue = "http://localhost:7070/pulse",
+      help = CliStrings.START_PULSE__URL__HELP) final String url) {
+    try {
+      if (StringUtils.isNotBlank(url)) {
+        browse(URI.create(url));
+        return ResultBuilder.createInfoResult(CliStrings.START_PULSE__RUN);
+      } else {
+        if (isConnectedAndReady()) {
+          OperationInvoker operationInvoker = getGfsh().getOperationInvoker();
+
+          ObjectName managerObjectName = (ObjectName) operationInvoker.getAttribute(
+              ManagementConstants.OBJECTNAME__DISTRIBUTEDSYSTEM_MXBEAN, "ManagerObjectName");
+
+          String pulseURL =
+              (String) operationInvoker.getAttribute(managerObjectName.toString(), "PulseURL");
+
+          if (StringUtils.isNotBlank(pulseURL)) {
+            browse(URI.create(pulseURL));
+            return ResultBuilder
+                .createInfoResult(CliStrings.START_PULSE__RUN + " with URL: " + pulseURL);
+          } else {
+            String pulseMessage = (String) operationInvoker
+                .getAttribute(managerObjectName.toString(), "StatusMessage");
+            return (StringUtils.isNotBlank(pulseMessage)
+                ? ResultBuilder.createGemFireErrorResult(pulseMessage)
+                : ResultBuilder.createGemFireErrorResult(CliStrings.START_PULSE__URL__NOTFOUND));
+          }
+        } else {
+          return ResultBuilder.createUserErrorResult(CliStrings
+              .format(CliStrings.GFSH_MUST_BE_CONNECTED_FOR_LAUNCHING_0, "GemFire Pulse"));
+        }
+      }
+    } catch (Exception e) {
+      return ResultBuilder.createShellClientErrorResult(e.getMessage());
+    } catch (VirtualMachineError e) {
+      SystemFailure.initiateFailure(e);
+      throw e;
+    } catch (Throwable t) {
+      SystemFailure.checkFailure();
+      return ResultBuilder.createShellClientErrorResult(
+          String.format(CliStrings.START_PULSE__ERROR, toString(t, false)));
+    }
+  }
+
+  private void browse(URI uri) throws IOException {
+    assertState(Desktop.isDesktopSupported(),
+        String.format(CliStrings.DESKSTOP_APP_RUN_ERROR_MESSAGE, System.getProperty("os.name")));
+    Desktop.getDesktop().browse(uri);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/9046c8dc/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartVsdCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartVsdCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartVsdCommand.java
new file mode 100644
index 0000000..d29eaa4
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartVsdCommand.java
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.commands.lifecycle;
+
+import static org.apache.geode.internal.Assert.assertState;
+import static org.apache.geode.internal.process.ProcessStreamReader.waitAndCaptureProcessStandardErrorStream;
+
+import org.apache.geode.GemFireException;
+import org.apache.geode.SystemFailure;
+import org.apache.geode.internal.lang.StringUtils;
+import org.apache.geode.internal.lang.SystemUtils;
+import org.apache.geode.internal.util.IOUtils;
+import org.apache.geode.management.cli.CliMetaData;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.commands.GfshCommand;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.InfoResultData;
+import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+public class StartVsdCommand implements GfshCommand {
+  @CliCommand(value = CliStrings.START_VSD, help = CliStrings.START_VSD__HELP)
+  @CliMetaData(shellOnly = true,
+      relatedTopic = {CliStrings.TOPIC_GEODE_M_AND_M, CliStrings.TOPIC_GEODE_STATISTICS})
+  public Result startVsd(@CliOption(key = CliStrings.START_VSD__FILE,
+      help = CliStrings.START_VSD__FILE__HELP) final String[] statisticsArchiveFilePathnames) {
+    try {
+      String geodeHome = System.getenv("GEODE_HOME");
+
+      assertState(StringUtils.isNotBlank(geodeHome), CliStrings.GEODE_HOME_NOT_FOUND_ERROR_MESSAGE);
+
+      assertState(IOUtils.isExistingPathname(getPathToVsd()),
+          String.format(CliStrings.START_VSD__NOT_FOUND_ERROR_MESSAGE, geodeHome));
+
+      String[] vsdCommandLine = createdVsdCommandLine(statisticsArchiveFilePathnames);
+
+      if (isDebugging()) {
+        getGfsh().printAsInfo(
+            String.format("GemFire VSD command-line (%1$s)", Arrays.toString(vsdCommandLine)));
+      }
+
+      Process vsdProcess = Runtime.getRuntime().exec(vsdCommandLine);
+
+      getGfsh().printAsInfo(CliStrings.START_VSD__RUN);
+
+      String vsdProcessOutput = waitAndCaptureProcessStandardErrorStream(vsdProcess);
+
+      InfoResultData infoResultData = ResultBuilder.createInfoResultData();
+
+      if (StringUtils.isNotBlank(vsdProcessOutput)) {
+        infoResultData.addLine(StringUtils.LINE_SEPARATOR);
+        infoResultData.addLine(vsdProcessOutput);
+      }
+
+      return ResultBuilder.buildResult(infoResultData);
+    } catch (GemFireException | IllegalStateException | IllegalArgumentException
+        | FileNotFoundException e) {
+      return ResultBuilder.createShellClientErrorResult(e.getMessage());
+    } catch (VirtualMachineError e) {
+      SystemFailure.initiateFailure(e);
+      throw e;
+    } catch (Throwable t) {
+      SystemFailure.checkFailure();
+      return ResultBuilder.createShellClientErrorResult(
+          String.format(CliStrings.START_VSD__ERROR_MESSAGE, toString(t, false)));
+    }
+  }
+
+  protected String[] createdVsdCommandLine(final String[] statisticsArchiveFilePathnames)
+      throws FileNotFoundException {
+    List<String> commandLine = new ArrayList<>();
+
+    commandLine.add(getPathToVsd());
+    commandLine.addAll(processStatisticsArchiveFiles(statisticsArchiveFilePathnames));
+
+    return commandLine.toArray(new String[commandLine.size()]);
+  }
+
+  protected String getPathToVsd() {
+    String vsdPathname =
+        IOUtils.appendToPath(System.getenv("GEODE_HOME"), "tools", "vsd", "bin", "vsd");
+
+    if (SystemUtils.isWindows()) {
+      vsdPathname += ".bat";
+    }
+
+    return vsdPathname;
+  }
+
+  protected Set<String> processStatisticsArchiveFiles(final String[] statisticsArchiveFilePathnames)
+      throws FileNotFoundException {
+    Set<String> statisticsArchiveFiles = new TreeSet<>();
+
+    if (statisticsArchiveFilePathnames != null) {
+      for (String pathname : statisticsArchiveFilePathnames) {
+        File path = new File(pathname);
+
+        if (path.exists()) {
+          if (path.isFile()) {
+            if (StatisticsArchiveFileFilter.INSTANCE.accept(path)) {
+              statisticsArchiveFiles.add(pathname);
+            } else {
+              throw new IllegalArgumentException(
+                  "A Statistics Archive File must end with a .gfs file extension.");
+            }
+          } else { // the File (path) is a directory
+            processStatisticsArchiveFiles(path, statisticsArchiveFiles);
+          }
+        } else {
+          throw new FileNotFoundException(String.format(
+              "The pathname (%1$s) does not exist.  Please check the path and try again.",
+              path.getAbsolutePath()));
+        }
+      }
+    }
+
+    return statisticsArchiveFiles;
+  }
+
+  @SuppressWarnings("null")
+  protected void processStatisticsArchiveFiles(final File path,
+      final Set<String> statisticsArchiveFiles) {
+    if (path != null && path.isDirectory()) {
+      for (File file : path.listFiles(StatisticsArchiveFileAndDirectoryFilter.INSTANCE)) {
+        if (file.isDirectory()) {
+          processStatisticsArchiveFiles(file, statisticsArchiveFiles);
+        } else if (StatisticsArchiveFileFilter.INSTANCE.accept(file)) {
+          statisticsArchiveFiles.add(file.getAbsolutePath());
+        }
+      }
+    }
+  }
+
+
+  protected static class StatisticsArchiveFileFilter implements FileFilter {
+
+    protected static final StatisticsArchiveFileFilter INSTANCE = new StatisticsArchiveFileFilter();
+
+    public boolean accept(final File pathname) {
+      return (pathname.isFile() && pathname.getAbsolutePath().endsWith(".gfs"));
+    }
+  }
+
+  protected static class StatisticsArchiveFileAndDirectoryFilter
+      extends StatisticsArchiveFileFilter {
+
+    protected static final StatisticsArchiveFileAndDirectoryFilter INSTANCE =
+        new StatisticsArchiveFileAndDirectoryFilter();
+
+    @Override
+    public boolean accept(final File pathname) {
+      return (pathname.isDirectory() || super.accept(pathname));
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/9046c8dc/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StatusLocatorCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StatusLocatorCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StatusLocatorCommand.java
new file mode 100644
index 0000000..eebae0d
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StatusLocatorCommand.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.commands.lifecycle;
+
+import static org.apache.geode.management.internal.cli.i18n.CliStrings.LOCATOR_TERM_NAME;
+import static org.apache.geode.management.internal.cli.shell.MXBeanProvider.getMemberMXBean;
+import static org.apache.geode.management.internal.cli.util.HostUtils.getLocatorId;
+
+import org.apache.geode.SystemFailure;
+import org.apache.geode.distributed.LocatorLauncher;
+import org.apache.geode.internal.lang.StringUtils;
+import org.apache.geode.internal.lang.SystemUtils;
+import org.apache.geode.management.MemberMXBean;
+import org.apache.geode.management.cli.CliMetaData;
+import org.apache.geode.management.cli.ConverterHint;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.commands.GfshCommand;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.InfoResultData;
+import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.configuration.utils.ClusterConfigurationStatusRetriever;
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import java.io.IOException;
+
+public class StatusLocatorCommand implements GfshCommand {
+  @CliCommand(value = CliStrings.STATUS_LOCATOR, help = CliStrings.STATUS_LOCATOR__HELP)
+  @CliMetaData(shellOnly = true,
+      relatedTopic = {CliStrings.TOPIC_GEODE_LOCATOR, CliStrings.TOPIC_GEODE_LIFECYCLE})
+  public Result statusLocator(
+      @CliOption(key = CliStrings.STATUS_LOCATOR__MEMBER,
+          optionContext = ConverterHint.LOCATOR_MEMBER_IDNAME,
+          help = CliStrings.STATUS_LOCATOR__MEMBER__HELP) final String member,
+      @CliOption(key = CliStrings.STATUS_LOCATOR__HOST,
+          help = CliStrings.STATUS_LOCATOR__HOST__HELP) final String locatorHost,
+      @CliOption(key = CliStrings.STATUS_LOCATOR__PORT,
+          help = CliStrings.STATUS_LOCATOR__PORT__HELP) final Integer locatorPort,
+      @CliOption(key = CliStrings.STATUS_LOCATOR__PID,
+          help = CliStrings.STATUS_LOCATOR__PID__HELP) final Integer pid,
+      @CliOption(key = CliStrings.STATUS_LOCATOR__DIR,
+          help = CliStrings.STATUS_LOCATOR__DIR__HELP) final String workingDirectory) {
+    try {
+      if (StringUtils.isNotBlank(member)) {
+        if (isConnectedAndReady()) {
+          final MemberMXBean locatorProxy = getMemberMXBean(member);
+
+          if (locatorProxy != null) {
+            LocatorLauncher.LocatorState state =
+                LocatorLauncher.LocatorState.fromJson(locatorProxy.status());
+            return createStatusLocatorResult(state);
+          } else {
+            return ResultBuilder.createUserErrorResult(CliStrings.format(
+                CliStrings.STATUS_LOCATOR__NO_LOCATOR_FOUND_FOR_MEMBER_ERROR_MESSAGE, member));
+          }
+        } else {
+          return ResultBuilder.createUserErrorResult(CliStrings.format(
+              CliStrings.STATUS_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, LOCATOR_TERM_NAME));
+        }
+      } else {
+        final LocatorLauncher locatorLauncher =
+            new LocatorLauncher.Builder().setCommand(LocatorLauncher.Command.STATUS)
+                .setBindAddress(locatorHost).setDebug(isDebugging()).setPid(pid)
+                .setPort(locatorPort).setWorkingDirectory(workingDirectory).build();
+
+        final LocatorLauncher.LocatorState state = locatorLauncher.status();
+        return createStatusLocatorResult(state);
+      }
+    } catch (IllegalArgumentException | IllegalStateException e) {
+      return ResultBuilder.createUserErrorResult(e.getMessage());
+    } catch (VirtualMachineError e) {
+      SystemFailure.initiateFailure(e);
+      throw e;
+    } catch (Throwable t) {
+      SystemFailure.checkFailure();
+      return ResultBuilder.createShellClientErrorResult(String.format(
+          CliStrings.STATUS_LOCATOR__GENERAL_ERROR_MESSAGE, getLocatorId(locatorHost, locatorPort),
+          StringUtils.defaultIfBlank(workingDirectory, SystemUtils.CURRENT_DIRECTORY),
+          toString(t, getGfsh().getDebug())));
+    }
+  }
+
+  protected Result createStatusLocatorResult(final LocatorLauncher.LocatorState state)
+      throws NumberFormatException, IOException, ClassNotFoundException {
+    InfoResultData infoResultData = ResultBuilder.createInfoResultData();
+    infoResultData.addLine(state.toString());
+    infoResultData.addLine(ClusterConfigurationStatusRetriever.fromLocator(state));
+    return ResultBuilder.buildResult(infoResultData);
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/9046c8dc/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StatusServerCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StatusServerCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StatusServerCommand.java
new file mode 100644
index 0000000..d8e77e6
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StatusServerCommand.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.commands.lifecycle;
+
+import static org.apache.geode.management.internal.cli.shell.MXBeanProvider.getMemberMXBean;
+
+import org.apache.geode.SystemFailure;
+import org.apache.geode.distributed.ServerLauncher;
+import org.apache.geode.internal.lang.StringUtils;
+import org.apache.geode.management.MemberMXBean;
+import org.apache.geode.management.cli.CliMetaData;
+import org.apache.geode.management.cli.ConverterHint;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.commands.GfshCommand;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+public class StatusServerCommand implements GfshCommand {
+
+  @CliCommand(value = CliStrings.STATUS_SERVER, help = CliStrings.STATUS_SERVER__HELP)
+  @CliMetaData(shellOnly = true,
+      relatedTopic = {CliStrings.TOPIC_GEODE_SERVER, CliStrings.TOPIC_GEODE_LIFECYCLE})
+  public Result statusServer(
+      @CliOption(key = CliStrings.STATUS_SERVER__MEMBER, optionContext = ConverterHint.MEMBERIDNAME,
+          help = CliStrings.STATUS_SERVER__MEMBER__HELP) final String member,
+      @CliOption(key = CliStrings.STATUS_SERVER__PID,
+          help = CliStrings.STATUS_SERVER__PID__HELP) final Integer pid,
+      @CliOption(key = CliStrings.STATUS_SERVER__DIR,
+          help = CliStrings.STATUS_SERVER__DIR__HELP) final String workingDirectory) {
+    try {
+      if (StringUtils.isNotBlank(member)) {
+        if (isConnectedAndReady()) {
+          final MemberMXBean serverProxy = getMemberMXBean(member);
+
+          if (serverProxy != null) {
+            return ResultBuilder.createInfoResult(
+                ServerLauncher.ServerState.fromJson(serverProxy.status()).toString());
+          } else {
+            return ResultBuilder.createUserErrorResult(CliStrings.format(
+                CliStrings.STATUS_SERVER__NO_SERVER_FOUND_FOR_MEMBER_ERROR_MESSAGE, member));
+          }
+        } else {
+          return ResultBuilder.createUserErrorResult(CliStrings
+              .format(CliStrings.STATUS_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, "Cache Server"));
+        }
+      } else {
+        final ServerLauncher serverLauncher = new ServerLauncher.Builder()
+            .setCommand(ServerLauncher.Command.STATUS).setDebug(isDebugging())
+            // NOTE since we do not know whether the "CacheServer" was enabled or not on the GemFire
+            // server when it was started,
+            // set the disableDefaultServer property in the ServerLauncher.Builder to default status
+            // to the MemberMBean
+            // TODO fix this hack! (how, the 'start server' loop needs it)
+            .setDisableDefaultServer(true).setPid(pid).setWorkingDirectory(workingDirectory)
+            .build();
+
+        final ServerLauncher.ServerState status = serverLauncher.status();
+
+        return ResultBuilder.createInfoResult(status.toString());
+      }
+    } catch (IllegalArgumentException | IllegalStateException e) {
+      return ResultBuilder.createUserErrorResult(e.getMessage());
+    } catch (VirtualMachineError e) {
+      SystemFailure.initiateFailure(e);
+      throw e;
+    } catch (Throwable t) {
+      SystemFailure.checkFailure();
+      return ResultBuilder.createShellClientErrorResult(String.format(
+          CliStrings.STATUS_SERVER__GENERAL_ERROR_MESSAGE, toString(t, getGfsh().getDebug())));
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/9046c8dc/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopLocatorCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopLocatorCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopLocatorCommand.java
new file mode 100644
index 0000000..5dfb54e
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopLocatorCommand.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.commands.lifecycle;
+
+import static org.apache.geode.management.internal.cli.i18n.CliStrings.LOCATOR_TERM_NAME;
+import static org.apache.geode.management.internal.cli.shell.MXBeanProvider.getMemberMXBean;
+
+import org.apache.geode.SystemFailure;
+import org.apache.geode.distributed.AbstractLauncher;
+import org.apache.geode.distributed.LocatorLauncher;
+import org.apache.geode.internal.lang.StringUtils;
+import org.apache.geode.internal.util.StopWatch;
+import org.apache.geode.management.MemberMXBean;
+import org.apache.geode.management.cli.CliMetaData;
+import org.apache.geode.management.cli.ConverterHint;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.commands.GfshCommand;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.cli.shell.Gfsh;
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import java.util.concurrent.TimeUnit;
+
+public class StopLocatorCommand implements GfshCommand {
+  private static final long WAITING_FOR_STOP_TO_MAKE_PID_GO_AWAY_TIMEOUT_MILLIS = 30 * 1000;
+
+  @CliCommand(value = CliStrings.STOP_LOCATOR, help = CliStrings.STOP_LOCATOR__HELP)
+  @CliMetaData(shellOnly = true,
+      relatedTopic = {CliStrings.TOPIC_GEODE_LOCATOR, CliStrings.TOPIC_GEODE_LIFECYCLE})
+  public Result stopLocator(
+      @CliOption(key = CliStrings.STOP_LOCATOR__MEMBER,
+          optionContext = ConverterHint.LOCATOR_MEMBER_IDNAME,
+          help = CliStrings.STOP_LOCATOR__MEMBER__HELP) final String member,
+      @CliOption(key = CliStrings.STOP_LOCATOR__PID,
+          help = CliStrings.STOP_LOCATOR__PID__HELP) final Integer pid,
+      @CliOption(key = CliStrings.STOP_LOCATOR__DIR,
+          help = CliStrings.STOP_LOCATOR__DIR__HELP) final String workingDirectory) {
+    LocatorLauncher.LocatorState locatorState;
+
+    try {
+      if (StringUtils.isNotBlank(member)) {
+        if (isConnectedAndReady()) {
+          final MemberMXBean locatorProxy = getMemberMXBean(member);
+
+          if (locatorProxy != null) {
+            if (!locatorProxy.isLocator()) {
+              throw new IllegalStateException(
+                  CliStrings.format(CliStrings.STOP_LOCATOR__NOT_LOCATOR_ERROR_MESSAGE, member));
+            }
+
+            if (locatorProxy.isServer()) {
+              throw new IllegalStateException(CliStrings
+                  .format(CliStrings.STOP_LOCATOR__LOCATOR_IS_CACHE_SERVER_ERROR_MESSAGE, member));
+            }
+
+            locatorState = LocatorLauncher.LocatorState.fromJson(locatorProxy.status());
+            locatorProxy.shutDownMember();
+          } else {
+            return ResultBuilder.createUserErrorResult(CliStrings.format(
+                CliStrings.STOP_LOCATOR__NO_LOCATOR_FOUND_FOR_MEMBER_ERROR_MESSAGE, member));
+          }
+        } else {
+          return ResultBuilder.createUserErrorResult(CliStrings.format(
+              CliStrings.STOP_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, LOCATOR_TERM_NAME));
+        }
+      } else {
+        final LocatorLauncher locatorLauncher =
+            new LocatorLauncher.Builder().setCommand(LocatorLauncher.Command.STOP)
+                .setDebug(isDebugging()).setPid(pid).setWorkingDirectory(workingDirectory).build();
+
+        locatorState = locatorLauncher.status();
+        locatorLauncher.stop();
+      }
+
+      if (AbstractLauncher.Status.ONLINE.equals(locatorState.getStatus())) {
+        getGfsh().logInfo(
+            String.format(CliStrings.STOP_LOCATOR__STOPPING_LOCATOR_MESSAGE,
+                locatorState.getWorkingDirectory(), locatorState.getServiceLocation(),
+                locatorState.getMemberName(), locatorState.getPid(), locatorState.getLogFile()),
+            null);
+
+        StopWatch stopWatch = new StopWatch(true);
+        while (locatorState.isVmWithProcessIdRunning()) {
+          Gfsh.print(".");
+          if (stopWatch.elapsedTimeMillis() > WAITING_FOR_STOP_TO_MAKE_PID_GO_AWAY_TIMEOUT_MILLIS) {
+            break;
+          }
+          synchronized (this) {
+            TimeUnit.MILLISECONDS.timedWait(this, 500);
+          }
+        }
+
+        return ResultBuilder.createInfoResult(StringUtils.EMPTY);
+      } else {
+        return ResultBuilder.createUserErrorResult(locatorState.toString());
+      }
+    } catch (IllegalArgumentException | IllegalStateException e) {
+      return ResultBuilder.createUserErrorResult(e.getMessage());
+    } catch (VirtualMachineError e) {
+      SystemFailure.initiateFailure(e);
+      throw e;
+    } catch (Throwable t) {
+      SystemFailure.checkFailure();
+      return ResultBuilder.createShellClientErrorResult(String.format(
+          CliStrings.STOP_LOCATOR__GENERAL_ERROR_MESSAGE, toString(t, getGfsh().getDebug())));
+    } finally {
+      Gfsh.redirectInternalJavaLoggers();
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/9046c8dc/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopServerCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopServerCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopServerCommand.java
new file mode 100644
index 0000000..d5bd85a
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopServerCommand.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.commands.lifecycle;
+
+import static org.apache.geode.management.internal.cli.shell.MXBeanProvider.getMemberMXBean;
+
+import org.apache.geode.SystemFailure;
+import org.apache.geode.distributed.AbstractLauncher;
+import org.apache.geode.distributed.ServerLauncher;
+import org.apache.geode.internal.lang.StringUtils;
+import org.apache.geode.internal.util.StopWatch;
+import org.apache.geode.management.MemberMXBean;
+import org.apache.geode.management.cli.CliMetaData;
+import org.apache.geode.management.cli.ConverterHint;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.commands.GfshCommand;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.cli.shell.Gfsh;
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import java.util.concurrent.TimeUnit;
+
+public class StopServerCommand implements GfshCommand {
+  private static final long WAITING_FOR_STOP_TO_MAKE_PID_GO_AWAY_TIMEOUT_MILLIS = 30 * 1000;
+
+  @CliCommand(value = CliStrings.STOP_SERVER, help = CliStrings.STOP_SERVER__HELP)
+  @CliMetaData(shellOnly = true,
+      relatedTopic = {CliStrings.TOPIC_GEODE_SERVER, CliStrings.TOPIC_GEODE_LIFECYCLE})
+  public Result stopServer(
+      @CliOption(key = CliStrings.STOP_SERVER__MEMBER, optionContext = ConverterHint.MEMBERIDNAME,
+          help = CliStrings.STOP_SERVER__MEMBER__HELP) final String member,
+      @CliOption(key = CliStrings.STOP_SERVER__PID,
+          help = CliStrings.STOP_SERVER__PID__HELP) final Integer pid,
+      @CliOption(key = CliStrings.STOP_SERVER__DIR,
+          help = CliStrings.STOP_SERVER__DIR__HELP) final String workingDirectory) {
+    ServerLauncher.ServerState serverState;
+
+    try {
+      if (StringUtils.isNotBlank(member)) {
+        if (!isConnectedAndReady()) {
+          return ResultBuilder.createUserErrorResult(CliStrings
+              .format(CliStrings.STOP_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, "Cache Server"));
+        }
+
+        final MemberMXBean serverProxy = getMemberMXBean(member);
+
+        if (serverProxy != null) {
+          if (!serverProxy.isServer()) {
+            throw new IllegalStateException(CliStrings
+                .format(CliStrings.STOP_SERVER__MEMBER_IS_NOT_SERVER_ERROR_MESSAGE, member));
+          }
+
+          serverState = ServerLauncher.ServerState.fromJson(serverProxy.status());
+          serverProxy.shutDownMember();
+        } else {
+          return ResultBuilder.createUserErrorResult(CliStrings
+              .format(CliStrings.STOP_SERVER__NO_SERVER_FOUND_FOR_MEMBER_ERROR_MESSAGE, member));
+        }
+
+      } else {
+        final ServerLauncher serverLauncher =
+            new ServerLauncher.Builder().setCommand(ServerLauncher.Command.STOP)
+                .setDebug(isDebugging()).setPid(pid).setWorkingDirectory(workingDirectory).build();
+
+        serverState = serverLauncher.status();
+        serverLauncher.stop();
+      }
+
+      if (AbstractLauncher.Status.ONLINE.equals(serverState.getStatus())) {
+        getGfsh().logInfo(
+            String.format(CliStrings.STOP_SERVER__STOPPING_SERVER_MESSAGE,
+                serverState.getWorkingDirectory(), serverState.getServiceLocation(),
+                serverState.getMemberName(), serverState.getPid(), serverState.getLogFile()),
+            null);
+
+        StopWatch stopWatch = new StopWatch(true);
+        while (serverState.isVmWithProcessIdRunning()) {
+          Gfsh.print(".");
+          if (stopWatch.elapsedTimeMillis() > WAITING_FOR_STOP_TO_MAKE_PID_GO_AWAY_TIMEOUT_MILLIS) {
+            break;
+          }
+          synchronized (this) {
+            TimeUnit.MILLISECONDS.timedWait(this, 500);
+          }
+        }
+
+        return ResultBuilder.createInfoResult(StringUtils.EMPTY);
+      } else {
+        return ResultBuilder.createUserErrorResult(serverState.toString());
+      }
+    } catch (IllegalArgumentException | IllegalStateException e) {
+      return ResultBuilder.createUserErrorResult(e.getMessage());
+    } catch (VirtualMachineError e) {
+      SystemFailure.initiateFailure(e);
+      throw e;
+    } catch (Throwable t) {
+      SystemFailure.checkFailure();
+      return ResultBuilder.createShellClientErrorResult(String.format(
+          CliStrings.STOP_SERVER__GENERAL_ERROR_MESSAGE, toString(t, getGfsh().getDebug())));
+    } finally {
+      Gfsh.redirectInternalJavaLoggers();
+    }
+  }
+
+  private void stop(String member) {}
+
+  private void stop(String pid, String workingDir) {}
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/9046c8dc/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
index cbeee99..9f68d3a 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
@@ -168,6 +168,7 @@ public class CliStrings {
       "Invalid file type, the file extension must be \"{0}\"";
   public static final String GEODE_DATA_FILE_EXTENSION = ".gfd";
   public static final String LOCATOR_HEADER = "Locator";
+  public static final String LOCATOR_TERM_NAME = "Locator";
   public static final String ERROR__MSG__HEADER = "Error";
   public static final String ZIP_FILE_EXTENSION = ".zip";
   // This should be thrown for FunctionInvocationTargetException

http://git-wip-us.apache.org/repos/asf/geode/blob/9046c8dc/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/Gfsh.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/Gfsh.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/Gfsh.java
index 78921c5..c5ff6b6 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/Gfsh.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/Gfsh.java
@@ -1050,6 +1050,10 @@ public class Gfsh extends JLineShell {
     return operationInvoker != null && operationInvoker.isConnected() && operationInvoker.isReady();
   }
 
+  public static boolean isCurrentInstanceConnectedAndReady() {
+    return (getCurrentInstance() != null && getCurrentInstance().isConnectedAndReady());
+  }
+
   /**
    * @return the operationInvoker
    */

http://git-wip-us.apache.org/repos/asf/geode/blob/9046c8dc/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/MXBeanProvider.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/MXBeanProvider.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/MXBeanProvider.java
new file mode 100644
index 0000000..efe2734
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/MXBeanProvider.java
@@ -0,0 +1,100 @@
+/*
+ * 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.shell;
+
+import static org.apache.geode.internal.Assert.assertState;
+
+import org.apache.geode.management.DistributedSystemMXBean;
+import org.apache.geode.management.MemberMXBean;
+import org.apache.geode.management.internal.ManagementConstants;
+
+import java.io.IOException;
+import java.util.Set;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.Query;
+import javax.management.QueryExp;
+
+public class MXBeanProvider {
+
+  /**
+   * Gets a proxy to the DistributedSystemMXBean from the GemFire Manager's MBeanServer, or null if
+   * unable to find the DistributedSystemMXBean.
+   * </p>
+   *
+   * @return a proxy to the DistributedSystemMXBean from the GemFire Manager's MBeanServer, or null
+   *         if unable to find the DistributedSystemMXBean.
+   */
+  public static DistributedSystemMXBean getDistributedSystemMXBean()
+      throws IOException, MalformedObjectNameException {
+    assertState(Gfsh.isCurrentInstanceConnectedAndReady(),
+        "Gfsh must be connected in order to get proxy to a GemFire DistributedSystemMXBean.");
+    return Gfsh.getCurrentInstance().getOperationInvoker().getDistributedSystemMXBean();
+  }
+
+  /**
+   * Gets a proxy to the MemberMXBean for the GemFire member specified by member name or ID from the
+   * GemFire Manager's MBeanServer.
+   * </p>
+   *
+   * @param member a String indicating the GemFire member's name or ID.
+   * @return a proxy to the MemberMXBean having the specified GemFire member's name or ID from the
+   *         GemFire Manager's MBeanServer, or null if no GemFire member could be found with the
+   *         specified member name or ID.
+   * @see #getMemberMXBean(String, String)
+   */
+  public static MemberMXBean getMemberMXBean(final String member) throws IOException {
+    return getMemberMXBean(null, member);
+  }
+
+  public static MemberMXBean getMemberMXBean(final String serviceName, final String member)
+      throws IOException {
+    assertState(Gfsh.isCurrentInstanceConnectedAndReady(),
+        "Gfsh must be connected in order to get proxy to a GemFire Member MBean.");
+
+    MemberMXBean memberBean = null;
+
+    try {
+      String objectNamePattern = ManagementConstants.OBJECTNAME__PREFIX;
+
+      objectNamePattern += (org.apache.geode.internal.lang.StringUtils.isBlank(serviceName)
+          ? org.apache.geode.internal.lang.StringUtils.EMPTY
+          : "service=" + serviceName + org.apache.geode.internal.lang.StringUtils.COMMA_DELIMITER);
+      objectNamePattern += "type=Member,*";
+
+      // NOTE throws a MalformedObjectNameException, however, this should not happen since the
+      // ObjectName is constructed
+      // here in a conforming pattern
+      final ObjectName objectName = ObjectName.getInstance(objectNamePattern);
+
+      final QueryExp query = Query.or(Query.eq(Query.attr("Name"), Query.value(member)),
+          Query.eq(Query.attr("Id"), Query.value(member)));
+
+      final Set<ObjectName> memberObjectNames =
+          Gfsh.getCurrentInstance().getOperationInvoker().queryNames(objectName, query);
+
+      if (!memberObjectNames.isEmpty()) {
+        memberBean = Gfsh.getCurrentInstance().getOperationInvoker()
+            .getMBeanProxy(memberObjectNames.iterator().next(), MemberMXBean.class);
+      }
+    } catch (MalformedObjectNameException e) {
+      Gfsh.getCurrentInstance().logSevere(e.getMessage(), e);
+    }
+
+    return memberBean;
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/9046c8dc/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/HostUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/HostUtils.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/HostUtils.java
new file mode 100644
index 0000000..468ca79
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/HostUtils.java
@@ -0,0 +1,47 @@
+/*
+ * 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.util;
+
+import org.apache.geode.cache.server.CacheServer;
+import org.apache.geode.internal.DistributionLocator;
+import org.apache.geode.internal.lang.StringUtils;
+import org.apache.geode.internal.net.SocketCreator;
+
+import java.net.UnknownHostException;
+
+public class HostUtils {
+  private static final String LOCALHOST = "localhost";
+
+  public static String getLocalHost() {
+    try {
+      return SocketCreator.getLocalHost().getCanonicalHostName();
+    } catch (UnknownHostException ignore) {
+      return LOCALHOST;
+    }
+  }
+
+  public static String getLocatorId(final String host, final Integer port) {
+    final String locatorHost = (host != null ? host : getLocalHost());
+    final String locatorPort =
+        StringUtils.defaultString(port, String.valueOf(DistributionLocator.DEFAULT_LOCATOR_PORT));
+    return locatorHost.concat("[").concat(locatorPort).concat("]");
+  }
+
+  public static String getServerId(final String host, final Integer port) {
+    String serverHost = (host != null ? host : getLocalHost());
+    String serverPort = StringUtils.defaultString(port, String.valueOf(CacheServer.DEFAULT_PORT));
+    return serverHost.concat("[").concat(serverPort).concat("]");
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/9046c8dc/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/JdkTool.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/JdkTool.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/JdkTool.java
new file mode 100644
index 0000000..d5da8ee
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/JdkTool.java
@@ -0,0 +1,97 @@
+/*
+ * 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.util;
+
+import static org.apache.geode.internal.Assert.assertNotNull;
+
+import org.apache.geode.GemFireException;
+import org.apache.geode.internal.lang.StringUtils;
+import org.apache.geode.internal.lang.SystemUtils;
+import org.apache.geode.internal.util.IOUtils;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+
+import java.io.FileNotFoundException;
+import java.util.EmptyStackException;
+import java.util.Stack;
+
+public class JdkTool {
+  protected static final String JAVA_HOME = System.getProperty("java.home");
+
+  public static String getJVisualVMPathname() {
+    if (SystemUtils.isMacOSX()) {
+      try {
+        return IOUtils.verifyPathnameExists(
+            "/System/Library/Java/Support/VisualVM.bundle/Contents/Home/bin/jvisualvm");
+      } catch (FileNotFoundException e) {
+        throw new VisualVmNotFoundException(CliStrings.START_JVISUALVM__NOT_FOUND_ERROR_MESSAGE, e);
+      }
+    } else { // Linux, Solaris, Windows, etc...
+      try {
+        return getJdkToolPathname("jvisualvm" + getExecutableSuffix(),
+            new VisualVmNotFoundException(CliStrings.START_JVISUALVM__NOT_FOUND_ERROR_MESSAGE));
+      } catch (VisualVmNotFoundException e) {
+        if (!SystemUtils.isJavaVersionAtLeast("1.6")) {
+          throw new VisualVmNotFoundException(
+              CliStrings.START_JVISUALVM__EXPECTED_JDK_VERSION_ERROR_MESSAGE);
+        }
+
+        throw e;
+      }
+    }
+  }
+
+  public static String getJConsolePathname() {
+    return getJdkToolPathname("jconsole" + getExecutableSuffix(),
+        new JConsoleNotFoundException(CliStrings.START_JCONSOLE__NOT_FOUND_ERROR_MESSAGE));
+  }
+
+  protected static String getJdkToolPathname(final String jdkToolExecutableName,
+      final GemFireException throwable) {
+    assertNotNull(jdkToolExecutableName, "The JDK tool executable name cannot be null!");
+    assertNotNull(throwable, "The GemFireException cannot be null!");
+
+    Stack<String> pathnames = new Stack<>();
+
+    pathnames.push(jdkToolExecutableName);
+    pathnames
+        .push(IOUtils.appendToPath(System.getenv("JAVA_HOME"), "..", "bin", jdkToolExecutableName));
+    pathnames.push(IOUtils.appendToPath(System.getenv("JAVA_HOME"), "bin", jdkToolExecutableName));
+    pathnames.push(IOUtils.appendToPath(JAVA_HOME, "..", "bin", jdkToolExecutableName));
+    pathnames.push(IOUtils.appendToPath(JAVA_HOME, "bin", jdkToolExecutableName));
+
+    return getJdkToolPathname(pathnames, throwable);
+  }
+
+  protected static String getJdkToolPathname(final Stack<String> pathnames,
+      final GemFireException throwable) {
+    assertNotNull(pathnames, "The JDK tool executable pathnames cannot be null!");
+    assertNotNull(throwable, "The GemFireException cannot be null!");
+
+    try {
+      // assume 'java.home' JVM System property refers to the JDK installation directory. note,
+      // however, that the
+      // 'java.home' JVM System property usually refers to the JRE used to launch this application
+      return IOUtils.verifyPathnameExists(pathnames.pop());
+    } catch (EmptyStackException ignore) {
+      throw throwable;
+    } catch (FileNotFoundException ignore) {
+      return getJdkToolPathname(pathnames, throwable);
+    }
+  }
+
+  protected static String getExecutableSuffix() {
+    return SystemUtils.isWindows() ? ".exe" : StringUtils.EMPTY;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/9046c8dc/geode-core/src/main/java/org/apache/geode/management/internal/configuration/utils/ClusterConfigurationStatusRetriever.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/utils/ClusterConfigurationStatusRetriever.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/utils/ClusterConfigurationStatusRetriever.java
new file mode 100644
index 0000000..9f35edd
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/utils/ClusterConfigurationStatusRetriever.java
@@ -0,0 +1,116 @@
+/*
+ * 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.configuration.utils;
+
+import org.apache.geode.distributed.LocatorLauncher;
+import org.apache.geode.distributed.internal.tcpserver.TcpClient;
+import org.apache.geode.internal.cache.persistence.PersistentMemberPattern;
+import org.apache.geode.management.internal.cli.shell.Gfsh;
+import org.apache.geode.management.internal.configuration.messages.SharedConfigurationStatusRequest;
+import org.apache.geode.management.internal.configuration.messages.SharedConfigurationStatusResponse;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.util.Set;
+
+public class ClusterConfigurationStatusRetriever {
+  private static final int NUM_ATTEMPTS_FOR_SHARED_CONFIGURATION_STATUS = 3;
+
+  public static String fromLocator(String locatorHostName, int locatorPort)
+      throws ClassNotFoundException, IOException {
+    final StringBuilder buffer = new StringBuilder();
+
+    try {
+      final InetAddress networkAddress = InetAddress.getByName(locatorHostName);
+      InetSocketAddress inetSockAddr = new InetSocketAddress(networkAddress, locatorPort);
+
+      TcpClient client = new TcpClient();
+      SharedConfigurationStatusResponse statusResponse = (SharedConfigurationStatusResponse) client
+          .requestToServer(inetSockAddr, new SharedConfigurationStatusRequest(), 10000, true);
+
+      for (int i = 0; i < NUM_ATTEMPTS_FOR_SHARED_CONFIGURATION_STATUS; i++) {
+        if (statusResponse.getStatus().equals(
+            org.apache.geode.management.internal.configuration.domain.SharedConfigurationStatus.STARTED)
+            || statusResponse.getStatus().equals(
+                org.apache.geode.management.internal.configuration.domain.SharedConfigurationStatus.NOT_STARTED)) {
+          statusResponse = (SharedConfigurationStatusResponse) client.requestToServer(inetSockAddr,
+              new SharedConfigurationStatusRequest(), 10000, true);
+          try {
+            Thread.sleep(5000);
+          } catch (InterruptedException e) {
+            // Swallow the exception
+          }
+        } else {
+          break;
+        }
+      }
+
+      switch (statusResponse.getStatus()) {
+        case RUNNING:
+          buffer.append("\nCluster configuration service is up and running.");
+          break;
+        case STOPPED:
+          buffer.append(
+              "\nCluster configuration service failed to start , please check the log file for errors.");
+          break;
+        case WAITING:
+          buffer.append(
+              "\nCluster configuration service is waiting for other locators with newer shared configuration data.");
+          Set<PersistentMemberPattern> pmpSet = statusResponse.getOtherLocatorInformation();
+          if (!pmpSet.isEmpty()) {
+            buffer.append("\nThis locator might have stale cluster configuration data.");
+            buffer.append(
+                "\nFollowing locators contain potentially newer cluster configuration data");
+
+            for (PersistentMemberPattern pmp : pmpSet) {
+              buffer.append("\nHost : ").append(pmp.getHost());
+              buffer.append("\nDirectory : ").append(pmp.getDirectory());
+            }
+          } else {
+            buffer.append("\nPlease check the log file for errors");
+          }
+          break;
+        case UNDETERMINED:
+          buffer.append(
+              "\nUnable to determine the status of shared configuration service, please check the log file");
+          break;
+        case NOT_STARTED:
+          buffer.append("\nCluster configuration service has not been started yet");
+          break;
+        case STARTED:
+          buffer
+              .append("\nCluster configuration service has been started, but its not running yet");
+          break;
+      }
+    } catch (Exception e) {
+      // TODO fix this once Trac Bug #50513 gets fixed
+      // NOTE this ClassCastException occurs if the a plain text TCP/IP connection is used to
+      // connect to a Locator
+      // configured with SSL.
+      Gfsh.getCurrentInstance()
+          .logToFile(String.format(
+              "Failed to get the status of the Shared Configuration Service running on Locator (%1$s[%2$d])!",
+              locatorHostName, locatorPort), e);
+    }
+
+    return buffer.toString();
+  }
+
+  public static String fromLocator(LocatorLauncher.LocatorState locatorState)
+      throws ClassNotFoundException, IOException {
+    return fromLocator(locatorState.getHost(), Integer.parseInt(locatorState.getPort()));
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/9046c8dc/geode-core/src/test/java/org/apache/geode/internal/AssertJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/AssertJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/AssertJUnitTest.java
new file mode 100644
index 0000000..57ebd10
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/AssertJUnitTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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.internal;
+
+import static org.assertj.core.api.Assertions.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class AssertJUnitTest {
+  @Test
+  public void testAssertArgumentIsLegal() {
+    Assert.assertArgument(true, "");
+  }
+
+  @Test
+  public void testAssertArgumentIsIllegal() {
+    assertThatThrownBy(() -> {
+      Assert.assertArgument(false, "The actual argument is %1$s!", "illegal");
+    }).isInstanceOf(IllegalArgumentException.class).hasMessage("The actual argument is illegal!");
+  }
+
+  @Test
+  public void testAssetNotNullWithNonNullObject() {
+    Assert.assertNotNull(new Object(), "");
+  }
+
+  @Test
+  public void testAssertNotNullWithNullObject() {
+    assertThatThrownBy(() -> {
+      Assert.assertNotNull(null, "This is an %1$s message!", "expected");
+    }).isInstanceOf(NullPointerException.class).hasMessage("This is an expected message!");
+
+  }
+
+  @Test
+  public void testAssertStateIsValid() {
+    Assert.assertState(true, "");
+  }
+
+  @Test
+  public void testAssertStateIsInvalid() {
+    assertThatThrownBy(() -> {
+      Assert.assertState(false, "The actual state is %1$s!", "invalid");
+    }).isInstanceOf(IllegalStateException.class).hasMessage("The actual state is invalid!");
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/9046c8dc/geode-core/src/test/java/org/apache/geode/internal/cache/extension/mock/MockExtensionCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/extension/mock/MockExtensionCommands.java b/geode-core/src/test/java/org/apache/geode/internal/cache/extension/mock/MockExtensionCommands.java
index 59d8a77..712c970 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/extension/mock/MockExtensionCommands.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/extension/mock/MockExtensionCommands.java
@@ -30,7 +30,7 @@ import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.cli.Result.Status;
 import org.apache.geode.management.internal.cli.CliUtil;
-import org.apache.geode.management.internal.cli.commands.AbstractCommandsSupport;
+import org.apache.geode.management.internal.cli.commands.GfshCommand;
 import org.apache.geode.management.internal.cli.functions.CliFunctionResult;
 import org.apache.geode.management.internal.cli.result.ResultBuilder;
 import org.apache.geode.management.internal.cli.result.TabularResultData;
@@ -44,7 +44,7 @@ import org.apache.geode.security.ResourcePermission.Resource;
  *
  * @since GemFire 8.1
  */
-public class MockExtensionCommands extends AbstractCommandsSupport {
+public class MockExtensionCommands implements GfshCommand {
 
   public static final String OPTION_VALUE = "value";
 

http://git-wip-us.apache.org/repos/asf/geode/blob/9046c8dc/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupportJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupportJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupportJUnitTest.java
deleted file mode 100644
index 7fedb9f..0000000
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupportJUnitTest.java
+++ /dev/null
@@ -1,435 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.management.internal.cli.commands;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.geode.cache.execute.Function;
-import org.apache.geode.cache.execute.FunctionService;
-import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.distributed.DistributedSystem;
-import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.util.CollectionUtils;
-import org.apache.geode.management.cli.CliMetaData;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.util.MemberNotFoundException;
-import org.apache.geode.test.junit.categories.UnitTest;
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.lib.concurrent.Synchroniser;
-import org.jmock.lib.legacy.ClassImposteriser;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * The AbstractCommandsSupportJUnitTest class is a test suite of test cases testing the contract and
- * functionality of the AbstractCommandsSupport class for implementing GemFire shell (Gfsh)
- * commands.
- *
- * @see org.apache.geode.management.internal.cli.commands.AbstractCommandsSupport
- * @see org.jmock.Expectations
- * @see org.jmock.Mockery
- * @see org.jmock.lib.legacy.ClassImposteriser
- * @see org.junit.Assert
- * @see org.junit.Test
- * @since GemFire 7.0
- */
-@Category(UnitTest.class)
-public class AbstractCommandsSupportJUnitTest {
-
-  private Mockery mockContext;
-
-  @Before
-  public void setup() {
-    mockContext = new Mockery();
-    mockContext.setImposteriser(ClassImposteriser.INSTANCE);
-    mockContext.setThreadingPolicy(new Synchroniser());
-  }
-
-  @After
-  public void tearDown() {
-    mockContext.assertIsSatisfied();
-    mockContext = null;
-  }
-
-  private AbstractCommandsSupport createAbstractCommandsSupport(final InternalCache cache) {
-    return new TestCommands(cache);
-  }
-
-  private DistributedMember createMockMember(final String memberId, final String memberName) {
-    final DistributedMember mockMember =
-        mockContext.mock(DistributedMember.class, "DistributedMember " + memberId);
-
-    mockContext.checking(new Expectations() {
-      {
-        allowing(mockMember).getName();
-        will(returnValue(memberName));
-        allowing(mockMember).getId();
-        will(returnValue(memberId));
-      }
-    });
-
-    return mockMember;
-  }
-
-  @Test
-  public void testAssertArgumentIsLegal() {
-    AbstractCommandsSupport.assertArgument(true, "");
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testAssertArgumentIsIllegal() {
-    try {
-      AbstractCommandsSupport.assertArgument(false, "The actual argument is %1$s!", "illegal");
-    } catch (IllegalArgumentException expected) {
-      assertEquals("The actual argument is illegal!", expected.getMessage());
-      throw expected;
-    }
-  }
-
-  @Test
-  public void testAssetNotNullWithNonNullObject() {
-    AbstractCommandsSupport.assertNotNull(new Object(), "");
-  }
-
-  @Test(expected = NullPointerException.class)
-  public void testAssertNotNullWithNullObject() {
-    try {
-      AbstractCommandsSupport.assertNotNull(null, "This is an %1$s message!", "expected");
-    } catch (NullPointerException expected) {
-      assertEquals("This is an expected message!", expected.getMessage());
-      throw expected;
-    }
-  }
-
-  @Test
-  public void testAssertStateIsValid() {
-    AbstractCommandsSupport.assertState(true, "");
-  }
-
-  @Test(expected = IllegalStateException.class)
-  public void testAssertStateIsInvalid() {
-    try {
-      AbstractCommandsSupport.assertState(false, "The actual state is %1$s!", "invalid");
-    } catch (IllegalStateException expected) {
-      assertEquals("The actual state is invalid!", expected.getMessage());
-      throw expected;
-    }
-  }
-
-  @Test
-  public void testConvertDefaultValue() {
-    assertNull(AbstractCommandsSupport.convertDefaultValue(null, StringUtils.EMPTY));
-    assertEquals(StringUtils.EMPTY,
-        AbstractCommandsSupport.convertDefaultValue(StringUtils.EMPTY, "test"));
-    assertEquals(StringUtils.SPACE,
-        AbstractCommandsSupport.convertDefaultValue(StringUtils.SPACE, "testing"));
-    assertEquals("tested", AbstractCommandsSupport
-        .convertDefaultValue(CliMetaData.ANNOTATION_DEFAULT_VALUE, "tested"));
-  }
-
-  @Test
-  public void testGetMemberWithMatchingMemberId() {
-    final InternalCache mockCache = mockContext.mock(InternalCache.class, "InternalCache");
-
-    final DistributedSystem mockDistributedSystem =
-        mockContext.mock(DistributedSystem.class, "DistributedSystem");
-
-    final DistributedMember mockMemberSelf = createMockMember("S", "Self");
-    final DistributedMember mockMemberOne = createMockMember("1", "One");
-    final DistributedMember mockMemberTwo = createMockMember("2", "Two");
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockCache).getMembers();
-        will(returnValue(CollectionUtils.asSet(mockMemberOne, mockMemberTwo)));
-        oneOf(mockCache).getDistributedSystem();
-        will(returnValue(mockDistributedSystem));
-        oneOf(mockDistributedSystem).getDistributedMember();
-        will(returnValue(mockMemberSelf));
-      }
-    });
-
-    final AbstractCommandsSupport commands = createAbstractCommandsSupport(mockCache);
-
-    assertSame(mockMemberTwo, commands.getMember(mockCache, "2"));
-  }
-
-  @Test
-  public void testGetMemberWithMatchingMemberName() {
-    final InternalCache mockCache = mockContext.mock(InternalCache.class, "InternalCache");
-
-    final DistributedSystem mockDistributedSystem =
-        mockContext.mock(DistributedSystem.class, "DistributedSystem");
-
-    final DistributedMember mockMemberSelf = createMockMember("S", "Self");
-    final DistributedMember mockMemberOne = createMockMember("1", "One");
-    final DistributedMember mockMemberTwo = createMockMember("2", "Two");
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockCache).getMembers();
-        will(returnValue(CollectionUtils.asSet(mockMemberOne, mockMemberTwo)));
-        oneOf(mockCache).getDistributedSystem();
-        will(returnValue(mockDistributedSystem));
-        oneOf(mockDistributedSystem).getDistributedMember();
-        will(returnValue(mockMemberSelf));
-      }
-    });
-
-    final AbstractCommandsSupport commands = createAbstractCommandsSupport(mockCache);
-
-    assertSame(mockMemberOne, commands.getMember(mockCache, "One"));
-  }
-
-  @Test
-  public void testGetMemberWithMatchingMemberNameCaseInsensitive() {
-    final InternalCache mockCache = mockContext.mock(InternalCache.class, "InternalCache");
-
-    final DistributedSystem mockDistributedSystem =
-        mockContext.mock(DistributedSystem.class, "DistributedSystem");
-
-    final DistributedMember mockMemberSelf = createMockMember("S", "Self");
-    final DistributedMember mockMemberOne = createMockMember("1", "One");
-    final DistributedMember mockMemberTwo = createMockMember("2", "Two");
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockCache).getMembers();
-        will(returnValue(CollectionUtils.asSet(mockMemberOne, mockMemberTwo)));
-        oneOf(mockCache).getDistributedSystem();
-        will(returnValue(mockDistributedSystem));
-        oneOf(mockDistributedSystem).getDistributedMember();
-        will(returnValue(mockMemberSelf));
-      }
-    });
-
-    final AbstractCommandsSupport commands = createAbstractCommandsSupport(mockCache);
-
-    assertSame(mockMemberSelf, commands.getMember(mockCache, "self"));
-  }
-
-  @Test(expected = MemberNotFoundException.class)
-  public void testGetMemberThrowsMemberNotFoundException() {
-    final InternalCache mockCache = mockContext.mock(InternalCache.class, "InternalCache");
-
-    final DistributedSystem mockDistributedSystem =
-        mockContext.mock(DistributedSystem.class, "DistributedSystem");
-
-    final DistributedMember mockMemberSelf = createMockMember("S", "Self");
-    final DistributedMember mockMemberOne = createMockMember("1", "One");
-    final DistributedMember mockMemberTwo = createMockMember("2", "Two");
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockCache).getMembers();
-        will(returnValue(CollectionUtils.asSet(mockMemberOne, mockMemberTwo)));
-        oneOf(mockCache).getDistributedSystem();
-        will(returnValue(mockDistributedSystem));
-        oneOf(mockDistributedSystem).getDistributedMember();
-        will(returnValue(mockMemberSelf));
-      }
-    });
-
-    final AbstractCommandsSupport commands = createAbstractCommandsSupport(mockCache);
-
-    try {
-      commands.getMember(mockCache, "zero");
-    } catch (MemberNotFoundException expected) {
-      assertEquals(CliStrings.format(CliStrings.MEMBER_NOT_FOUND_ERROR_MESSAGE, "zero"),
-          expected.getMessage());
-      throw expected;
-    }
-  }
-
-  @Test
-  public void testGetMembers() {
-    final InternalCache mockCache = mockContext.mock(InternalCache.class, "InternalCache");
-
-    final DistributedSystem mockDistributedSystem =
-        mockContext.mock(DistributedSystem.class, "DistributedSystem");
-
-    final DistributedMember mockMemberSelf = createMockMember("S", "Self");
-    final DistributedMember mockMemberOne = createMockMember("1", "One");
-    final DistributedMember mockMemberTwo = createMockMember("2", "Two");
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockCache).getMembers();
-        will(returnValue(CollectionUtils.asSet(mockMemberOne, mockMemberTwo)));
-        oneOf(mockCache).getDistributedSystem();
-        will(returnValue(mockDistributedSystem));
-        oneOf(mockDistributedSystem).getDistributedMember();
-        will(returnValue(mockMemberSelf));
-      }
-    });
-
-    final AbstractCommandsSupport commands = createAbstractCommandsSupport(mockCache);
-
-    final Set<DistributedMember> expectedMembers =
-        CollectionUtils.asSet(mockMemberOne, mockMemberTwo, mockMemberSelf);
-    final Set<DistributedMember> actualMembers = commands.getMembers(mockCache);
-
-    assertNotNull(actualMembers);
-    assertEquals(expectedMembers.size(), actualMembers.size());
-    assertTrue(actualMembers.containsAll(expectedMembers));
-  }
-
-  @Test
-  public void testGetMembersContainsOnlySelf() {
-    final InternalCache mockCache = mockContext.mock(InternalCache.class, "InternalCache");
-
-    final DistributedSystem mockDistributedSystem =
-        mockContext.mock(DistributedSystem.class, "DistributedSystem");
-    final DistributedMember mockMemberSelf = createMockMember("S", "Self");
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockCache).getMembers();
-        will(returnValue(Collections.emptySet()));
-        oneOf(mockCache).getDistributedSystem();
-        will(returnValue(mockDistributedSystem));
-        oneOf(mockDistributedSystem).getDistributedMember();
-        will(returnValue(mockMemberSelf));
-      }
-    });
-
-    final AbstractCommandsSupport commands = createAbstractCommandsSupport(mockCache);
-
-    final Set<DistributedMember> expectedMembers = CollectionUtils.asSet(mockMemberSelf);
-    final Set<DistributedMember> actualMembers = commands.getMembers(mockCache);
-
-    assertNotNull(actualMembers);
-    assertEquals(expectedMembers.size(), actualMembers.size());
-    assertTrue(actualMembers.containsAll(expectedMembers));
-  }
-
-  @Test
-  public void testRegister() {
-    try {
-      final Function mockFunction = mockContext.mock(Function.class, "Function");
-
-      mockContext.checking(new Expectations() {
-        {
-          exactly(3).of(mockFunction).getId();
-          will(returnValue("testRegister"));
-          oneOf(mockFunction).isHA();
-          will(returnValue(true));
-          oneOf(mockFunction).hasResult();
-          will(returnValue(true));
-        }
-      });
-
-      final AbstractCommandsSupport commands =
-          createAbstractCommandsSupport(mockContext.mock(InternalCache.class));
-
-      assertFalse(FunctionService.isRegistered("testRegister"));
-      assertSame(mockFunction, commands.register(mockFunction));
-      assertTrue(FunctionService.isRegistered("testRegister"));
-    } finally {
-      FunctionService.unregisterFunction("testRegister");
-    }
-  }
-
-  @Test
-  public void testRegisteredAlready() {
-    try {
-      final Function registeredFunction = mockContext.mock(Function.class, "Registered Function");
-      final Function unregisteredFunction =
-          mockContext.mock(Function.class, "Unregistered Function");
-
-      mockContext.checking(new Expectations() {
-        {
-          exactly(2).of(registeredFunction).getId();
-          will(returnValue("testRegisteredAlready"));
-          oneOf(registeredFunction).isHA();
-          will(returnValue(false));
-          exactly(2).of(unregisteredFunction).getId();
-          will(returnValue("testRegisteredAlready"));
-        }
-      });
-
-      final AbstractCommandsSupport commands =
-          createAbstractCommandsSupport(mockContext.mock(InternalCache.class));
-
-      FunctionService.registerFunction(registeredFunction);
-
-      assertTrue(FunctionService.isRegistered("testRegisteredAlready"));
-      assertSame(registeredFunction, commands.register(unregisteredFunction));
-      assertTrue(FunctionService.isRegistered("testRegisteredAlready"));
-    } finally {
-      FunctionService.unregisterFunction("testRegisteredAlready");
-    }
-  }
-
-  @Test
-  public void testToStringOnBoolean() {
-    assertEquals("false", AbstractCommandsSupport.toString(null, null, null));
-    assertEquals("true", AbstractCommandsSupport.toString(true, null, null));
-    assertEquals("true", AbstractCommandsSupport.toString(Boolean.TRUE, null, null));
-    assertEquals("false", AbstractCommandsSupport.toString(false, null, null));
-    assertEquals("false", AbstractCommandsSupport.toString(Boolean.FALSE, null, null));
-    assertEquals("false", AbstractCommandsSupport.toString(true, "false", "true"));
-    assertEquals("true", AbstractCommandsSupport.toString(false, "false", "true"));
-    assertEquals("Yes", AbstractCommandsSupport.toString(true, "Yes", "No"));
-    assertEquals("Yes", AbstractCommandsSupport.toString(false, "No", "Yes"));
-    assertEquals("TRUE", AbstractCommandsSupport.toString(Boolean.TRUE, "TRUE", "FALSE"));
-    assertEquals("FALSE", AbstractCommandsSupport.toString(Boolean.FALSE, "TRUE", "FALSE"));
-  }
-
-  @Test
-  public void testToStringOnThrowable() {
-    assertEquals("test", AbstractCommandsSupport.toString(new Throwable("test"), false));
-  }
-
-  @Test
-  public void testToStringOnThrowablePrintingStackTrace() {
-    final StringWriter writer = new StringWriter();
-    final Throwable t = new Throwable("test");
-
-    t.printStackTrace(new PrintWriter(writer));
-
-    assertEquals(writer.toString(), AbstractCommandsSupport.toString(t, true));
-  }
-
-  private static class TestCommands extends AbstractCommandsSupport {
-
-    private final InternalCache cache;
-
-    protected TestCommands(final InternalCache cache) {
-      assert cache != null : "The InternalCache cannot be null!";
-      this.cache = cache;
-    }
-
-    @Override
-    protected InternalCache getCache() {
-      return this.cache;
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/9046c8dc/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsJUnitTest.java
index 9aeccad..1902656 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsJUnitTest.java
@@ -418,18 +418,18 @@ public class DiskStoreCommandsJUnitTest {
     }
 
     @Override
-    protected InternalCache getCache() {
+    public InternalCache getCache() {
       return this.cache;
     }
 
     @Override
-    protected Set<DistributedMember> getMembers(final InternalCache cache) {
+    public Set<DistributedMember> getMembers(final InternalCache cache) {
       assertSame(getCache(), cache);
       return Collections.singleton(this.distributedMember);
     }
 
     @Override
-    protected Execution getMembersFunctionExecutor(final Set<DistributedMember> members) {
+    public Execution getMembersFunctionExecutor(final Set<DistributedMember> members) {
       Assert.assertNotNull(members);
       return this.functionExecutor;
     }