geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [2/2] geode git commit: GEODE-3337: Refactoring LauncherLifecycleCommandsDUnitTest
Date Fri, 11 Aug 2017 22:25:31 GMT
GEODE-3337: Refactoring LauncherLifecycleCommandsDUnitTest

This closes #701


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/210ff9f1
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/210ff9f1
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/210ff9f1

Branch: refs/heads/develop
Commit: 210ff9f15460c993f2bf7fd682d50ee65462cd23
Parents: 6316969
Author: YehEmily <emilyyeh1997@gmail.com>
Authored: Fri Aug 11 10:22:33 2017 -0700
Committer: Kirk Lund <klund@apache.org>
Committed: Fri Aug 11 15:10:52 2017 -0700

----------------------------------------------------------------------
 .../commands/GfshCommandIntegrationTest.java    |   69 +-
 .../LauncherLifecycleCommandsDUnitTest.java     | 1115 ------------------
 .../cli/commands/StartLocatorCommandTest.java   |    4 +-
 .../cli/commands/StartServerCommandTest.java    |    4 +-
 .../test/dunit/rules/gfsh/ProcessLogger.java    |   10 +-
 .../cli/commands/StartLocatorCommand.java       |   67 +-
 .../cli/commands/StartMemberCommand.java        |  248 ++++
 .../internal/cli/commands/StartMemberUtils.java |  251 ----
 .../cli/commands/StartServerCommand.java        |  117 +-
 .../commands/lifecycle/StopLocatorCommand.java  |   16 +-
 .../cli/commands/GfshCommandJUnitTest.java      |  219 +---
 .../commands/StartLocatorCommandUnitTest.java   |   59 +
 .../cli/commands/StartMemberCommandTest.java    |  335 ++++++
 .../commands/StartServerCommandUnitTest.java    |   78 ++
 .../commands/StatusLocatorCommandUnitTest.java  |   53 +
 .../lifecycle/StopLocatorCommandUnitTest.java   |   74 ++
 .../rules/RetryRuleLocalWithErrorTest.java      |    2 +-
 17 files changed, 961 insertions(+), 1760 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/210ff9f1/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandIntegrationTest.java b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandIntegrationTest.java
index 263b12c..a191905 100644
--- a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandIntegrationTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandIntegrationTest.java
@@ -15,16 +15,11 @@
 
 package org.apache.geode.management.internal.cli.commands;
 
-import static org.assertj.core.api.Java6Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.io.File;
-import java.io.FileWriter;
 import java.io.IOException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -33,14 +28,12 @@ import java.util.jar.Attributes;
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
 
-import org.apache.commons.io.FileUtils;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.rules.TemporaryFolder;
 import org.junit.rules.TestName;
 
-import org.apache.geode.internal.util.IOUtils;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 
 @Category(IntegrationTest.class)
@@ -52,60 +45,8 @@ public class GfshCommandIntegrationTest {
   public TestName testName = new TestName();
 
   @Test
-  public void workingDirDefaultsToMemberName() {
-    StartServerCommand startServer = new StartServerCommand();
-    String workingDir = StartMemberUtils.resolveWorkingDir(null, "server1");
-    assertThat(new File(workingDir)).exists();
-    assertThat(workingDir).endsWith("server1");
-  }
-
-  @Test
-  public void workingDirGetsCreatedIfNecessary() throws Exception {
-    File workingDir = temporaryFolder.newFolder("foo");
-    FileUtils.deleteQuietly(workingDir);
-    String workingDirString = workingDir.getAbsolutePath();
-
-    StartServerCommand startServer = new StartServerCommand();
-
-    String resolvedWorkingDir = StartMemberUtils.resolveWorkingDir(workingDirString, "server1");
-    assertThat(new File(resolvedWorkingDir)).exists();
-    assertThat(workingDirString).endsWith("foo");
-  }
-
-  @Test
-  public void testWorkingDirWithRelativePath() throws Exception {
-    Path relativePath = Paths.get("some").resolve("relative").resolve("path");
-    assertThat(relativePath.isAbsolute()).isFalse();
-
-    StartServerCommand startServer = new StartServerCommand();
-
-    String resolvedWorkingDir =
-        StartMemberUtils.resolveWorkingDir(relativePath.toString(), "server1");
-
-    assertThat(resolvedWorkingDir).isEqualTo(relativePath.toAbsolutePath().toString());
-  }
-
-  @Test
-  public void testReadPid() throws IOException {
-    final int expectedPid = 12345;
-
-    File folder = temporaryFolder.newFolder();
-    File pidFile =
-        new File(folder, getClass().getSimpleName() + "_" + testName.getMethodName() + ".pid");
-
-    assertTrue(pidFile.createNewFile());
-
-    pidFile.deleteOnExit();
-    writePid(pidFile, expectedPid);
-
-    final int actualPid = StartMemberUtils.readPid(pidFile);
-
-    assertEquals(expectedPid, actualPid);
-  }
-
-  @Test
   public void testGemFireCoreClasspath() throws IOException {
-    File coreDependenciesJar = new File(StartMemberUtils.CORE_DEPENDENCIES_JAR_PATHNAME);
+    File coreDependenciesJar = new File(StartMemberCommand.CORE_DEPENDENCIES_JAR_PATHNAME);
     assertNotNull(coreDependenciesJar);
     assertTrue(coreDependenciesJar + " is not a file", coreDependenciesJar.isFile());
     Collection<String> expectedJarDependencies =
@@ -167,11 +108,5 @@ public class GfshCommandIntegrationTest {
         missingExpectedJarDependenciesList.isEmpty());
   }
 
-  private void writePid(final File pidFile, final int pid) throws IOException {
-    final FileWriter fileWriter = new FileWriter(pidFile, false);
-    fileWriter.write(String.valueOf(pid));
-    fileWriter.write("\n");
-    fileWriter.flush();
-    IOUtils.close(fileWriter);
-  }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/210ff9f1/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
deleted file mode 100644
index 6e5d17c..0000000
--- a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
+++ /dev/null
@@ -1,1115 +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.apache.geode.distributed.ConfigurationProperties.DURABLE_CLIENT_ID;
-import static org.apache.geode.distributed.ConfigurationProperties.START_LOCATOR;
-import static org.apache.geode.test.dunit.Assert.assertEquals;
-import static org.apache.geode.test.dunit.Assert.assertFalse;
-import static org.apache.geode.test.dunit.Assert.assertNotNull;
-import static org.apache.geode.test.dunit.Assert.assertTrue;
-import static org.apache.geode.test.dunit.Wait.waitForCriterion;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.lang.management.ManagementFactory;
-import java.net.InetAddress;
-import java.nio.charset.Charset;
-import java.text.DateFormat;
-import java.text.MessageFormat;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Queue;
-import java.util.Set;
-import java.util.concurrent.ConcurrentLinkedDeque;
-import java.util.concurrent.TimeUnit;
-
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-import javax.management.Query;
-import javax.management.QueryExp;
-import javax.management.remote.JMXConnector;
-import javax.management.remote.JMXConnectorFactory;
-import javax.management.remote.JMXServiceURL;
-
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runners.MethodSorters;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.client.ClientCache;
-import org.apache.geode.cache.client.ClientCacheFactory;
-import org.apache.geode.cache.client.ClientRegionFactory;
-import org.apache.geode.cache.client.ClientRegionShortcut;
-import org.apache.geode.cache.client.Pool;
-import org.apache.geode.cache.client.PoolFactory;
-import org.apache.geode.cache.client.PoolManager;
-import org.apache.geode.distributed.AbstractLauncher.ServiceState;
-import org.apache.geode.distributed.AbstractLauncher.Status;
-import org.apache.geode.distributed.LocatorLauncher;
-import org.apache.geode.distributed.LocatorLauncher.Builder;
-import org.apache.geode.distributed.LocatorLauncher.Command;
-import org.apache.geode.distributed.LocatorLauncher.LocatorState;
-import org.apache.geode.distributed.ServerLauncher;
-import org.apache.geode.distributed.ServerLauncher.ServerState;
-import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.internal.AvailablePortHelper;
-import org.apache.geode.internal.lang.ObjectUtils;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.lang.SystemUtils;
-import org.apache.geode.internal.process.ProcessType;
-import org.apache.geode.internal.process.ProcessUtils;
-import org.apache.geode.internal.util.IOUtils;
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.result.CommandResult;
-import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
-import org.apache.geode.test.dunit.WaitCriterion;
-import org.apache.geode.test.junit.categories.DistributedTest;
-
-/**
- * The LauncherLifecycleCommandsDUnitTest class is a test suite of integration tests testing the
- * contract and functionality of the GemFire launcher lifecycle commands inside Gfsh.
- * 
- * @see javax.management.MBeanServerConnection
- * @see javax.management.remote.JMXConnector
- * @see org.apache.geode.distributed.AbstractLauncher
- * @see org.apache.geode.distributed.LocatorLauncher
- * @see org.apache.geode.distributed.ServerLauncher
- * @see org.apache.geode.internal.AvailablePortHelper
- * @see org.apache.geode.management.internal.cli.shell.Gfsh
- * @see org.apache.geode.management.internal.cli.commands.CliCommandTestBase
- * @see org.apache.geode.management.internal.cli.util.CommandStringBuilder
- * @since GemFire 7.0
- */
-@Category(DistributedTest.class)
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
-
-  protected static final DateFormat TIMESTAMP = new SimpleDateFormat("yyyyMMddHHmmssSSS");
-
-  private final Queue<Integer> processIds = new ConcurrentLinkedDeque<>();
-
-  protected static String getMemberId(final int jmxManagerPort, final String memberName)
-      throws Exception {
-    return getMemberId(InetAddress.getLocalHost().getHostName(), jmxManagerPort, memberName);
-  }
-
-  protected static String getMemberId(final String jmxManagerHost, final int jmxManagerPort,
-      final String memberName) throws Exception {
-    JMXConnector connector = null;
-
-    try {
-      connector = JMXConnectorFactory.connect(new JMXServiceURL(String.format(
-          "service:jmx:rmi://%1$s/jndi/rmi://%1$s:%2$d/jmxrmi", jmxManagerHost, jmxManagerPort)));
-
-      MBeanServerConnection connection = connector.getMBeanServerConnection();
-
-      ObjectName objectNamePattern = ObjectName.getInstance("GemFire:type=Member,*");
-
-      QueryExp query = Query.eq(Query.attr("Name"), Query.value(memberName));
-
-      Set<ObjectName> objectNames = connection.queryNames(objectNamePattern, query);
-
-      assertNotNull(objectNames);
-      assertFalse(objectNames.isEmpty());
-      assertEquals(1, objectNames.size());
-
-      // final ObjectName objectName = ObjectName.getInstance("GemFire:type=Member,Name=" +
-      // memberName);
-      ObjectName objectName = objectNames.iterator().next();
-
-      // System.err.printf("ObjectName for Member with Name (%1$s) is %2$s%n", memberName,
-      // objectName);
-
-      return ObjectUtils.toString(connection.getAttribute(objectName, "Id"));
-    } finally {
-      IOUtils.close(connector);
-    }
-  }
-
-  @Override
-  public final void postTearDown() throws Exception {
-    Integer pid;
-
-    while ((pid = processIds.poll()) != null) {
-      if (ProcessUtils.isProcessAlive(pid)) {
-        try {
-          String killCommand = String.format("%1$s %2$d",
-              SystemUtils.isWindows() ? "taskkill /F /PID" : "kill -9", pid);
-          Runtime.getRuntime().exec(killCommand);
-        } catch (Throwable ignore) {
-        }
-      }
-    }
-  }
-
-  @SuppressWarnings("unused")
-  protected void assertStatus(final LocatorState expectedStatus, final LocatorState actualStatus) {
-    assertEquals(expectedStatus.getStatus(), actualStatus.getStatus());
-    assertEquals(expectedStatus.getTimestamp(), actualStatus.getTimestamp());
-    assertEquals(expectedStatus.getServiceLocation(), actualStatus.getServiceLocation());
-    assertTrue(ObjectUtils.equalsIgnoreNull(expectedStatus.getPid(), actualStatus.getPid()));
-    assertEquals(expectedStatus.getUptime(), actualStatus.getUptime());
-    assertEquals(expectedStatus.getWorkingDirectory(), actualStatus.getWorkingDirectory());
-    assertEquals(expectedStatus.getJvmArguments(), actualStatus.getJvmArguments());
-    assertEquals(expectedStatus.getClasspath(), actualStatus.getClasspath());
-    assertEquals(expectedStatus.getGemFireVersion(), actualStatus.getGemFireVersion());
-    assertEquals(expectedStatus.getJavaVersion(), actualStatus.getJavaVersion());
-  }
-
-  protected Integer readPid(final File workingDirectory) throws IOException {
-    assertTrue(String.format("The working directory (%1$s) must exist!", workingDirectory),
-        workingDirectory != null && workingDirectory.isDirectory());
-
-    File[] files = workingDirectory.listFiles(pathname -> (pathname != null && pathname.isFile()
-        && pathname.getAbsolutePath().endsWith(".pid")));
-
-    assertNotNull(files);
-    assertTrue(files.length > 0);
-
-    File pidFile = files[0];
-
-    BufferedReader fileReader = null;
-
-    try {
-      fileReader = new BufferedReader(new FileReader(pidFile), 1024);
-      return Integer.parseInt(fileReader.readLine().trim());
-    } catch (Exception ignore) {
-      return null;
-    } finally {
-      IOUtils.close(fileReader);
-    }
-  }
-
-  protected String serviceStateStatusStringNormalized(final ServiceState serviceState) {
-    return serviceStateStatusStringNormalized(serviceState.toString());
-  }
-
-  protected String serviceStateStatusStringNormalized(final String serviceStateStatus) {
-    assertNotNull(serviceStateStatus);
-    assertTrue("serviceStateStatus is missing 'Uptime': " + serviceStateStatus,
-        serviceStateStatus.contains("Uptime"));
-    assertTrue("serviceStateStatus is missing 'JVM Arguments': " + serviceStateStatus,
-        serviceStateStatus.contains("JVM Arguments"));
-
-    return serviceStateStatus.substring(0, serviceStateStatus.indexOf("Uptime"))
-        .concat(serviceStateStatus.substring(serviceStateStatus.indexOf("JVM Arguments")));
-  }
-
-  protected Status stopLocator(final File workingDirectory) {
-    return stopLocator(IOUtils.tryGetCanonicalPathElseGetAbsolutePath(workingDirectory));
-  }
-
-  protected Status stopLocator(final String workingDirectory) {
-    return waitForGemFireProcessToStop(
-        new Builder().setCommand(Command.STOP).setWorkingDirectory(workingDirectory).build().stop(),
-        workingDirectory);
-  }
-
-  protected Status stopServer(final String workingDirectory) {
-    return waitForGemFireProcessToStop(
-        new ServerLauncher.Builder().setCommand(ServerLauncher.Command.STOP)
-            .setWorkingDirectory(workingDirectory).build().stop(),
-        workingDirectory);
-  }
-
-  protected String toString(final Result result) {
-    assert result != null : "The Result object from the command execution cannot be null!";
-
-    StringBuilder buffer = new StringBuilder(StringUtils.LINE_SEPARATOR);
-
-    while (result.hasNextLine()) {
-      buffer.append(result.nextLine());
-      buffer.append(StringUtils.LINE_SEPARATOR);
-    }
-
-    return buffer.toString();
-  }
-
-  protected Status waitForGemFireProcessToStop(final ServiceState serviceState,
-      final String workingDirectory) {
-    if (!Status.STOPPED.equals(serviceState.getStatus())) {
-      try {
-        final Integer pid = readPid(new File(workingDirectory));
-
-        if (pid != null) {
-          WaitCriterion waitCriteria = new WaitCriterion() {
-            @Override
-            public boolean done() {
-              return !ProcessUtils.isProcessAlive(pid);
-            }
-
-            @Override
-            public String description() {
-              return String.format("Waiting for GemFire Process with PID (%1$d) to stop.", pid);
-            }
-          };
-
-          waitForCriterion(waitCriteria, TimeUnit.SECONDS.toMillis(15),
-              TimeUnit.SECONDS.toMillis(5), false);
-
-          if (!waitCriteria.done()) {
-            processIds.offer(pid);
-          }
-        }
-      } catch (IOException ignore) {
-      }
-    }
-
-    return serviceState.getStatus();
-  }
-
-  protected void writePid(final File pidFile, final int pid) throws IOException {
-    assertTrue("The PID file must actually exist!", pidFile != null && pidFile.isFile());
-
-    FileWriter writer = null;
-
-    try {
-      writer = new FileWriter(pidFile, false);
-      writer.write(String.valueOf(pid));
-      writer.write(System.getProperty("line.separator"));
-      writer.flush();
-    } finally {
-      IOUtils.close(writer);
-    }
-  }
-
-  @Test
-  public void test000StartLocatorCapturesOutputOnError() throws IOException {
-    final int locatorPort = AvailablePortHelper.getRandomAvailableTCPPort();
-
-    String pathname = (getClass().getSimpleName() + "_" + getTestMethodName());
-    File workingDirectory = temporaryFolder.newFolder(pathname);
-
-    assertTrue(workingDirectory.isDirectory() || workingDirectory.mkdir());
-
-    File pidFile = new File(workingDirectory, ProcessType.LOCATOR.getPidFileName());
-
-    assertTrue(pidFile.createNewFile());
-
-    writePid(pidFile, getPidOrOne());
-    pidFile.deleteOnExit();
-
-    assertTrue(pidFile.isFile());
-
-    CommandStringBuilder command = new CommandStringBuilder(CliStrings.START_LOCATOR);
-
-    command.addOption(CliStrings.START_LOCATOR__MEMBER_NAME, pathname);
-    command.addOption(CliStrings.START_LOCATOR__DIR, workingDirectory.getCanonicalPath());
-    command.addOption(CliStrings.START_LOCATOR__PORT, String.valueOf(locatorPort));
-    command.addOption(CliStrings.START_LOCATOR__ENABLE__SHARED__CONFIGURATION,
-        Boolean.FALSE.toString());
-    command.addOption(CliStrings.START_LOCATOR__J,
-        "-D" + DistributionConfig.GEMFIRE_PREFIX + "http-service-port=0");
-    command.addOption(CliStrings.START_LOCATOR__J, "-D" + DistributionConfig.GEMFIRE_PREFIX
-        + "jmx-manager-port=" + AvailablePortHelper.getRandomAvailableTCPPort());
-
-    CommandResult result = executeCommand(command.toString());
-
-    assertNotNull(result);
-    assertEquals(Result.Status.ERROR, result.getStatus());
-
-    String resultString = toString(result);
-
-    assertTrue(resultString,
-        resultString.contains(
-            "Exception in thread \"main\" java.lang.RuntimeException: A PID file already exists and a Locator may be running in "
-                + IOUtils.tryGetCanonicalFileElseGetAbsoluteFile(workingDirectory)));
-    assertTrue(resultString,
-        resultString.contains(
-            "Caused by: org.apache.geode.internal.process.FileAlreadyExistsException: Pid file already exists: "
-                + IOUtils.tryGetCanonicalFileElseGetAbsoluteFile(pidFile)));
-  }
-
-  /*
-   * This method makes an effort to get the PID of the running process. If it is unable to determine
-   * accurately, it simply returns 1.
-   */
-  private int getPidOrOne() {
-    int pid = 1;
-    String[] name = ManagementFactory.getRuntimeMXBean().getName().split("@");
-    if (name.length > 1) {
-      try {
-        pid = Integer.parseInt(name[0]);
-      } catch (NumberFormatException nex) {
-        // Ignored
-      }
-    }
-
-    return pid;
-  }
-
-  @Test
-  public void test001StartLocatorFailsFastOnMissingGemFirePropertiesFile() throws IOException {
-    String gemfirePropertiesPathname = "/path/to/missing/gemfire.properties";
-
-    CommandStringBuilder command = new CommandStringBuilder(CliStrings.START_LOCATOR);
-    String pathName = getClass().getSimpleName().concat("_").concat(getTestMethodName());
-    final File workingDirectory = temporaryFolder.newFolder(pathName);
-
-    command.addOption(CliStrings.START_LOCATOR__MEMBER_NAME, pathName);
-    command.addOption(CliStrings.START_LOCATOR__DIR, workingDirectory.getCanonicalPath());
-    command.addOption(CliStrings.START_LOCATOR__PORT, "0");
-    command.addOption(CliStrings.START_LOCATOR__PROPERTIES, gemfirePropertiesPathname);
-    command.addOption(CliStrings.START_LOCATOR__J,
-        "-D" + DistributionConfig.GEMFIRE_PREFIX + "http-service-port=0");
-    command.addOption(CliStrings.START_LOCATOR__J,
-        "-D" + DistributionConfig.GEMFIRE_PREFIX + "jmx-manager=false");
-    command.addOption(CliStrings.START_LOCATOR__J,
-        "-D" + DistributionConfig.GEMFIRE_PREFIX + "jmx-manager-port=0");
-    command.addOption(CliStrings.START_LOCATOR__J,
-        "-D" + DistributionConfig.GEMFIRE_PREFIX + "jmx-manager-start=false");
-
-    CommandResult result = executeCommand(command.toString());
-
-    assertNotNull(result);
-    assertEquals(Result.Status.ERROR, result.getStatus());
-
-    String resultString = toString(result);
-
-    assertTrue(resultString,
-        resultString
-            .contains(MessageFormat.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE,
-                StringUtils.EMPTY, gemfirePropertiesPathname)));
-  }
-
-  /**
-   * Test to verify GEODE-2138
-   * 
-   * @throws IOException
-   */
-  @Test
-  public void testVersionTitleForStartServerAndLocator() throws IOException {
-    final int locatorPort = AvailablePortHelper.getRandomAvailableTCPPort();
-
-    String pathname = (getClass().getSimpleName() + "_" + getTestMethodName());
-    String pathnameLoc = pathname + "_loc";
-    String pathnameSer = pathname + "_ser";
-
-    File workingDirectoryLoc = temporaryFolder.newFolder(pathnameLoc);
-    File workingDirectorySer = temporaryFolder.newFolder(pathnameSer);
-
-    assertTrue(workingDirectoryLoc.isDirectory() || workingDirectoryLoc.mkdir());
-    assertTrue(workingDirectorySer.isDirectory() || workingDirectorySer.mkdir());
-
-    try {
-      // verify the start locator output does not contain string "gemfire"
-      CommandStringBuilder locCommand = new CommandStringBuilder(CliStrings.START_LOCATOR);
-      locCommand.addOption(CliStrings.START_LOCATOR__MEMBER_NAME, pathnameLoc);
-      locCommand.addOption(CliStrings.START_LOCATOR__CONNECT, Boolean.FALSE.toString());
-      locCommand.addOption(CliStrings.START_LOCATOR__DIR, workingDirectoryLoc.getCanonicalPath());
-      locCommand.addOption(CliStrings.START_LOCATOR__PORT, String.valueOf(locatorPort));
-
-      CommandResult locResult = executeCommand(locCommand.toString());
-      assertNotNull(locResult);
-      assertEquals(Result.Status.OK, locResult.getStatus());
-      String locatorOutput = toString(locResult);
-      assertNotNull(locatorOutput);
-      assertTrue("Locator output was: " + locatorOutput, !locatorOutput.contains("Gemfire"));
-
-      // verify the start server output does not contain string "gemfire"
-      CommandStringBuilder serCommand = new CommandStringBuilder(CliStrings.START_SERVER);
-      serCommand.addOption(CliStrings.START_SERVER__NAME, pathnameSer);
-      serCommand.addOption(CliStrings.START_SERVER__DIR, workingDirectorySer.getCanonicalPath());
-
-      CommandResult serResult = executeCommand(serCommand.toString());
-      assertNotNull(serResult);
-      assertEquals(Result.Status.OK, serResult.getStatus());
-      String serverOutput = toString(serResult);
-
-      assertTrue("Server start output was: " + serverOutput, !serverOutput.contains("Gemfire"));
-    } finally {
-      stopLocator(workingDirectoryLoc);
-      stopServer(IOUtils.tryGetCanonicalPathElseGetAbsolutePath(workingDirectorySer));
-    }
-  }
-
-  @Test
-  public void test002StartLocatorFailsFastOnMissingGemFireSecurityPropertiesFile()
-      throws IOException {
-    String gemfireSecurityPropertiesPathname = "/path/to/missing/gemfire-security.properties";
-    String pathName = getClass().getSimpleName().concat("_").concat(getTestMethodName());
-    final File workingDirectory = temporaryFolder.newFolder(pathName);
-
-    CommandStringBuilder command = new CommandStringBuilder(CliStrings.START_LOCATOR);
-
-    command.addOption(CliStrings.START_LOCATOR__MEMBER_NAME, pathName);
-    command.addOption(CliStrings.START_LOCATOR__DIR, workingDirectory.getCanonicalPath());
-    command.addOption(CliStrings.START_LOCATOR__PORT, "0");
-    command.addOption(CliStrings.START_LOCATOR__SECURITY_PROPERTIES,
-        gemfireSecurityPropertiesPathname);
-    command.addOption(CliStrings.START_LOCATOR__J,
-        "-D" + DistributionConfig.GEMFIRE_PREFIX + "http-service-port=0");
-    command.addOption(CliStrings.START_LOCATOR__J,
-        "-D" + DistributionConfig.GEMFIRE_PREFIX + "jmx-manager=false");
-    command.addOption(CliStrings.START_LOCATOR__J,
-        "-D" + DistributionConfig.GEMFIRE_PREFIX + "jmx-manager-port=0");
-    command.addOption(CliStrings.START_LOCATOR__J,
-        "-D" + DistributionConfig.GEMFIRE_PREFIX + "jmx-manager-start=false");
-
-    CommandResult result = executeCommand(command.toString());
-
-    assertNotNull(result);
-    assertEquals(Result.Status.ERROR, result.getStatus());
-
-    String resultString = toString(result);
-
-    assertTrue(resultString,
-        resultString
-            .contains(MessageFormat.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE,
-                "Security ", gemfireSecurityPropertiesPathname)));
-  }
-
-  @Test
-  public void test003StartServerFailsFastOnMissingCacheXmlFile() throws IOException {
-    String cacheXmlPathname = "/path/to/missing/cache.xml";
-
-    CommandStringBuilder command = new CommandStringBuilder(CliStrings.START_SERVER);
-    String pathName = getClass().getSimpleName().concat("_").concat(getTestMethodName());
-    final File workingDirectory = temporaryFolder.newFolder(pathName);
-
-    command.addOption(CliStrings.START_SERVER__NAME, pathName);
-    command.addOption(CliStrings.START_SERVER__DIR, workingDirectory.getCanonicalPath());
-    command.addOption(CliStrings.START_SERVER__CACHE_XML_FILE, cacheXmlPathname);
-
-    CommandResult result = executeCommand(command.toString());
-
-    assertNotNull(result);
-    assertEquals(Result.Status.ERROR, result.getStatus());
-
-    String resultString = toString(result);
-
-    assertTrue(resultString, resultString
-        .contains(MessageFormat.format(CliStrings.CACHE_XML_NOT_FOUND_MESSAGE, cacheXmlPathname)));
-  }
-
-  @Test
-  public void test004StartServerFailsFastOnMissingGemFirePropertiesFile() throws IOException {
-    String gemfirePropertiesFile = "/path/to/missing/gemfire.properties";
-
-    CommandStringBuilder command = new CommandStringBuilder(CliStrings.START_SERVER);
-
-    String pathName = getClass().getSimpleName().concat("_").concat(getTestMethodName());
-    final File workingDirectory = temporaryFolder.newFolder(pathName);
-
-    command.addOption(CliStrings.START_SERVER__NAME, pathName);
-    command.addOption(CliStrings.START_SERVER__DIR, workingDirectory.getCanonicalPath());
-    command.addOption(CliStrings.START_SERVER__PROPERTIES, gemfirePropertiesFile);
-
-    CommandResult result = executeCommand(command.toString());
-
-    assertNotNull(result);
-    assertEquals(Result.Status.ERROR, result.getStatus());
-
-    String resultString = toString(result);
-
-    assertTrue(resultString,
-        resultString
-            .contains(MessageFormat.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE,
-                StringUtils.EMPTY, gemfirePropertiesFile)));
-  }
-
-  @Test
-  public void testStartServerFailsFastOnMissingPassword() throws IOException {
-
-    CommandStringBuilder command = new CommandStringBuilder(CliStrings.START_SERVER);
-
-    String pathName = getClass().getSimpleName().concat("_").concat(getTestMethodName());
-    final File workingDirectory = temporaryFolder.newFolder(pathName);
-
-    command.addOption(CliStrings.START_SERVER__NAME, pathName);
-    command.addOption(CliStrings.START_SERVER__DIR, workingDirectory.getCanonicalPath());
-    command.addOption(CliStrings.START_SERVER__USERNAME, "test");
-
-    CommandResult result = executeCommand(command.toString());
-
-    assertNotNull(result);
-    assertEquals(Result.Status.ERROR, result.getStatus());
-
-    String resultString = toString(result);
-
-    assertTrue(resultString, resultString.contains("password must be specified"));
-  }
-
-  @Test
-  public void test005StartServerFailsFastOnMissingGemFireSecurityPropertiesFile()
-      throws IOException {
-    String gemfireSecuritiesPropertiesFile = "/path/to/missing/gemfire-securities.properties";
-
-    CommandStringBuilder command = new CommandStringBuilder(CliStrings.START_SERVER);
-
-    String pathName = getClass().getSimpleName().concat("_").concat(getTestMethodName());
-    final File workingDirectory = temporaryFolder.newFolder(pathName);
-
-    command.addOption(CliStrings.START_SERVER__NAME, pathName);
-    command.addOption(CliStrings.START_SERVER__DIR, workingDirectory.getCanonicalPath());
-    command.addOption(CliStrings.START_SERVER__SECURITY_PROPERTIES,
-        gemfireSecuritiesPropertiesFile);
-
-    CommandResult result = executeCommand(command.toString());
-
-    assertNotNull(result);
-    assertEquals(Result.Status.ERROR, result.getStatus());
-
-    String resultString = toString(result);
-
-    assertTrue(resultString,
-        resultString
-            .contains(MessageFormat.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE,
-                "Security ", gemfireSecuritiesPropertiesFile)));
-  }
-
-  @Test
-  public void test006StartLocatorInRelativeDirectory() {
-    final int locatorPort = AvailablePortHelper.getRandomAvailableTCPPort();
-
-    String pathname = (getClass().getSimpleName() + "_" + getTestMethodName());
-    File workingDirectory = new File(pathname);
-
-    assertTrue(workingDirectory.isDirectory() || workingDirectory.mkdir());
-
-    try {
-      CommandStringBuilder command = new CommandStringBuilder(CliStrings.START_LOCATOR);
-
-      command.addOption(CliStrings.START_LOCATOR__MEMBER_NAME, pathname);
-      command.addOption(CliStrings.START_LOCATOR__CONNECT, Boolean.FALSE.toString());
-      command.addOption(CliStrings.START_LOCATOR__DIR, pathname);
-      command.addOption(CliStrings.START_LOCATOR__PORT, String.valueOf(locatorPort));
-      command.addOption(CliStrings.START_LOCATOR__ENABLE__SHARED__CONFIGURATION,
-          Boolean.FALSE.toString());
-      command.addOption(CliStrings.START_LOCATOR__J,
-          "-D" + DistributionConfig.GEMFIRE_PREFIX + "http-service-port=0");
-      command.addOption(CliStrings.START_LOCATOR__J, "-D" + DistributionConfig.GEMFIRE_PREFIX
-          + "jmx-manager-port=" + AvailablePortHelper.getRandomAvailableTCPPort());
-
-      CommandResult result = executeCommand(command.toString());
-
-      assertNotNull(result);
-      assertEquals(Result.Status.OK, result.getStatus());
-
-      String locatorOutput = toString(result);
-
-      assertNotNull(locatorOutput);
-      assertTrue("Locator output was: " + locatorOutput, locatorOutput.contains(
-          "Locator in " + IOUtils.tryGetCanonicalFileElseGetAbsoluteFile(workingDirectory)));
-    } finally {
-      stopLocator(workingDirectory);
-    }
-  }
-
-  @Test
-  public void test007StatusLocatorUsingMemberNameIDWhenGfshIsNotConnected() {
-    CommandResult result =
-        executeCommand(CliStrings.STATUS_LOCATOR + " --name=" + getTestMethodName());
-
-    assertNotNull(result);
-    assertEquals(Result.Status.ERROR, result.getStatus());
-    assertEquals(
-        CliStrings.format(CliStrings.STATUS_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, "Locator"),
-        StringUtils.trim(toString(result)));
-  }
-
-  @Test
-  public void test008StatusLocatorUsingMemberName() throws IOException {
-    final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
-
-    final int jmxManagerPort = ports[0];
-    final int locatorPort = ports[1];
-
-    String pathname = (getClass().getSimpleName() + "_" + getTestMethodName());
-    File workingDirectory = temporaryFolder.newFolder(pathname);
-
-    assertTrue(workingDirectory.isDirectory() || workingDirectory.mkdir());
-
-    try {
-      CommandStringBuilder command = new CommandStringBuilder(CliStrings.START_LOCATOR);
-
-      command.addOption(CliStrings.START_LOCATOR__MEMBER_NAME, pathname);
-      command.addOption(CliStrings.START_LOCATOR__CONNECT, Boolean.FALSE.toString());
-      command.addOption(CliStrings.START_LOCATOR__DIR, workingDirectory.getCanonicalPath());
-      command.addOption(CliStrings.START_LOCATOR__PORT, String.valueOf(locatorPort));
-      command.addOption(CliStrings.START_LOCATOR__ENABLE__SHARED__CONFIGURATION,
-          Boolean.FALSE.toString());
-      command.addOption(CliStrings.START_LOCATOR__FORCE, Boolean.TRUE.toString());
-      command.addOption(CliStrings.START_LOCATOR__J,
-          "-D" + DistributionConfig.GEMFIRE_PREFIX + "http-service-port=0");
-      command.addOption(CliStrings.START_LOCATOR__J,
-          "-D" + DistributionConfig.GEMFIRE_PREFIX + "jmx-manager-port=" + jmxManagerPort);
-
-      CommandResult result = executeCommand(command.toString());
-
-      assertNotNull(result);
-      assertEquals(Result.Status.OK, result.getStatus());
-
-      LocatorLauncher locatorLauncher = new LocatorLauncher.Builder()
-          .setCommand(LocatorLauncher.Command.STATUS).setBindAddress(null).setPort(locatorPort)
-          .setWorkingDirectory(workingDirectory.getPath()).build();
-
-      assertNotNull(locatorLauncher);
-
-      LocatorState expectedLocatorState =
-          locatorLauncher.waitOnStatusResponse(60, 10, TimeUnit.SECONDS);
-
-      assertNotNull(expectedLocatorState);
-      assertEquals(Status.ONLINE, expectedLocatorState.getStatus());
-
-      result = executeCommand(
-          String.format("%1$s --locator=localhost[%2$d]", CliStrings.CONNECT, locatorPort));
-
-      assertNotNull(result);
-      assertEquals(Result.Status.OK, result.getStatus());
-
-      result = executeCommand(
-          String.format("%1$s --name=invalidLocatorMemberName", CliStrings.STATUS_LOCATOR));
-
-      assertNotNull(result);
-      assertEquals(Result.Status.ERROR, result.getStatus());
-      assertEquals(
-          CliStrings.format(CliStrings.STATUS_LOCATOR__NO_LOCATOR_FOUND_FOR_MEMBER_ERROR_MESSAGE,
-              "invalidLocatorMemberName"),
-          StringUtils.trim(toString(result)));
-
-      result =
-          executeCommand(String.format("%1$s --name=%2$s", CliStrings.STATUS_LOCATOR, pathname));
-
-      assertNotNull(result);
-      assertEquals(Result.Status.OK, result.getStatus());
-      assertTrue(serviceStateStatusStringNormalized(toString(result))
-          .contains(serviceStateStatusStringNormalized(expectedLocatorState)));
-    } finally {
-      stopLocator(workingDirectory);
-    }
-  }
-
-  @Test
-  public void test009StatusLocatorUsingMemberId() throws Exception {
-    final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
-
-    final int jmxManagerPort = ports[0];
-    final int locatorPort = ports[1];
-
-    String pathname = (getClass().getSimpleName() + "_" + getTestMethodName());
-    File workingDirectory = temporaryFolder.newFolder(pathname);
-
-    assertTrue(workingDirectory.isDirectory() || workingDirectory.mkdir());
-
-    try {
-      CommandStringBuilder command = new CommandStringBuilder(CliStrings.START_LOCATOR);
-
-      command.addOption(CliStrings.START_LOCATOR__MEMBER_NAME, pathname);
-      command.addOption(CliStrings.START_LOCATOR__CONNECT, Boolean.FALSE.toString());
-      command.addOption(CliStrings.START_LOCATOR__DIR, workingDirectory.getCanonicalPath());
-      command.addOption(CliStrings.START_LOCATOR__PORT, String.valueOf(locatorPort));
-      command.addOption(CliStrings.START_LOCATOR__ENABLE__SHARED__CONFIGURATION,
-          Boolean.FALSE.toString());
-      command.addOption(CliStrings.START_LOCATOR__FORCE, Boolean.TRUE.toString());
-      command.addOption(CliStrings.START_LOCATOR__J,
-          "-D" + DistributionConfig.GEMFIRE_PREFIX + "http-service-port=0");
-      command.addOption(CliStrings.START_LOCATOR__J,
-          "-D" + DistributionConfig.GEMFIRE_PREFIX + "jmx-manager-port=" + jmxManagerPort);
-
-      CommandResult result = executeCommand(command.toString());
-
-      assertNotNull(result);
-      assertEquals(Result.Status.OK, result.getStatus());
-
-      LocatorLauncher locatorLauncher = new LocatorLauncher.Builder()
-          .setCommand(LocatorLauncher.Command.STATUS).setBindAddress(null).setPort(locatorPort)
-          .setWorkingDirectory(workingDirectory.getPath()).build();
-
-      assertNotNull(locatorLauncher);
-
-      LocatorState expectedLocatorState =
-          locatorLauncher.waitOnStatusResponse(60, 10, TimeUnit.SECONDS);
-
-      assertNotNull(expectedLocatorState);
-      assertEquals(Status.ONLINE, expectedLocatorState.getStatus());
-
-      result = executeCommand(
-          String.format("%1$s --locator=localhost[%2$d]", CliStrings.CONNECT, locatorPort));
-
-      assertNotNull(result);
-      assertEquals(Result.Status.OK, result.getStatus());
-
-      result = executeCommand(String.format("%1$s --name=%2$s", CliStrings.STATUS_LOCATOR,
-          getMemberId(jmxManagerPort, pathname)));
-
-      assertNotNull(result);
-      assertEquals(Result.Status.OK, result.getStatus());
-      assertTrue(serviceStateStatusStringNormalized(toString(result))
-          .contains(serviceStateStatusStringNormalized(expectedLocatorState)));
-    } finally {
-      stopLocator(workingDirectory);
-    }
-  }
-
-  @Test
-  public void test010StopLocatorUsingMemberNameIDWhenGfshIsNotConnected() {
-    CommandResult result =
-        executeCommand(CliStrings.STOP_LOCATOR + " --name=" + getTestMethodName());
-
-    assertNotNull(result);
-    assertEquals(Result.Status.ERROR, result.getStatus());
-    assertEquals(
-        CliStrings.format(CliStrings.STOP_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, "Locator"),
-        StringUtils.trim(toString(result)));
-  }
-
-  @Test
-  public void test011StopLocatorUsingMemberName() throws IOException {
-    final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
-
-    final int jmxManagerPort = ports[0];
-    final int locatorPort = ports[1];
-
-    String pathname = (getClass().getSimpleName() + "_" + getTestMethodName());
-    File workingDirectory = temporaryFolder.newFolder(pathname);
-
-    try {
-      assertTrue(workingDirectory.isDirectory() || workingDirectory.mkdir());
-
-      CommandStringBuilder command = new CommandStringBuilder(CliStrings.START_LOCATOR);
-
-      command.addOption(CliStrings.START_LOCATOR__MEMBER_NAME, pathname);
-      command.addOption(CliStrings.START_LOCATOR__CONNECT, Boolean.FALSE.toString());
-      command.addOption(CliStrings.START_LOCATOR__DIR, workingDirectory.getCanonicalPath());
-      command.addOption(CliStrings.START_LOCATOR__PORT, String.valueOf(locatorPort));
-      command.addOption(CliStrings.START_LOCATOR__ENABLE__SHARED__CONFIGURATION,
-          Boolean.FALSE.toString());
-      command.addOption(CliStrings.START_LOCATOR__FORCE, Boolean.TRUE.toString());
-      command.addOption(CliStrings.START_LOCATOR__J,
-          "-D" + DistributionConfig.GEMFIRE_PREFIX + "http-service-port=0");
-      command.addOption(CliStrings.START_LOCATOR__J,
-          "-D" + DistributionConfig.GEMFIRE_PREFIX + "jmx-manager-port=" + jmxManagerPort);
-
-      CommandResult result = executeCommand(command.toString());
-
-      assertNotNull(result);
-      assertEquals(Result.Status.OK, result.getStatus());
-
-      final LocatorLauncher locatorLauncher =
-          new Builder().setCommand(Command.STOP).setBindAddress(null).setPort(locatorPort)
-              .setWorkingDirectory(workingDirectory.getPath()).build();
-
-      assertNotNull(locatorLauncher);
-
-      LocatorState locatorStatus = locatorLauncher.waitOnStatusResponse(60, 10, TimeUnit.SECONDS);
-
-      assertNotNull(locatorStatus);
-      assertEquals(Status.ONLINE, locatorStatus.getStatus());
-
-      result = executeCommand(
-          String.format("%1$s --locator=localhost[%2$d]", CliStrings.CONNECT, locatorPort));
-
-      assertNotNull(result);
-      assertEquals(Result.Status.OK, result.getStatus());
-
-      result = executeCommand(
-          String.format("%1$s --name=invalidLocatorMemberName", CliStrings.STOP_LOCATOR));
-
-      assertNotNull(result);
-      assertEquals(Result.Status.ERROR, result.getStatus());
-      assertEquals(
-          CliStrings.format(CliStrings.STOP_LOCATOR__NO_LOCATOR_FOUND_FOR_MEMBER_ERROR_MESSAGE,
-              "invalidLocatorMemberName"),
-          StringUtils.trim(toString(result)));
-
-      locatorStatus = locatorLauncher.status();
-
-      assertNotNull(locatorStatus);
-      assertEquals(Status.ONLINE, locatorStatus.getStatus());
-
-      result = executeCommand(String.format("%1$s --name=%2$s", CliStrings.STOP_LOCATOR, pathname));
-
-      assertNotNull(result);
-      assertEquals(Result.Status.OK, result.getStatus());
-
-      // TODO figure out what output to assert and validate on now that 'stop locator' uses Gfsh's
-      // logger
-      // and standard err/out...
-      // assertIndexDetailsEquals(CliStrings.format(CliStrings.STOP_LOCATOR__SHUTDOWN_MEMBER_MESSAGE,
-      // pathname),
-      // StringUtils.trim(toString(result)));
-
-      WaitCriterion waitCriteria = new WaitCriterion() {
-        @Override
-        public boolean done() {
-          final LocatorState locatorStatus = locatorLauncher.status();
-          return (locatorStatus != null && Status.NOT_RESPONDING.equals(locatorStatus.getStatus()));
-        }
-
-        @Override
-        public String description() {
-          return "wait for the Locator to stop; the Locator will no longer respond after it stops";
-        }
-      };
-
-      waitForCriterion(waitCriteria, 15 * 1000, 5000, true);
-
-      locatorStatus = locatorLauncher.status();
-
-      assertNotNull(locatorStatus);
-      assertEquals(Status.NOT_RESPONDING, locatorStatus.getStatus());
-    } finally {
-    }
-
-  }
-
-  // @see Trac Bug # 46760
-  @Test
-  public void test012StopLocatorUsingMemberId() throws Exception {
-    final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
-
-    final int jmxManagerPort = ports[0];
-    final int locatorPort = ports[1];
-
-    String pathname = (getClass().getSimpleName() + "_" + getTestMethodName());
-    File workingDirectory = temporaryFolder.newFolder(pathname);
-
-    try {
-      assertTrue(workingDirectory.isDirectory() || workingDirectory.mkdir());
-
-      CommandStringBuilder command = new CommandStringBuilder(CliStrings.START_LOCATOR);
-
-      command.addOption(CliStrings.START_LOCATOR__MEMBER_NAME, pathname);
-      command.addOption(CliStrings.START_LOCATOR__CONNECT, Boolean.FALSE.toString());
-      command.addOption(CliStrings.START_LOCATOR__DIR, workingDirectory.getCanonicalPath());
-      command.addOption(CliStrings.START_LOCATOR__PORT, String.valueOf(locatorPort));
-      command.addOption(CliStrings.START_LOCATOR__ENABLE__SHARED__CONFIGURATION,
-          Boolean.FALSE.toString());
-      command.addOption(CliStrings.START_LOCATOR__FORCE, Boolean.TRUE.toString());
-      command.addOption(CliStrings.START_LOCATOR__J,
-          "-D" + DistributionConfig.GEMFIRE_PREFIX + "http-service-port=0");
-      command.addOption(CliStrings.START_LOCATOR__J,
-          "-D" + DistributionConfig.GEMFIRE_PREFIX + "jmx-manager-port=" + jmxManagerPort);
-
-      CommandResult result = executeCommand(command.toString());
-
-      assertNotNull(result);
-      assertEquals(Result.Status.OK, result.getStatus());
-
-      final LocatorLauncher locatorLauncher =
-          new Builder().setCommand(Command.STOP).setBindAddress(null).setPort(locatorPort)
-              .setWorkingDirectory(workingDirectory.getPath()).build();
-
-      assertNotNull(locatorLauncher);
-
-      LocatorState locatorState = locatorLauncher.waitOnStatusResponse(60, 10, TimeUnit.SECONDS);
-
-      assertNotNull(locatorState);
-      assertEquals(Status.ONLINE, locatorState.getStatus());
-
-      result = executeCommand(
-          String.format("%1$s --locator=localhost[%2$d]", CliStrings.CONNECT, locatorPort));
-
-      assertNotNull(result);
-      assertEquals(Result.Status.OK, result.getStatus());
-
-      String memberId = getMemberId(jmxManagerPort, pathname);
-
-      result = executeCommand(String.format("%1$s --name=%2$s", CliStrings.STOP_LOCATOR, memberId));
-
-      assertNotNull(result);
-      assertEquals(Result.Status.OK, result.getStatus());
-
-      // TODO figure out what output to assert and validate on now that 'stop locator' uses Gfsh's
-      // logger
-      // and standard err/out...
-      // assertIndexDetailsEquals(CliStrings.format(CliStrings.STOP_LOCATOR__SHUTDOWN_MEMBER_MESSAGE,
-      // memberId),
-      // StringUtils.trim(toString(result)));
-
-      WaitCriterion waitCriteria = new WaitCriterion() {
-        @Override
-        public boolean done() {
-          LocatorState locatorState = locatorLauncher.status();
-          return (locatorState != null && Status.NOT_RESPONDING.equals(locatorState.getStatus()));
-        }
-
-        @Override
-        public String description() {
-          return "wait for the Locator to stop; the Locator will no longer respond after it stops";
-        }
-      };
-
-      waitForCriterion(waitCriteria, 15 * 1000, 5000, true);
-
-      locatorState = locatorLauncher.status();
-
-      assertNotNull(locatorState);
-      assertEquals(Status.NOT_RESPONDING, locatorState.getStatus());
-    } finally {
-    }
-  }
-
-  @Test
-  public void test014GemFireServerJvmProcessTerminatesOnOutOfMemoryError() throws Exception {
-    int ports[] = AvailablePortHelper.getRandomAvailableTCPPorts(2);
-    final int serverPort = ports[0];
-    final int locatorPort = ports[1];
-
-    String pathname = getClass().getSimpleName().concat("_").concat(getTestMethodName());
-    File workingDirectory = temporaryFolder.newFolder(pathname);
-
-    assertTrue(workingDirectory.isDirectory() || workingDirectory.mkdir());
-
-    CommandStringBuilder command = new CommandStringBuilder(CliStrings.START_SERVER);
-
-    command.addOption(CliStrings.START_SERVER__NAME,
-        pathname + TIMESTAMP.format(Calendar.getInstance().getTime()));
-    command.addOption(CliStrings.START_SERVER__SERVER_PORT, String.valueOf(serverPort));
-    command.addOption(CliStrings.START_SERVER__USE_CLUSTER_CONFIGURATION, Boolean.FALSE.toString());
-    command.addOption(CliStrings.START_SERVER__MAXHEAP, "10M");
-    command.addOption(CliStrings.START_SERVER__LOG_LEVEL, "config");
-    command.addOption(CliStrings.START_SERVER__DIR, workingDirectory.getCanonicalPath());
-    command.addOption(CliStrings.START_SERVER__CACHE_XML_FILE,
-        IOUtils.tryGetCanonicalPathElseGetAbsolutePath(writeAndGetCacheXmlFile(workingDirectory)));
-    command.addOption(CliStrings.START_SERVER__INCLUDE_SYSTEM_CLASSPATH);
-    command.addOption(CliStrings.START_SERVER__J, "-D" + DistributionConfig.GEMFIRE_PREFIX + ""
-        + START_LOCATOR + "=localhost[" + locatorPort + "]");
-
-
-    CommandResult result = executeCommand(command.toString());
-    System.out.println("result=" + result);
-
-    assertNotNull(result);
-    assertEquals(Result.Status.OK, result.getStatus());
-
-    ServerLauncher serverLauncher =
-        new ServerLauncher.Builder().setCommand(ServerLauncher.Command.STATUS)
-            .setWorkingDirectory(IOUtils.tryGetCanonicalPathElseGetAbsolutePath(workingDirectory))
-            .build();
-
-    assertNotNull(serverLauncher);
-
-    ServerState serverState = serverLauncher.status();
-
-    assertNotNull(serverState);
-    assertEquals(Status.ONLINE, serverState.getStatus());
-
-    // Verify our GemFire Server JVM process is running!
-    assertTrue(serverState.isVmWithProcessIdRunning());
-
-    ClientCache clientCache = setupClientCache(pathname + String.valueOf(serverPort), serverPort);
-
-    assertNotNull(clientCache);
-
-    try {
-      Region<Long, String> exampleRegion = clientCache.getRegion("/Example");
-      // run the GemFire Server "out-of-town" with an OutOfMemoryError!
-      for (long index = 0; index < Long.MAX_VALUE; index++) {
-        exampleRegion.put(index, String.valueOf(index));
-      }
-    } catch (Exception ignore) {
-      System.err.printf("%1$s: %2$s%n", ignore.getClass().getName(), ignore.getMessage());
-    } finally {
-      clientCache.close();
-
-      final int serverPid = serverState.getPid();
-
-      WaitCriterion waitCriteria = new WaitCriterion() {
-        @Override
-        public boolean done() {
-          return !ProcessUtils.isProcessAlive(serverPid);
-        }
-
-        @Override
-        public String description() {
-          return "Wait for the GemFire Server JVM process that ran out-of-memory to exit.";
-        }
-      };
-
-      waitForCriterion(waitCriteria, TimeUnit.SECONDS.toMillis(30), TimeUnit.SECONDS.toMillis(10),
-          true);
-
-      // Verify our GemFire Server JVM process is was terminated!
-      assertFalse(serverState.isVmWithProcessIdRunning());
-
-      serverState = serverLauncher.status();
-
-      assertNotNull(serverState);
-      assertEquals(Status.NOT_RESPONDING, serverState.getStatus());
-    }
-  }
-
-  private File writeAndGetCacheXmlFile(final File workingDirectory) throws IOException {
-    File cacheXml = new File(workingDirectory, "cache.xml");
-    StringBuilder buffer = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
-
-    buffer.append(StringUtils.LINE_SEPARATOR);
-    buffer.append(
-        "<!DOCTYPE cache PUBLIC  \"-//GemStone Systems, Inc.//GemFire Declarative Caching 7.0//EN\"");
-    buffer.append(StringUtils.LINE_SEPARATOR);
-    buffer.append("  \"http://www.gemstone.com/dtd/cache7_0.dtd\">");
-    buffer.append(StringUtils.LINE_SEPARATOR);
-    buffer.append("<cache>");
-    buffer.append(StringUtils.LINE_SEPARATOR);
-    buffer.append("  <region name=\"Example\" refid=\"REPLICATE\"/>");
-    buffer.append(StringUtils.LINE_SEPARATOR);
-    buffer.append("</cache>");
-
-    BufferedWriter fileWriter = null;
-
-    try {
-      fileWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(cacheXml, false),
-          Charset.forName("UTF-8").newEncoder()));
-      fileWriter.write(buffer.toString());
-      fileWriter.flush();
-    } finally {
-      IOUtils.close(fileWriter);
-    }
-
-    return cacheXml;
-  }
-
-  private ClientCache setupClientCache(final String durableClientId, final int serverPort) {
-    ClientCache clientCache =
-        new ClientCacheFactory().set(DURABLE_CLIENT_ID, durableClientId).create();
-
-    PoolFactory poolFactory = PoolManager.createFactory();
-
-    poolFactory.setMaxConnections(10);
-    poolFactory.setMinConnections(1);
-    poolFactory.setReadTimeout(5000);
-    poolFactory.addServer("localhost", serverPort);
-
-    Pool pool = poolFactory.create("serverConnectionPool");
-
-    assertNotNull("The 'serverConnectionPool' was not properly configured and initialized!", pool);
-
-    ClientRegionFactory<Long, String> regionFactory =
-        clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY);
-
-    regionFactory.setPoolName(pool.getName());
-    regionFactory.setKeyConstraint(Long.class);
-    regionFactory.setValueConstraint(String.class);
-
-    Region<Long, String> exampleProxy = regionFactory.create("Example");
-
-    assertNotNull("The 'Example' Client Region was not properly configured and initialized",
-        exampleProxy);
-
-    return clientCache;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/210ff9f1/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommandTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommandTest.java b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommandTest.java
index 5a7c11c..e9ca6dc 100644
--- a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommandTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommandTest.java
@@ -56,9 +56,9 @@ public class StartLocatorCommandTest {
   public void testLocatorClasspathOrder() {
     String userClasspath = "/path/to/user/lib/app.jar:/path/to/user/classes";
     String expectedClasspath =
-        StartMemberUtils.getGemFireJarPath().concat(File.pathSeparator).concat(userClasspath)
+        locatorCommands.getGemFireJarPath().concat(File.pathSeparator).concat(userClasspath)
             .concat(File.pathSeparator).concat(System.getProperty("java.class.path"))
-            .concat(File.pathSeparator).concat(StartMemberUtils.CORE_DEPENDENCIES_JAR_PATHNAME);
+            .concat(File.pathSeparator).concat(StartMemberCommand.CORE_DEPENDENCIES_JAR_PATHNAME);
     String actualClasspath = locatorCommands.getLocatorClasspath(true, userClasspath);
     assertEquals(expectedClasspath, actualClasspath);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/210ff9f1/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/StartServerCommandTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/StartServerCommandTest.java b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/StartServerCommandTest.java
index e704248..a5012f3 100644
--- a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/StartServerCommandTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/StartServerCommandTest.java
@@ -54,8 +54,8 @@ public class StartServerCommandTest {
   public void testServerClasspathOrder() {
     String userClasspath = "/path/to/user/lib/app.jar:/path/to/user/classes";
     String expectedClasspath =
-        StartMemberUtils.getGemFireJarPath().concat(File.pathSeparator).concat(userClasspath)
-            .concat(File.pathSeparator).concat(StartMemberUtils.CORE_DEPENDENCIES_JAR_PATHNAME);
+        serverCommands.getGemFireJarPath().concat(File.pathSeparator).concat(userClasspath)
+            .concat(File.pathSeparator).concat(StartMemberCommand.CORE_DEPENDENCIES_JAR_PATHNAME);
     String actualClasspath = serverCommands.getServerClasspath(false, userClasspath);
     assertEquals(expectedClasspath, actualClasspath);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/210ff9f1/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/gfsh/ProcessLogger.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/gfsh/ProcessLogger.java b/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/gfsh/ProcessLogger.java
index 47f0304..85a94fa 100644
--- a/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/gfsh/ProcessLogger.java
+++ b/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/gfsh/ProcessLogger.java
@@ -36,14 +36,14 @@ public class ProcessLogger {
 
   private final Queue<String> stdOutLines = new ConcurrentLinkedQueue<>();
   private final Queue<String> stdErrorLines = new ConcurrentLinkedQueue<>();
-  private final StreamGobbler stdOutGobbler;
-  private final StreamGobbler stdErrGobbler;
 
   public ProcessLogger(Process process, String name) {
     this.logger = LOGGER_CONTEXT.getLogger(name);
 
-    this.stdOutGobbler = new StreamGobbler(process.getInputStream(), this::consumeInfoMessage);
-    this.stdErrGobbler = new StreamGobbler(process.getErrorStream(), this::consumeErrorMessage);
+    StreamGobbler stdOutGobbler =
+        new StreamGobbler(process.getInputStream(), this::consumeInfoMessage);
+    StreamGobbler stdErrGobbler =
+        new StreamGobbler(process.getErrorStream(), this::consumeErrorMessage);
 
     stdOutGobbler.startInNewThread();
     stdErrGobbler.startInNewThread();
@@ -84,7 +84,7 @@ public class ProcessLogger {
   }
 
   public List<String> getStdErrLines() {
-    return Lists.newArrayList(stdOutLines.iterator());
+    return Lists.newArrayList(stdErrorLines.iterator());
   }
 
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/210ff9f1/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommand.java
index 72ccfbb..5e1df6f 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommand.java
@@ -57,7 +57,7 @@ import org.apache.geode.management.internal.cli.util.HostUtils;
 import org.apache.geode.management.internal.configuration.utils.ClusterConfigurationStatusRetriever;
 import org.apache.geode.security.AuthenticationFailedException;
 
-public class StartLocatorCommand implements GfshCommand {
+public class StartLocatorCommand extends StartMemberCommand implements GfshCommand {
   @CliCommand(value = CliStrings.START_LOCATOR, help = CliStrings.START_LOCATOR__HELP)
   @CliMetaData(shellOnly = true,
       relatedTopic = {CliStrings.TOPIC_GEODE_LOCATOR, CliStrings.TOPIC_GEODE_LIFECYCLE})
@@ -123,10 +123,10 @@ public class StartLocatorCommand implements GfshCommand {
     try {
       if (StringUtils.isBlank(memberName)) {
         // when the user doesn't give us a name, we make one up!
-        memberName = StartMemberUtils.getNameGenerator().generate('-');
+        memberName = getNameGenerator().generate('-');
       }
 
-      workingDirectory = StartMemberUtils.resolveWorkingDir(workingDirectory, memberName);
+      workingDirectory = resolveWorkingDir(workingDirectory, memberName);
 
       if (gemfirePropertiesFile != null && !gemfirePropertiesFile.exists()) {
         return ResultBuilder.createUserErrorResult(
@@ -142,32 +142,28 @@ public class StartLocatorCommand implements GfshCommand {
 
       File locatorPidFile = new File(workingDirectory, ProcessType.LOCATOR.getPidFileName());
 
-      final int oldPid = StartMemberUtils.readPid(locatorPidFile);
+      final int oldPid = readPid(locatorPidFile);
 
       Properties gemfireProperties = new Properties();
 
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.GROUPS,
-          group);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.LOCATORS,
-          locators);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.LOG_LEVEL,
-          logLevel);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.MCAST_ADDRESS, mcastBindAddress);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.MCAST_PORT,
-          mcastPort);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION, enableSharedConfiguration);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
+      setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.GROUPS, group);
+      setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.LOCATORS, locators);
+      setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.LOG_LEVEL, logLevel);
+      setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.MCAST_ADDRESS,
+          mcastBindAddress);
+      setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.MCAST_PORT, mcastPort);
+      setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION,
+          enableSharedConfiguration);
+      setPropertyIfNotNull(gemfireProperties,
           ConfigurationProperties.LOAD_CLUSTER_CONFIGURATION_FROM_DIR,
           loadSharedConfigurationFromDirectory);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.CLUSTER_CONFIGURATION_DIR, clusterConfigDir);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.HTTP_SERVICE_PORT, httpServicePort);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS, httpServiceBindAddress);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
+      setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.CLUSTER_CONFIGURATION_DIR,
+          clusterConfigDir);
+      setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.HTTP_SERVICE_PORT,
+          httpServicePort);
+      setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS,
+          httpServiceBindAddress);
+      setPropertyIfNotNull(gemfireProperties,
           ConfigurationProperties.JMX_MANAGER_HOSTNAME_FOR_CLIENTS, jmxManagerHostnameForClients);
 
       // read the OSProcess enable redirect system property here
@@ -258,7 +254,7 @@ public class StartLocatorCommand implements GfshCommand {
             && locatorState.isStartingOrNotResponding());
       } finally {
         // stop will close
-        stderrReader.stopAsync(StartMemberUtils.PROCESS_STREAM_READER_ASYNC_STOP_TIMEOUT_MILLIS);
+        stderrReader.stopAsync(PROCESS_STREAM_READER_ASYNC_STOP_TIMEOUT_MILLIS);
 
         // ErrorStream
         getGfsh().getSignalHandler().unregisterListener(locatorSignalListener);
@@ -324,6 +320,7 @@ public class StartLocatorCommand implements GfshCommand {
       SystemFailure.initiateFailure(e);
       throw e;
     } catch (Throwable t) {
+      t.printStackTrace();
       SystemFailure.checkFailure();
       String errorMessage = String.format(CliStrings.START_LOCATOR__GENERAL_ERROR_MESSAGE,
           StringUtils.defaultIfBlank(workingDirectory, memberName),
@@ -439,19 +436,19 @@ public class StartLocatorCommand implements GfshCommand {
       final String maxHeap) throws MalformedObjectNameException {
     List<String> commandLine = new ArrayList<>();
 
-    commandLine.add(StartMemberUtils.getJavaPath());
+    commandLine.add(getJavaPath());
     commandLine.add("-server");
     commandLine.add("-classpath");
     commandLine
         .add(getLocatorClasspath(Boolean.TRUE.equals(includeSystemClasspath), userClasspath));
 
-    StartMemberUtils.addCurrentLocators(this, commandLine, gemfireProperties);
-    StartMemberUtils.addGemFirePropertyFile(commandLine, gemfirePropertiesFile);
-    StartMemberUtils.addGemFireSecurityPropertyFile(commandLine, gemfireSecurityPropertiesFile);
-    StartMemberUtils.addGemFireSystemProperties(commandLine, gemfireProperties);
-    StartMemberUtils.addJvmArgumentsAndOptions(commandLine, jvmArgsOpts);
-    StartMemberUtils.addInitialHeap(commandLine, initialHeap);
-    StartMemberUtils.addMaxHeap(commandLine, maxHeap);
+    addCurrentLocators(this, commandLine, gemfireProperties);
+    addGemFirePropertyFile(commandLine, gemfirePropertiesFile);
+    addGemFireSecurityPropertyFile(commandLine, gemfireSecurityPropertiesFile);
+    addGemFireSystemProperties(commandLine, gemfireProperties);
+    addJvmArgumentsAndOptions(commandLine, jvmArgsOpts);
+    addInitialHeap(commandLine, initialHeap);
+    addMaxHeap(commandLine, maxHeap);
 
     commandLine.add(
         "-D".concat(AbstractLauncher.SIGNAL_HANDLER_REGISTRATION_SYSTEM_PROPERTY.concat("=true")));
@@ -492,7 +489,7 @@ public class StartLocatorCommand implements GfshCommand {
   }
 
   String getLocatorClasspath(final boolean includeSystemClasspath, final String userClasspath) {
-    return StartMemberUtils.toClasspath(includeSystemClasspath,
-        new String[] {StartMemberUtils.CORE_DEPENDENCIES_JAR_PATHNAME}, userClasspath);
+    return toClasspath(includeSystemClasspath, new String[] {CORE_DEPENDENCIES_JAR_PATHNAME},
+        userClasspath);
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/210ff9f1/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartMemberCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartMemberCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartMemberCommand.java
new file mode 100644
index 0000000..6bdc25c
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartMemberCommand.java
@@ -0,0 +1,248 @@
+/*
+ * 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.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.management.internal.cli.shell.MXBeanProvider.getDistributedSystemMXBean;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
+
+import javax.management.MalformedObjectNameException;
+
+import org.apache.commons.lang.ArrayUtils;
+
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.internal.GemFireVersion;
+import org.apache.geode.internal.process.ProcessLauncherContext;
+import org.apache.geode.internal.util.IOUtils;
+import org.apache.geode.management.DistributedSystemMXBean;
+import org.apache.geode.management.internal.cli.util.ThreePhraseGenerator;
+
+/**
+ * Encapsulates methods used by StartServerCommand and StartLocatorCommand and their associated
+ * tests.
+ * 
+ * @see StartLocatorCommand
+ * @see StartServerCommand
+ */
+public class StartMemberCommand {
+  public static final String GEODE_HOME = System.getenv("GEODE_HOME");
+
+  private static final String JAVA_HOME = System.getProperty("java.home");
+  static final int CMS_INITIAL_OCCUPANCY_FRACTION = 60;
+  private static final ThreePhraseGenerator nameGenerator = new ThreePhraseGenerator();
+
+  static final String CORE_DEPENDENCIES_JAR_PATHNAME =
+      IOUtils.appendToPath(GEODE_HOME, "lib", "geode-dependencies.jar");
+  static final String GEODE_JAR_PATHNAME =
+      IOUtils.appendToPath(GEODE_HOME, "lib", GemFireVersion.getGemFireJarFileName());
+  static final long PROCESS_STREAM_READER_ASYNC_STOP_TIMEOUT_MILLIS = 5 * 1000;
+  static final int INVALID_PID = -1;
+
+  static ThreePhraseGenerator getNameGenerator() {
+    return nameGenerator;
+  }
+
+  void setPropertyIfNotNull(Properties properties, String key, Object value) {
+    if (key != null && value != null) {
+      properties.setProperty(key, value.toString());
+    }
+  }
+
+  String resolveWorkingDir(String userSpecifiedDir, String memberName) {
+    File workingDir =
+        (userSpecifiedDir == null) ? new File(memberName) : new File(userSpecifiedDir);
+    String workingDirPath = IOUtils.tryGetCanonicalPathElseGetAbsolutePath(workingDir);
+    if (!workingDir.exists()) {
+      if (!workingDir.mkdirs()) {
+        throw new IllegalStateException(String.format(
+            "Could not create directory %s. Please verify directory path or user permissions.",
+            workingDirPath));
+      }
+    }
+    return workingDirPath;
+  }
+
+  void addGemFirePropertyFile(final List<String> commandLine, final File gemfirePropertiesFile) {
+    if (gemfirePropertiesFile != null) {
+      commandLine.add("-DgemfirePropertyFile=" + gemfirePropertiesFile.getAbsolutePath());
+    }
+  }
+
+  void addGemFireSecurityPropertyFile(final List<String> commandLine,
+      final File gemfireSecurityPropertiesFile) {
+    if (gemfireSecurityPropertiesFile != null) {
+      commandLine
+          .add("-DgemfireSecurityPropertyFile=" + gemfireSecurityPropertiesFile.getAbsolutePath());
+    }
+  }
+
+  void addGemFireSystemProperties(final List<String> commandLine,
+      final Properties gemfireProperties) {
+    for (final Object property : gemfireProperties.keySet()) {
+      final String propertyName = property.toString();
+      final String propertyValue = gemfireProperties.getProperty(propertyName);
+      if (org.apache.geode.internal.lang.StringUtils.isNotBlank(propertyValue)) {
+        commandLine.add(
+            "-D" + DistributionConfig.GEMFIRE_PREFIX + "" + propertyName + "=" + propertyValue);
+      }
+    }
+  }
+
+  void addJvmArgumentsAndOptions(final List<String> commandLine, final String[] jvmArgsOpts) {
+    if (jvmArgsOpts != null) {
+      commandLine.addAll(Arrays.asList(jvmArgsOpts));
+    }
+  }
+
+  void addInitialHeap(final List<String> commandLine, final String initialHeap) {
+    if (org.apache.geode.internal.lang.StringUtils.isNotBlank(initialHeap)) {
+      commandLine.add("-Xms" + initialHeap);
+    }
+  }
+
+  void addMaxHeap(final List<String> commandLine, final String maxHeap) {
+    if (org.apache.geode.internal.lang.StringUtils.isNotBlank(maxHeap)) {
+      commandLine.add("-Xmx" + maxHeap);
+      commandLine.add("-XX:+UseConcMarkSweepGC");
+      commandLine.add("-XX:CMSInitiatingOccupancyFraction=" + CMS_INITIAL_OCCUPANCY_FRACTION);
+      // commandLine.add("-XX:MinHeapFreeRatio=" + MINIMUM_HEAP_FREE_RATIO);
+    }
+  }
+
+  void addCurrentLocators(GfshCommand gfshCommand, final List<String> commandLine,
+      final Properties gemfireProperties) throws MalformedObjectNameException {
+    if (org.apache.geode.internal.lang.StringUtils
+        .isBlank(gemfireProperties.getProperty(LOCATORS))) {
+      String currentLocators = getCurrentLocators(gfshCommand);
+      if (org.apache.geode.internal.lang.StringUtils.isNotBlank(currentLocators)) {
+        commandLine.add("-D".concat(ProcessLauncherContext.OVERRIDDEN_DEFAULTS_PREFIX)
+            .concat(LOCATORS).concat("=").concat(currentLocators));
+      }
+    }
+  }
+
+  String getCurrentLocators(GfshCommand gfshCommand) throws MalformedObjectNameException {
+    String delimitedLocators = "";
+    try {
+      if (gfshCommand.isConnectedAndReady()) {
+        final DistributedSystemMXBean dsMBeanProxy = getDistributedSystemMXBean();
+        if (dsMBeanProxy != null) {
+          final String[] locators = dsMBeanProxy.listLocators();
+          if (locators != null && locators.length > 0) {
+            final StringBuilder sb = new StringBuilder();
+            for (int i = 0; i < locators.length; i++) {
+              if (i > 0) {
+                sb.append(",");
+              }
+              sb.append(locators[i]);
+            }
+            delimitedLocators = sb.toString();
+          }
+        }
+      }
+    } catch (IOException e) { // thrown by getDistributedSystemMXBean
+      // leave delimitedLocators = ""
+      gfshCommand.getGfsh().logWarning("DistributedSystemMXBean is unavailable\n", e);
+    }
+    return delimitedLocators;
+  }
+
+  int readPid(final File pidFile) {
+    assert pidFile != null : "The file from which to read the process ID (pid) cannot be null!";
+    if (pidFile.isFile()) {
+      BufferedReader fileReader = null;
+      try {
+        fileReader = new BufferedReader(new FileReader(pidFile));
+        return Integer.parseInt(fileReader.readLine());
+      } catch (IOException | NumberFormatException ignore) {
+      } finally {
+        IOUtils.close(fileReader);
+      }
+    }
+    return INVALID_PID;
+  }
+
+  String getJavaPath() {
+    return new File(new File(JAVA_HOME, "bin"), "java").getPath();
+  }
+
+  String getSystemClasspath() {
+    return System.getProperty("java.class.path");
+  }
+
+  String toClasspath(final boolean includeSystemClasspath, String[] jarFilePathnames,
+      String... userClasspaths) {
+    // gemfire jar must absolutely be the first JAR file on the CLASSPATH!!!
+    StringBuilder classpath = new StringBuilder(getGemFireJarPath());
+
+    userClasspaths = (userClasspaths != null ? userClasspaths : ArrayUtils.EMPTY_STRING_ARRAY);
+
+    // Then, include user-specified classes on CLASSPATH to enable the user to override GemFire JAR
+    // dependencies
+    // with application-specific versions; this logic/block corresponds to classes/jar-files
+    // specified with the
+    // --classpath option to the 'start locator' and 'start server commands'; also this will
+    // override any
+    // System CLASSPATH environment variable setting, which is consistent with the Java platform
+    // behavior...
+    for (String userClasspath : userClasspaths) {
+      if (org.apache.geode.internal.lang.StringUtils.isNotBlank(userClasspath)) {
+        classpath.append((classpath.length() == 0)
+            ? org.apache.geode.internal.lang.StringUtils.EMPTY : File.pathSeparator);
+        classpath.append(userClasspath);
+      }
+    }
+
+    // Now, include any System-specified CLASSPATH environment variable setting...
+    if (includeSystemClasspath) {
+      classpath.append(File.pathSeparator);
+      classpath.append(getSystemClasspath());
+    }
+
+    jarFilePathnames =
+        (jarFilePathnames != null ? jarFilePathnames : ArrayUtils.EMPTY_STRING_ARRAY);
+
+    // And finally, include all GemFire dependencies on the CLASSPATH...
+    for (String jarFilePathname : jarFilePathnames) {
+      if (org.apache.geode.internal.lang.StringUtils.isNotBlank(jarFilePathname)) {
+        classpath.append((classpath.length() == 0)
+            ? org.apache.geode.internal.lang.StringUtils.EMPTY : File.pathSeparator);
+        classpath.append(jarFilePathname);
+      }
+    }
+    return classpath.toString();
+  }
+
+  String getGemFireJarPath() {
+    String classpath = getSystemClasspath();
+    String gemfireJarPath = GEODE_JAR_PATHNAME;
+    for (String classpathElement : classpath.split(File.pathSeparator)) {
+      // MUST CHANGE THIS TO REGEX SINCE VERSION CHANGES IN JAR NAME
+      if (classpathElement.endsWith("gemfire-core-8.2.0.0-SNAPSHOT.jar")) {
+        gemfireJarPath = classpathElement;
+        break;
+      }
+    }
+    return gemfireJarPath;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/210ff9f1/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartMemberUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartMemberUtils.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartMemberUtils.java
deleted file mode 100644
index 3e1053a..0000000
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartMemberUtils.java
+++ /dev/null
@@ -1,251 +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.apache.geode.distributed.ConfigurationProperties.LOCATORS;
-import static org.apache.geode.management.internal.cli.shell.MXBeanProvider.getDistributedSystemMXBean;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Properties;
-
-import javax.management.MalformedObjectNameException;
-
-import org.apache.commons.lang.ArrayUtils;
-
-import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.internal.GemFireVersion;
-import org.apache.geode.internal.process.ProcessLauncherContext;
-import org.apache.geode.internal.util.IOUtils;
-import org.apache.geode.management.DistributedSystemMXBean;
-import org.apache.geode.management.internal.cli.util.ThreePhraseGenerator;
-
-/**
- * Encapsulates methods used by StartServerCommand and StartLocatorCommand and their associated
- * tests.
- * 
- * @see StartLocatorCommand
- * @see StartServerCommand
- */
-public class StartMemberUtils {
-  public static final String GEODE_HOME = System.getenv("GEODE_HOME");
-
-  private static final String JAVA_HOME = System.getProperty("java.home");
-  static final int CMS_INITIAL_OCCUPANCY_FRACTION = 60;
-  private static final ThreePhraseGenerator nameGenerator = new ThreePhraseGenerator();
-
-  static final String CORE_DEPENDENCIES_JAR_PATHNAME =
-      IOUtils.appendToPath(GEODE_HOME, "lib", "geode-dependencies.jar");
-  static final String GEODE_JAR_PATHNAME =
-      IOUtils.appendToPath(GEODE_HOME, "lib", GemFireVersion.getGemFireJarFileName());
-  static final long PROCESS_STREAM_READER_ASYNC_STOP_TIMEOUT_MILLIS = 5 * 1000;
-  static final int INVALID_PID = -1;
-
-  static ThreePhraseGenerator getNameGenerator() {
-    return nameGenerator;
-  }
-
-  static void setPropertyIfNotNull(Properties properties, String key, Object value) {
-    if (key != null && value != null) {
-      properties.setProperty(key, value.toString());
-    }
-  }
-
-  static String resolveWorkingDir(String userSpecifiedDir, String memberName) {
-    File workingDir =
-        (userSpecifiedDir == null) ? new File(memberName) : new File(userSpecifiedDir);
-    String workingDirPath = IOUtils.tryGetCanonicalPathElseGetAbsolutePath(workingDir);
-    if (!workingDir.exists()) {
-      if (!workingDir.mkdirs()) {
-        throw new IllegalStateException(String.format(
-            "Could not create directory %s. Please verify directory path or user permissions.",
-            workingDirPath));
-      }
-    }
-    return workingDirPath;
-  }
-
-  static void addGemFirePropertyFile(final List<String> commandLine,
-      final File gemfirePropertiesFile) {
-    if (gemfirePropertiesFile != null) {
-      commandLine.add("-DgemfirePropertyFile=" + gemfirePropertiesFile.getAbsolutePath());
-    }
-  }
-
-  static void addGemFireSecurityPropertyFile(final List<String> commandLine,
-      final File gemfireSecurityPropertiesFile) {
-    if (gemfireSecurityPropertiesFile != null) {
-      commandLine
-          .add("-DgemfireSecurityPropertyFile=" + gemfireSecurityPropertiesFile.getAbsolutePath());
-    }
-  }
-
-  static void addGemFireSystemProperties(final List<String> commandLine,
-      final Properties gemfireProperties) {
-    for (final Object property : gemfireProperties.keySet()) {
-      final String propertyName = property.toString();
-      final String propertyValue = gemfireProperties.getProperty(propertyName);
-      if (org.apache.geode.internal.lang.StringUtils.isNotBlank(propertyValue)) {
-        commandLine.add(
-            "-D" + DistributionConfig.GEMFIRE_PREFIX + "" + propertyName + "=" + propertyValue);
-      }
-    }
-  }
-
-  static void addJvmArgumentsAndOptions(final List<String> commandLine,
-      final String[] jvmArgsOpts) {
-    if (jvmArgsOpts != null) {
-      commandLine.addAll(Arrays.asList(jvmArgsOpts));
-    }
-  }
-
-  static void addInitialHeap(final List<String> commandLine, final String initialHeap) {
-    if (org.apache.geode.internal.lang.StringUtils.isNotBlank(initialHeap)) {
-      commandLine.add("-Xms" + initialHeap);
-    }
-  }
-
-  static void addMaxHeap(final List<String> commandLine, final String maxHeap) {
-    if (org.apache.geode.internal.lang.StringUtils.isNotBlank(maxHeap)) {
-      commandLine.add("-Xmx" + maxHeap);
-      commandLine.add("-XX:+UseConcMarkSweepGC");
-      commandLine.add("-XX:CMSInitiatingOccupancyFraction=" + CMS_INITIAL_OCCUPANCY_FRACTION);
-      // commandLine.add("-XX:MinHeapFreeRatio=" + MINIMUM_HEAP_FREE_RATIO);
-    }
-  }
-
-  static void addCurrentLocators(GfshCommand gfshCommand, final List<String> commandLine,
-      final Properties gemfireProperties) throws MalformedObjectNameException {
-    if (org.apache.geode.internal.lang.StringUtils
-        .isBlank(gemfireProperties.getProperty(LOCATORS))) {
-      String currentLocators = getCurrentLocators(gfshCommand);
-      if (org.apache.geode.internal.lang.StringUtils.isNotBlank(currentLocators)) {
-        commandLine.add("-D".concat(ProcessLauncherContext.OVERRIDDEN_DEFAULTS_PREFIX)
-            .concat(LOCATORS).concat("=").concat(currentLocators));
-      }
-    }
-  }
-
-  private static String getCurrentLocators(GfshCommand gfshCommand)
-      throws MalformedObjectNameException {
-    String delimitedLocators = "";
-    try {
-      if (gfshCommand.isConnectedAndReady()) {
-        final DistributedSystemMXBean dsMBeanProxy = getDistributedSystemMXBean();
-        if (dsMBeanProxy != null) {
-          final String[] locators = dsMBeanProxy.listLocators();
-          if (locators != null && locators.length > 0) {
-            final StringBuilder sb = new StringBuilder();
-            for (int i = 0; i < locators.length; i++) {
-              if (i > 0) {
-                sb.append(",");
-              }
-              sb.append(locators[i]);
-            }
-            delimitedLocators = sb.toString();
-          }
-        }
-      }
-    } catch (IOException e) { // thrown by getDistributedSystemMXBean
-      // leave delimitedLocators = ""
-      gfshCommand.getGfsh().logWarning("DistributedSystemMXBean is unavailable\n", e);
-    }
-    return delimitedLocators;
-  }
-
-  public static int readPid(final File pidFile) {
-    assert pidFile != null : "The file from which to read the process ID (pid) cannot be null!";
-    if (pidFile.isFile()) {
-      BufferedReader fileReader = null;
-      try {
-        fileReader = new BufferedReader(new FileReader(pidFile));
-        return Integer.parseInt(fileReader.readLine());
-      } catch (IOException | NumberFormatException ignore) {
-      } finally {
-        IOUtils.close(fileReader);
-      }
-    }
-    return INVALID_PID;
-  }
-
-  static String getJavaPath() {
-    return new File(new File(JAVA_HOME, "bin"), "java").getPath();
-  }
-
-  static String getSystemClasspath() {
-    return System.getProperty("java.class.path");
-  }
-
-  static String toClasspath(final boolean includeSystemClasspath, String[] jarFilePathnames,
-      String... userClasspaths) {
-    // gemfire jar must absolutely be the first JAR file on the CLASSPATH!!!
-    StringBuilder classpath = new StringBuilder(getGemFireJarPath());
-
-    userClasspaths = (userClasspaths != null ? userClasspaths : ArrayUtils.EMPTY_STRING_ARRAY);
-
-    // Then, include user-specified classes on CLASSPATH to enable the user to override GemFire JAR
-    // dependencies
-    // with application-specific versions; this logic/block corresponds to classes/jar-files
-    // specified with the
-    // --classpath option to the 'start locator' and 'start server commands'; also this will
-    // override any
-    // System CLASSPATH environment variable setting, which is consistent with the Java platform
-    // behavior...
-    for (String userClasspath : userClasspaths) {
-      if (org.apache.geode.internal.lang.StringUtils.isNotBlank(userClasspath)) {
-        classpath.append((classpath.length() == 0)
-            ? org.apache.geode.internal.lang.StringUtils.EMPTY : File.pathSeparator);
-        classpath.append(userClasspath);
-      }
-    }
-
-    // Now, include any System-specified CLASSPATH environment variable setting...
-    if (includeSystemClasspath) {
-      classpath.append(File.pathSeparator);
-      classpath.append(getSystemClasspath());
-    }
-
-    jarFilePathnames =
-        (jarFilePathnames != null ? jarFilePathnames : ArrayUtils.EMPTY_STRING_ARRAY);
-
-    // And finally, include all GemFire dependencies on the CLASSPATH...
-    for (String jarFilePathname : jarFilePathnames) {
-      if (org.apache.geode.internal.lang.StringUtils.isNotBlank(jarFilePathname)) {
-        classpath.append((classpath.length() == 0)
-            ? org.apache.geode.internal.lang.StringUtils.EMPTY : File.pathSeparator);
-        classpath.append(jarFilePathname);
-      }
-    }
-    return classpath.toString();
-  }
-
-  static String getGemFireJarPath() {
-    String classpath = getSystemClasspath();
-    String gemfireJarPath = GEODE_JAR_PATHNAME;
-    for (String classpathElement : classpath.split(File.pathSeparator)) {
-      // MUST CHANGE THIS TO REGEX SINCE VERSION CHANGES IN JAR NAME
-      if (classpathElement.endsWith("gemfire-core-8.2.0.0-SNAPSHOT.jar")) {
-        gemfireJarPath = classpathElement;
-        break;
-      }
-    }
-    return gemfireJarPath;
-  }
-}


Mime
View raw message