Repository: geode
Updated Branches:
  refs/heads/develop 63169699e -> 210ff9f15


http://git-wip-us.apache.org/repos/asf/geode/blob/210ff9f1/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartServerCommand.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartServerCommand.java
 
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartServerCommand.java
index 8080e3f..035a8c1 100644
--- 
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartServerCommand.java
+++ 
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartServerCommand.java
@@ -48,7 +48,7 @@ import 
org.apache.geode.management.internal.cli.result.ResultBuilder;
 import org.apache.geode.management.internal.cli.shell.Gfsh;
 import org.apache.geode.management.internal.security.ResourceConstants;
 
-public class StartServerCommand implements GfshCommand {
+public class StartServerCommand extends StartMemberCommand implements 
GfshCommand {
   private static final String SERVER_TERM_NAME = "Server";
 
   @CliCommand(value = CliStrings.START_SERVER, help = 
CliStrings.START_SERVER__HELP)
@@ -181,7 +181,7 @@ public class StartServerCommand 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('-');
       }
 
       // prompt for password is username is specified in the command
@@ -195,7 +195,7 @@ public class StartServerCommand implements GfshCommand {
         }
       }
 
-      workingDirectory = StartMemberUtils.resolveWorkingDir(workingDirectory, 
memberName);
+      workingDirectory = resolveWorkingDir(workingDirectory, memberName);
 
       cacheXmlPathname = CliUtil.resolvePathname(cacheXmlPathname);
 
@@ -219,56 +219,49 @@ public class StartServerCommand implements GfshCommand {
 
       File serverPidFile = new File(workingDirectory, 
ProcessType.SERVER.getPidFileName());
 
-      final int oldPid = StartMemberUtils.readPid(serverPidFile);
+      readPid(serverPidFile);
 
       Properties gemfireProperties = new Properties();
 
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.BIND_ADDRESS,
-          bindAddress);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.CACHE_XML_FILE, cacheXmlPathname);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.ENABLE_TIME_STATISTICS, 
enableTimeStatistics);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.GROUPS,
-          group);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
+      setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.BIND_ADDRESS, bindAddress);
+      setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.CACHE_XML_FILE,
+          cacheXmlPathname);
+      setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.ENABLE_TIME_STATISTICS,
+          enableTimeStatistics);
+      setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.GROUPS, 
group);
+      setPropertyIfNotNull(gemfireProperties,
           ConfigurationProperties.JMX_MANAGER_HOSTNAME_FOR_CLIENTS, 
jmxManagerHostnameForClients);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.LOCATORS,
-          locators);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.LOCATOR_WAIT_TIME, locatorWaitTime);
-      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.MEMCACHED_PORT, memcachedPort);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.MEMCACHED_PROTOCOL, memcachedProtocol);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.MEMCACHED_BIND_ADDRESS, 
memcachedBindAddress);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.REDIS_PORT,
-          redisPort);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.REDIS_BIND_ADDRESS, redisBindAddress);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.REDIS_PASSWORD, redisPassword);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.STATISTIC_ARCHIVE_FILE, 
statisticsArchivePathname);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.USE_CLUSTER_CONFIGURATION, 
requestSharedConfiguration);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.LOCK_MEMORY,
-          lockMemory);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.OFF_HEAP_MEMORY_SIZE, offHeapMemorySize);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.START_DEV_REST_API, startRestApi);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.HTTP_SERVICE_PORT, httpServicePort);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS, 
httpServiceBindAddress);
+      setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.LOCATORS, locators);
+      setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.LOCATOR_WAIT_TIME,
+          locatorWaitTime);
+      setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.LOG_LEVEL, logLevel);
+      setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.MCAST_ADDRESS,
+          mcastBindAddress);
+      setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.MCAST_PORT, mcastPort);
+      setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.MEMCACHED_PORT,
+          memcachedPort);
+      setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.MEMCACHED_PROTOCOL,
+          memcachedProtocol);
+      setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.MEMCACHED_BIND_ADDRESS,
+          memcachedBindAddress);
+      setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.REDIS_PORT, redisPort);
+      setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.REDIS_BIND_ADDRESS,
+          redisBindAddress);
+      setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.REDIS_PASSWORD,
+          redisPassword);
+      setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.STATISTIC_ARCHIVE_FILE,
+          statisticsArchivePathname);
+      setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.USE_CLUSTER_CONFIGURATION,
+          requestSharedConfiguration);
+      setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.LOCK_MEMORY, lockMemory);
+      setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.OFF_HEAP_MEMORY_SIZE,
+          offHeapMemorySize);
+      setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.START_DEV_REST_API,
+          startRestApi);
+      setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.HTTP_SERVICE_PORT,
+          httpServicePort);
+      setPropertyIfNotNull(gemfireProperties, 
ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS,
+          httpServiceBindAddress);
       // if username is specified in the command line, it will overwrite 
what's set in the
       // properties file
       if (StringUtils.isNotBlank(userName)) {
@@ -377,9 +370,9 @@ public class StartServerCommand implements GfshCommand {
         } while (!(registeredServerSignalListener && 
serverSignalListener.isSignaled())
             && serverState.isStartingOrNotResponding());
       } finally {
-        
stderrReader.stopAsync(StartMemberUtils.PROCESS_STREAM_READER_ASYNC_STOP_TIMEOUT_MILLIS);
 // stop
-                                                                               
                   // will
-                                                                               
                   // close
+        
stderrReader.stopAsync(PROCESS_STREAM_READER_ASYNC_STOP_TIMEOUT_MILLIS); // stop
+                                                                               
  // will
+                                                                               
  // close
         // ErrorStream
         getGfsh().getSignalHandler().unregisterListener(serverSignalListener);
       }
@@ -424,16 +417,16 @@ public class StartServerCommand implements GfshCommand {
       throws MalformedObjectNameException {
     List<String> commandLine = new ArrayList<>();
 
-    commandLine.add(StartMemberUtils.getJavaPath());
+    commandLine.add(getJavaPath());
     commandLine.add("-server");
     commandLine.add("-classpath");
     
commandLine.add(getServerClasspath(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);
+    addCurrentLocators(this, commandLine, gemfireProperties);
+    addGemFirePropertyFile(commandLine, gemfirePropertiesFile);
+    addGemFireSecurityPropertyFile(commandLine, gemfireSecurityPropertiesFile);
+    addGemFireSystemProperties(commandLine, gemfireProperties);
+    addJvmArgumentsAndOptions(commandLine, jvmArgsOpts);
 
     // NOTE asserting not equal to true rather than equal to false handles the 
null case and ensures
     // the user
@@ -442,8 +435,8 @@ public class StartServerCommand implements GfshCommand {
       addJvmOptionsForOutOfMemoryErrors(commandLine);
     }
 
-    StartMemberUtils.addInitialHeap(commandLine, initialHeap);
-    StartMemberUtils.addMaxHeap(commandLine, maxHeap);
+    addInitialHeap(commandLine, initialHeap);
+    addMaxHeap(commandLine, maxHeap);
 
     commandLine.add(
         
"-D".concat(AbstractLauncher.SIGNAL_HANDLER_REGISTRATION_SYSTEM_PROPERTY.concat("=true")));
@@ -551,9 +544,9 @@ public class StartServerCommand implements GfshCommand {
   String getServerClasspath(final boolean includeSystemClasspath, final String 
userClasspath) {
     List<String> jarFilePathnames = new ArrayList<>();
 
-    jarFilePathnames.add(StartMemberUtils.CORE_DEPENDENCIES_JAR_PATHNAME);
+    jarFilePathnames.add(CORE_DEPENDENCIES_JAR_PATHNAME);
 
-    return StartMemberUtils.toClasspath(includeSystemClasspath,
+    return toClasspath(includeSystemClasspath,
         jarFilePathnames.toArray(new String[jarFilePathnames.size()]), 
userClasspath);
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/210ff9f1/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
index 5dfb54e..da50912 100644
--- 
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
@@ -15,7 +15,12 @@
 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 java.io.IOException;
+import java.util.concurrent.TimeUnit;
+
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
 
 import org.apache.geode.SystemFailure;
 import org.apache.geode.distributed.AbstractLauncher;
@@ -30,10 +35,7 @@ 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;
+import org.apache.geode.management.internal.cli.shell.MXBeanProvider;
 
 public class StopLocatorCommand implements GfshCommand {
   private static final long 
WAITING_FOR_STOP_TO_MAKE_PID_GO_AWAY_TIMEOUT_MILLIS = 30 * 1000;
@@ -121,4 +123,8 @@ public class StopLocatorCommand implements GfshCommand {
       Gfsh.redirectInternalJavaLoggers();
     }
   }
+
+  MemberMXBean getMemberMXBean(String member) throws IOException {
+    return MXBeanProvider.getMemberMXBean(member);
+  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/210ff9f1/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandJUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandJUnitTest.java
 
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandJUnitTest.java
index da60c7a..e3b6ad4 100644
--- 
a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandJUnitTest.java
+++ 
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandJUnitTest.java
@@ -14,14 +14,6 @@
  */
 package org.apache.geode.management.internal.cli.commands;
 
-import static 
org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS;
-import static 
org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
-import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.NAME;
-import static 
org.apache.geode.distributed.ConfigurationProperties.START_DEV_REST_API;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -35,7 +27,6 @@ import java.io.StringWriter;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import java.util.Properties;
 import java.util.Set;
 
 import org.jmock.Expectations;
@@ -51,7 +42,6 @@ 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.distributed.internal.DistributionConfig;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.lang.StringUtils;
 import org.apache.geode.internal.util.CollectionUtils;
@@ -409,216 +399,15 @@ public class GfshCommandJUnitTest {
 
   @Test
   public void testAddGemFirePropertyFileToCommandLine() {
-    final List<String> commandLine = new ArrayList<>();
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addGemFirePropertyFile(commandLine, null);
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addGemFirePropertyFile(commandLine, new 
File("/path/to/gemfire.properties"));
-    assertFalse(commandLine.isEmpty());
-    
assertTrue(commandLine.contains("-DgemfirePropertyFile=/path/to/gemfire.properties"));
-  }
-
-  @Test
-  public void testAddGemFireSystemPropertiesToCommandLine() {
-    final List<String> commandLine = new ArrayList<>();
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addGemFireSystemProperties(commandLine, new Properties());
-    assertTrue(commandLine.isEmpty());
-
-    final Properties gemfireProperties = new Properties();
-    gemfireProperties.setProperty(LOCATORS, "localhost[11235]");
-    gemfireProperties.setProperty(LOG_LEVEL, "config");
-    gemfireProperties.setProperty(LOG_FILE, 
org.apache.commons.lang.StringUtils.EMPTY);
-    gemfireProperties.setProperty(MCAST_PORT, "0");
-    gemfireProperties.setProperty(NAME, "machine");
-    StartMemberUtils.addGemFireSystemProperties(commandLine, 
gemfireProperties);
-
-    assertFalse(commandLine.isEmpty());
-    assertEquals(4, commandLine.size());
-
-    for (final String propertyName : gemfireProperties.stringPropertyNames()) {
-      final String propertyValue = gemfireProperties.getProperty(propertyName);
-      if (org.apache.commons.lang.StringUtils.isBlank(propertyValue)) {
-        for (final String systemProperty : commandLine) {
-          assertFalse(systemProperty.startsWith(
-              "-D" + DistributionConfig.GEMFIRE_PREFIX + 
"".concat(propertyName).concat("=")));
-        }
-      } else {
-        assertTrue(commandLine.contains("-D" + 
DistributionConfig.GEMFIRE_PREFIX
-            + "".concat(propertyName).concat("=").concat(propertyValue)));
-      }
-    }
-  }
+    StartMemberCommand startMemberCommand = new StartMemberCommand();
 
-  @Test
-  public void testAddGemFireSystemPropertiesToCommandLineWithRestAPI() {
-    final List<String> commandLine = new ArrayList<>();
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addGemFireSystemProperties(commandLine, new Properties());
-    assertTrue(commandLine.isEmpty());
-    final Properties gemfireProperties = new Properties();
-    gemfireProperties.setProperty(LOCATORS, "localhost[11235]");
-    gemfireProperties.setProperty(LOG_LEVEL, "config");
-    gemfireProperties.setProperty(LOG_FILE, StringUtils.EMPTY);
-    gemfireProperties.setProperty(MCAST_PORT, "0");
-    gemfireProperties.setProperty(NAME, "machine");
-    gemfireProperties.setProperty(START_DEV_REST_API, "true");
-    gemfireProperties.setProperty(HTTP_SERVICE_PORT, "8080");
-    gemfireProperties.setProperty(HTTP_SERVICE_BIND_ADDRESS, "localhost");
-
-    StartMemberUtils.addGemFireSystemProperties(commandLine, 
gemfireProperties);
-
-    assertFalse(commandLine.isEmpty());
-    assertEquals(7, commandLine.size());
-
-    for (final String propertyName : gemfireProperties.stringPropertyNames()) {
-      final String propertyValue = gemfireProperties.getProperty(propertyName);
-      if (StringUtils.isBlank(propertyValue)) {
-        for (final String systemProperty : commandLine) {
-          assertFalse(systemProperty.startsWith(
-              "-D" + DistributionConfig.GEMFIRE_PREFIX + 
"".concat(propertyName).concat("=")));
-        }
-      } else {
-        assertTrue(commandLine.contains("-D" + 
DistributionConfig.GEMFIRE_PREFIX
-            + "".concat(propertyName).concat("=").concat(propertyValue)));
-      }
-    }
-  }
-
-  @Test
-  public void testAddInitialHeapToCommandLine() {
     final List<String> commandLine = new ArrayList<>();
     assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addInitialHeap(commandLine, null);
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addInitialHeap(commandLine, 
org.apache.commons.lang.StringUtils.EMPTY);
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addInitialHeap(commandLine, " ");
+    startMemberCommand.addGemFirePropertyFile(commandLine, null);
     assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addInitialHeap(commandLine, "512M");
+    startMemberCommand.addGemFirePropertyFile(commandLine, new 
File("/path/to/gemfire.properties"));
     assertFalse(commandLine.isEmpty());
-    assertEquals("-Xms512M", commandLine.get(0));
-  }
-
-  @Test
-  public void testAddJvmArgumentsAndOptionsToCommandLine() {
-    final List<String> commandLine = new ArrayList<>();
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addJvmArgumentsAndOptions(commandLine, null);
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addJvmArgumentsAndOptions(commandLine, new String[] {});
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addJvmArgumentsAndOptions(commandLine,
-        new String[] {"-DmyProp=myVal", "-d64", "-server", "-Xprof"});
-    assertFalse(commandLine.isEmpty());
-    assertEquals(4, commandLine.size());
-    assertEquals("-DmyProp=myVal", commandLine.get(0));
-    assertEquals("-d64", commandLine.get(1));
-    assertEquals("-server", commandLine.get(2));
-    assertEquals("-Xprof", commandLine.get(3));
-  }
-
-  @Test
-  public void testAddMaxHeapToCommandLine() {
-    final List<String> commandLine = new ArrayList<>();
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addMaxHeap(commandLine, null);
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addMaxHeap(commandLine, 
org.apache.commons.lang.StringUtils.EMPTY);
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addMaxHeap(commandLine, "  ");
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addMaxHeap(commandLine, "1024M");
-    assertFalse(commandLine.isEmpty());
-    assertEquals(3, commandLine.size());
-    assertEquals("-Xmx1024M", commandLine.get(0));
-    assertEquals("-XX:+UseConcMarkSweepGC", commandLine.get(1));
-    assertEquals(
-        "-XX:CMSInitiatingOccupancyFraction=" + 
StartMemberUtils.CMS_INITIAL_OCCUPANCY_FRACTION,
-        commandLine.get(2));
-  }
-
-  @Test(expected = AssertionError.class)
-  public void testReadPidWithNull() {
-    try {
-      StartMemberUtils.readPid(null);
-    } catch (AssertionError expected) {
-      assertEquals("The file from which to read the process ID (pid) cannot be 
null!",
-          expected.getMessage());
-      throw expected;
-    }
-  }
-
-  @Test
-  public void testReadPidWithNonExistingFile() {
-    assertEquals(StartMemberUtils.INVALID_PID,
-        StartMemberUtils.readPid(new File("/path/to/non_existing/pid.file")));
-  }
-
-  @Test
-  public void testGetSystemClasspath() {
-    assertEquals(System.getProperty("java.class.path"), 
StartMemberUtils.getSystemClasspath());
-  }
-
-  @Test
-  public void testToClasspath() {
-    final boolean EXCLUDE_SYSTEM_CLASSPATH = false;
-    final boolean INCLUDE_SYSTEM_CLASSPATH = true;
-    String[] jarFilePathnames =
-        {"/path/to/user/libs/A.jar", "/path/to/user/libs/B.jar", 
"/path/to/user/libs/C.jar"};
-    String[] userClasspaths = 
{"/path/to/classes:/path/to/libs/1.jar:/path/to/libs/2.jar",
-        
"/path/to/ext/libs/1.jar:/path/to/ext/classes:/path/to/ext/lib/10.jar"};
-    String expectedClasspath = 
StartMemberUtils.GEODE_JAR_PATHNAME.concat(File.pathSeparator)
-        .concat(toClasspath(userClasspaths)).concat(File.pathSeparator)
-        .concat(toClasspath(jarFilePathnames));
-    assertEquals(expectedClasspath,
-        StartMemberUtils.toClasspath(EXCLUDE_SYSTEM_CLASSPATH, 
jarFilePathnames, userClasspaths));
-    expectedClasspath = 
StartMemberUtils.GEODE_JAR_PATHNAME.concat(File.pathSeparator)
-        .concat(toClasspath(userClasspaths)).concat(File.pathSeparator)
-        
.concat(System.getProperty("java.class.path")).concat(File.pathSeparator)
-        .concat(toClasspath(jarFilePathnames));
-    assertEquals(expectedClasspath,
-        StartMemberUtils.toClasspath(INCLUDE_SYSTEM_CLASSPATH, 
jarFilePathnames, userClasspaths));
-    expectedClasspath = 
StartMemberUtils.GEODE_JAR_PATHNAME.concat(File.pathSeparator)
-        .concat(System.getProperty("java.class.path"));
-    assertEquals(expectedClasspath,
-        StartMemberUtils.toClasspath(INCLUDE_SYSTEM_CLASSPATH, null, 
(String[]) null));
-    assertEquals(StartMemberUtils.GEODE_JAR_PATHNAME,
-        StartMemberUtils.toClasspath(EXCLUDE_SYSTEM_CLASSPATH, null, 
(String[]) null));
-    assertEquals(StartMemberUtils.GEODE_JAR_PATHNAME,
-        StartMemberUtils.toClasspath(EXCLUDE_SYSTEM_CLASSPATH, new String[0], 
""));
-  }
-
-  @Test
-  public void testToClassPathOrder() {
-    String userClasspathOne = "/path/to/user/lib/a.jar:/path/to/user/classes";
-    String userClasspathTwo =
-        
"/path/to/user/lib/x.jar:/path/to/user/lib/y.jar:/path/to/user/lib/z.jar";
-
-    String expectedClasspath = 
StartMemberUtils.getGemFireJarPath().concat(File.pathSeparator)
-        
.concat(userClasspathOne).concat(File.pathSeparator).concat(userClasspathTwo)
-        
.concat(File.pathSeparator).concat(System.getProperty("java.class.path"))
-        
.concat(File.pathSeparator).concat(StartMemberUtils.CORE_DEPENDENCIES_JAR_PATHNAME)
-        
.concat(File.pathSeparator).concat(StartMemberUtils.CORE_DEPENDENCIES_JAR_PATHNAME);
-
-    String actualClasspath =
-        StartMemberUtils.toClasspath(true,
-            new String[] {StartMemberUtils.CORE_DEPENDENCIES_JAR_PATHNAME,
-                StartMemberUtils.CORE_DEPENDENCIES_JAR_PATHNAME},
-            userClasspathOne, userClasspathTwo);
-
-    assertEquals(expectedClasspath, actualClasspath);
+    
assertTrue(commandLine.contains("-DgemfirePropertyFile=/path/to/gemfire.properties"));
   }
 
-  private String toClasspath(final String... jarFilePathnames) {
-    String classpath = org.apache.commons.lang.StringUtils.EMPTY;
-    if (jarFilePathnames != null) {
-      for (final String jarFilePathname : jarFilePathnames) {
-        classpath +=
-            (classpath.isEmpty() ? org.apache.commons.lang.StringUtils.EMPTY : 
File.pathSeparator);
-        classpath += jarFilePathname;
-      }
-    }
-    return classpath;
-  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/210ff9f1/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommandUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommandUnitTest.java
 
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommandUnitTest.java
new file mode 100644
index 0000000..3550638
--- /dev/null
+++ 
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommandUnitTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.spy;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.result.CommandResult;
+import org.apache.geode.test.dunit.rules.GfshParserRule;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class StartLocatorCommandUnitTest {
+  @Rule
+  public GfshParserRule gfshRule = new GfshParserRule();
+
+  private StartLocatorCommand command;
+  private CommandResult result;
+
+  @Before
+  public void before() throws Exception {
+    command = spy(StartLocatorCommand.class);
+  }
+
+  @Test
+  public void failsOnMissingGemFirePropertiesFile() throws Exception {
+    result =
+        gfshRule.executeCommandWithInstance(command, "start locator 
--properties-file=notExist");
+    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
+    assertThat(result.toString()).contains("notExist could not be found");
+  }
+
+  @Test
+  public void failsOnMissingGemFireSecurityPropertiesFile() throws Exception {
+    result = gfshRule.executeCommandWithInstance(command,
+        "start locator --security-properties-file=notExist");
+    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
+    assertThat(result.toString()).contains("notExist could not be found");
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/210ff9f1/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartMemberCommandTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartMemberCommandTest.java
 
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartMemberCommandTest.java
new file mode 100644
index 0000000..911e752
--- /dev/null
+++ 
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartMemberCommandTest.java
@@ -0,0 +1,335 @@
+/*
+ * 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.HTTP_SERVICE_BIND_ADDRESS;
+import static 
org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static 
org.apache.geode.distributed.ConfigurationProperties.START_DEV_REST_API;
+import static org.assertj.core.api.Java6Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+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.List;
+import java.util.Properties;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
+import org.junit.Before;
+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.distributed.internal.DistributionConfig;
+import org.apache.geode.internal.util.IOUtils;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class StartMemberCommandTest {
+  private StartMemberCommand startMemberCommand;
+
+  @Rule
+  public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+  @Rule
+  public TestName testName = new TestName();
+
+  @Before
+  public void before() {
+    startMemberCommand = new StartMemberCommand();
+  }
+
+  @Test
+  public void testAddGemFirePropertyFileToCommandLine() {
+    final List<String> commandLine = new ArrayList<>();
+    assertTrue(commandLine.isEmpty());
+    startMemberCommand.addGemFirePropertyFile(commandLine, null);
+    assertTrue(commandLine.isEmpty());
+    startMemberCommand.addGemFirePropertyFile(commandLine, null);
+    assertTrue(commandLine.isEmpty());
+    startMemberCommand.addGemFirePropertyFile(commandLine, null);
+    assertTrue(commandLine.isEmpty());
+    startMemberCommand.addGemFirePropertyFile(commandLine, new 
File("/path/to/gemfire.properties"));
+    assertFalse(commandLine.isEmpty());
+    
assertTrue(commandLine.contains("-DgemfirePropertyFile=/path/to/gemfire.properties"));
+  }
+
+  @Test
+  public void testAddGemFireSystemPropertiesToCommandLine() {
+    final List<String> commandLine = new ArrayList<>();
+    assertTrue(commandLine.isEmpty());
+    startMemberCommand.addGemFireSystemProperties(commandLine, new 
Properties());
+    assertTrue(commandLine.isEmpty());
+
+    final Properties gemfireProperties = new Properties();
+    gemfireProperties.setProperty(LOCATORS, "localhost[11235]");
+    gemfireProperties.setProperty(LOG_LEVEL, "config");
+    gemfireProperties.setProperty(LOG_FILE, 
org.apache.commons.lang.StringUtils.EMPTY);
+    gemfireProperties.setProperty(MCAST_PORT, "0");
+    gemfireProperties.setProperty(NAME, "machine");
+    startMemberCommand.addGemFireSystemProperties(commandLine, 
gemfireProperties);
+
+    assertFalse(commandLine.isEmpty());
+    assertEquals(4, commandLine.size());
+
+    for (final String propertyName : gemfireProperties.stringPropertyNames()) {
+      final String propertyValue = gemfireProperties.getProperty(propertyName);
+      if (org.apache.commons.lang.StringUtils.isBlank(propertyValue)) {
+        for (final String systemProperty : commandLine) {
+          assertFalse(systemProperty.startsWith(
+              "-D" + DistributionConfig.GEMFIRE_PREFIX + 
"".concat(propertyName).concat("=")));
+        }
+      } else {
+        assertTrue(commandLine.contains("-D" + 
DistributionConfig.GEMFIRE_PREFIX
+            + "".concat(propertyName).concat("=").concat(propertyValue)));
+      }
+    }
+  }
+
+  @Test
+  public void testAddGemFireSystemPropertiesToCommandLineWithRestAPI() {
+    final List<String> commandLine = new ArrayList<>();
+    assertTrue(commandLine.isEmpty());
+    startMemberCommand.addGemFireSystemProperties(commandLine, new 
Properties());
+    assertTrue(commandLine.isEmpty());
+    final Properties gemfireProperties = new Properties();
+    gemfireProperties.setProperty(LOCATORS, "localhost[11235]");
+    gemfireProperties.setProperty(LOG_LEVEL, "config");
+    gemfireProperties.setProperty(LOG_FILE, "");
+    gemfireProperties.setProperty(MCAST_PORT, "0");
+    gemfireProperties.setProperty(NAME, "machine");
+    gemfireProperties.setProperty(START_DEV_REST_API, "true");
+    gemfireProperties.setProperty(HTTP_SERVICE_PORT, "8080");
+    gemfireProperties.setProperty(HTTP_SERVICE_BIND_ADDRESS, "localhost");
+
+    startMemberCommand.addGemFireSystemProperties(commandLine, 
gemfireProperties);
+
+    assertFalse(commandLine.isEmpty());
+    assertEquals(7, commandLine.size());
+
+    for (final String propertyName : gemfireProperties.stringPropertyNames()) {
+      final String propertyValue = gemfireProperties.getProperty(propertyName);
+      if (StringUtils.isBlank(propertyValue)) {
+        for (final String systemProperty : commandLine) {
+          assertFalse(systemProperty.startsWith(
+              "-D" + DistributionConfig.GEMFIRE_PREFIX + 
"".concat(propertyName).concat("=")));
+        }
+      } else {
+        assertTrue(commandLine.contains("-D" + 
DistributionConfig.GEMFIRE_PREFIX
+            + "".concat(propertyName).concat("=").concat(propertyValue)));
+      }
+    }
+  }
+
+  @Test
+  public void testAddInitialHeapToCommandLine() {
+    final List<String> commandLine = new ArrayList<>();
+    assertTrue(commandLine.isEmpty());
+    startMemberCommand.addInitialHeap(commandLine, null);
+    assertTrue(commandLine.isEmpty());
+    startMemberCommand.addInitialHeap(commandLine, 
org.apache.commons.lang.StringUtils.EMPTY);
+    assertTrue(commandLine.isEmpty());
+    startMemberCommand.addInitialHeap(commandLine, " ");
+    assertTrue(commandLine.isEmpty());
+    startMemberCommand.addInitialHeap(commandLine, "512M");
+    assertFalse(commandLine.isEmpty());
+    assertEquals("-Xms512M", commandLine.get(0));
+  }
+
+  @Test
+  public void testAddJvmArgumentsAndOptionsToCommandLine() {
+    final List<String> commandLine = new ArrayList<>();
+    assertTrue(commandLine.isEmpty());
+    startMemberCommand.addJvmArgumentsAndOptions(commandLine, null);
+    assertTrue(commandLine.isEmpty());
+    startMemberCommand.addJvmArgumentsAndOptions(commandLine, new String[] {});
+    assertTrue(commandLine.isEmpty());
+    startMemberCommand.addJvmArgumentsAndOptions(commandLine,
+        new String[] {"-DmyProp=myVal", "-d64", "-server", "-Xprof"});
+    assertFalse(commandLine.isEmpty());
+    assertEquals(4, commandLine.size());
+    assertEquals("-DmyProp=myVal", commandLine.get(0));
+    assertEquals("-d64", commandLine.get(1));
+    assertEquals("-server", commandLine.get(2));
+    assertEquals("-Xprof", commandLine.get(3));
+  }
+
+  @Test
+  public void testAddMaxHeapToCommandLine() {
+    final List<String> commandLine = new ArrayList<>();
+    assertTrue(commandLine.isEmpty());
+    startMemberCommand.addMaxHeap(commandLine, null);
+    assertTrue(commandLine.isEmpty());
+    startMemberCommand.addMaxHeap(commandLine, 
org.apache.commons.lang.StringUtils.EMPTY);
+    assertTrue(commandLine.isEmpty());
+    startMemberCommand.addMaxHeap(commandLine, "  ");
+    assertTrue(commandLine.isEmpty());
+    startMemberCommand.addMaxHeap(commandLine, "1024M");
+    assertFalse(commandLine.isEmpty());
+    assertEquals(3, commandLine.size());
+    assertEquals("-Xmx1024M", commandLine.get(0));
+    assertEquals("-XX:+UseConcMarkSweepGC", commandLine.get(1));
+    assertEquals(
+        "-XX:CMSInitiatingOccupancyFraction=" + 
StartMemberCommand.CMS_INITIAL_OCCUPANCY_FRACTION,
+        commandLine.get(2));
+  }
+
+  @Test(expected = AssertionError.class)
+  public void testReadPidWithNull() {
+    try {
+      startMemberCommand.readPid(null);
+    } catch (AssertionError expected) {
+      assertEquals("The file from which to read the process ID (pid) cannot be 
null!",
+          expected.getMessage());
+      throw expected;
+    }
+  }
+
+  @Test
+  public void testReadPidWithNonExistingFile() {
+    assertEquals(StartMemberCommand.INVALID_PID,
+        startMemberCommand.readPid(new 
File("/path/to/non_existing/pid.file")));
+  }
+
+  @Test
+  public void testGetSystemClasspath() {
+    assertEquals(System.getProperty("java.class.path"), 
startMemberCommand.getSystemClasspath());
+  }
+
+  @Test
+  public void testToClasspath() {
+    final boolean EXCLUDE_SYSTEM_CLASSPATH = false;
+    final boolean INCLUDE_SYSTEM_CLASSPATH = true;
+    String[] jarFilePathnames =
+        {"/path/to/user/libs/A.jar", "/path/to/user/libs/B.jar", 
"/path/to/user/libs/C.jar"};
+    String[] userClasspaths = 
{"/path/to/classes:/path/to/libs/1.jar:/path/to/libs/2.jar",
+        
"/path/to/ext/libs/1.jar:/path/to/ext/classes:/path/to/ext/lib/10.jar"};
+    String expectedClasspath = 
StartMemberCommand.GEODE_JAR_PATHNAME.concat(File.pathSeparator)
+        .concat(toClasspath(userClasspaths)).concat(File.pathSeparator)
+        .concat(toClasspath(jarFilePathnames));
+    assertEquals(expectedClasspath,
+        startMemberCommand.toClasspath(EXCLUDE_SYSTEM_CLASSPATH, 
jarFilePathnames, userClasspaths));
+    expectedClasspath = 
StartMemberCommand.GEODE_JAR_PATHNAME.concat(File.pathSeparator)
+        .concat(toClasspath(userClasspaths)).concat(File.pathSeparator)
+        
.concat(System.getProperty("java.class.path")).concat(File.pathSeparator)
+        .concat(toClasspath(jarFilePathnames));
+    assertEquals(expectedClasspath,
+        startMemberCommand.toClasspath(INCLUDE_SYSTEM_CLASSPATH, 
jarFilePathnames, userClasspaths));
+    expectedClasspath = 
StartMemberCommand.GEODE_JAR_PATHNAME.concat(File.pathSeparator)
+        .concat(System.getProperty("java.class.path"));
+    assertEquals(expectedClasspath,
+        startMemberCommand.toClasspath(INCLUDE_SYSTEM_CLASSPATH, null, 
(String[]) null));
+    assertEquals(StartMemberCommand.GEODE_JAR_PATHNAME,
+        startMemberCommand.toClasspath(EXCLUDE_SYSTEM_CLASSPATH, null, 
(String[]) null));
+    assertEquals(StartMemberCommand.GEODE_JAR_PATHNAME,
+        startMemberCommand.toClasspath(EXCLUDE_SYSTEM_CLASSPATH, new 
String[0], ""));
+  }
+
+  @Test
+  public void testToClassPathOrder() {
+    String userClasspathOne = "/path/to/user/lib/a.jar:/path/to/user/classes";
+    String userClasspathTwo =
+        
"/path/to/user/lib/x.jar:/path/to/user/lib/y.jar:/path/to/user/lib/z.jar";
+
+    String expectedClasspath = 
startMemberCommand.getGemFireJarPath().concat(File.pathSeparator)
+        
.concat(userClasspathOne).concat(File.pathSeparator).concat(userClasspathTwo)
+        
.concat(File.pathSeparator).concat(System.getProperty("java.class.path"))
+        
.concat(File.pathSeparator).concat(StartMemberCommand.CORE_DEPENDENCIES_JAR_PATHNAME)
+        
.concat(File.pathSeparator).concat(StartMemberCommand.CORE_DEPENDENCIES_JAR_PATHNAME);
+
+    String actualClasspath =
+        startMemberCommand.toClasspath(true,
+            new String[] {StartMemberCommand.CORE_DEPENDENCIES_JAR_PATHNAME,
+                StartMemberCommand.CORE_DEPENDENCIES_JAR_PATHNAME},
+            userClasspathOne, userClasspathTwo);
+
+    assertEquals(expectedClasspath, actualClasspath);
+  }
+
+  @Test
+  public void workingDirDefaultsToMemberName() {
+    String workingDir = startMemberCommand.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();
+    String resolvedWorkingDir = 
startMemberCommand.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();
+    String resolvedWorkingDir =
+        startMemberCommand.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 = startMemberCommand.readPid(pidFile);
+
+    assertEquals(expectedPid, actualPid);
+  }
+
+  private String toClasspath(final String... jarFilePathnames) {
+    StringBuilder classpath = new StringBuilder(StringUtils.EMPTY);
+    if (jarFilePathnames != null) {
+      for (final String jarFilePathname : jarFilePathnames) {
+        classpath.append((classpath.length() == 0) ? StringUtils.EMPTY : 
File.pathSeparator);
+        classpath.append(jarFilePathname);
+      }
+    }
+    return classpath.toString();
+  }
+
+  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-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartServerCommandUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartServerCommandUnitTest.java
 
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartServerCommandUnitTest.java
new file mode 100644
index 0000000..41a6eb8
--- /dev/null
+++ 
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartServerCommandUnitTest.java
@@ -0,0 +1,78 @@
+/*
+ * 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.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.result.CommandResult;
+import org.apache.geode.management.internal.cli.shell.Gfsh;
+import org.apache.geode.test.dunit.rules.GfshParserRule;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class StartServerCommandUnitTest {
+  @Rule
+  public GfshParserRule gfshRule = new GfshParserRule();
+
+  private StartServerCommand command;
+  private CommandResult result;
+
+  @Before
+  public void before() throws Exception {
+    command = spy(StartServerCommand.class);
+    Gfsh gfsh = mock(Gfsh.class);
+    when(command.getGfsh()).thenReturn(gfsh);
+  }
+
+  @Test
+  public void failsFastOnMissingCacheXmlFile() throws Exception {
+    result = gfshRule.executeCommandWithInstance(command, "start server 
--cache-xml-file=notExist");
+    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
+    assertThat(result.toString()).contains("notExist could not be found.");
+  }
+
+  @Test
+  public void failsFastOnMissingGemFirePropertiesFile() throws Exception {
+    result =
+        gfshRule.executeCommandWithInstance(command, "start server 
--properties-file=notExist");
+    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
+    assertThat(result.toString()).contains("notExist could not be found.");
+  }
+
+  @Test
+  public void failsFastOnMissingGemFireSecurityPropertiesFile() throws 
Exception {
+    result = gfshRule.executeCommandWithInstance(command,
+        "start server --security-properties-file=notExist");
+    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
+    assertThat(result.toString()).contains("notExist could not be found.");
+  }
+
+  @Test
+  public void failsFastOnMissingPassword() throws Exception {
+    result = gfshRule.executeCommandWithInstance(command, "start server 
--user=test");
+    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
+    assertThat(result.toString()).contains("password must be specified.");
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/210ff9f1/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StatusLocatorCommandUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StatusLocatorCommandUnitTest.java
 
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StatusLocatorCommandUnitTest.java
new file mode 100644
index 0000000..4c2dbdb
--- /dev/null
+++ 
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StatusLocatorCommandUnitTest.java
@@ -0,0 +1,53 @@
+/*
+ * 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.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.spy;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.management.cli.Result;
+import 
org.apache.geode.management.internal.cli.commands.lifecycle.StatusLocatorCommand;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.CommandResult;
+import org.apache.geode.test.dunit.rules.GfshParserRule;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class StatusLocatorCommandUnitTest {
+  @Rule
+  public GfshParserRule gfshRule = new GfshParserRule();
+
+  private StatusLocatorCommand command;
+
+  @Before
+  public void before() throws Exception {
+    command = spy(StatusLocatorCommand.class);
+  }
+
+  @Test
+  public void usesMemberNameIDWhenGfshIsNotConnected() {
+    CommandResult result =
+        gfshRule.executeCommandWithInstance(command, "status locator 
--name=myLocator");
+    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
+    assertThat(result.toString()).contains(
+        
CliStrings.format(CliStrings.STATUS_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, 
"Locator"));
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/210ff9f1/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopLocatorCommandUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopLocatorCommandUnitTest.java
 
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopLocatorCommandUnitTest.java
new file mode 100644
index 0000000..8b79444
--- /dev/null
+++ 
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopLocatorCommandUnitTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+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.shell.Gfsh;
+import org.apache.geode.test.dunit.rules.GfshParserRule;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class StopLocatorCommandUnitTest {
+  @Rule
+  public GfshParserRule gfshRule = new GfshParserRule();
+
+  private StopLocatorCommand stopLocatorCommand;
+  private CommandResult result;
+  private Gfsh gfsh;
+
+  @Before
+  public void before() throws Exception {
+    stopLocatorCommand = spy(StopLocatorCommand.class);
+    gfsh = mock(Gfsh.class);
+  }
+
+  @Test
+  public void usesMemberNameIDWhenNotConnected() {
+    when(stopLocatorCommand.isConnectedAndReady()).thenReturn(false);
+    result =
+        gfshRule.executeCommandWithInstance(stopLocatorCommand, "stop locator 
--name=myLocator");
+    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
+    assertThat(result.toString()).contains(
+        
CliStrings.format(CliStrings.STOP_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, 
"Locator"));
+  }
+
+  @Test
+  public void usesMemberNameIDWhenConnected() throws IOException {
+    when(stopLocatorCommand.isConnectedAndReady()).thenReturn(true);
+    when(gfsh.isConnectedAndReady()).thenReturn(true);
+    doReturn(null).when(stopLocatorCommand).getMemberMXBean(anyString());
+    result = gfshRule.executeCommandWithInstance(stopLocatorCommand,
+        "stop locator --name=invalidLocator");
+    assertThat(result.toString()).contains(CliStrings.format(
+        CliStrings.STOP_LOCATOR__NO_LOCATOR_FOUND_FOR_MEMBER_ERROR_MESSAGE, 
"invalidLocator"));
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/210ff9f1/geode-junit/src/test/java/org/apache/geode/test/junit/rules/RetryRuleLocalWithErrorTest.java
----------------------------------------------------------------------
diff --git 
a/geode-junit/src/test/java/org/apache/geode/test/junit/rules/RetryRuleLocalWithErrorTest.java
 
b/geode-junit/src/test/java/org/apache/geode/test/junit/rules/RetryRuleLocalWithErrorTest.java
index b04a6e0..cd18695 100755
--- 
a/geode-junit/src/test/java/org/apache/geode/test/junit/rules/RetryRuleLocalWithErrorTest.java
+++ 
b/geode-junit/src/test/java/org/apache/geode/test/junit/rules/RetryRuleLocalWithErrorTest.java
@@ -14,7 +14,7 @@
  */
 package org.apache.geode.test.junit.rules;
 
-import static org.assertj.core.api.Assertions.*;
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.Assert.fail;
 
 import java.util.List;

Reply via email to