geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject [5/5] incubator-geode git commit: GEODE-420: Fixing last few tests for LauncherLifecycleCommandsDUnitTest.java
Date Tue, 30 Aug 2016 02:21:33 GMT
GEODE-420: Fixing last few tests for LauncherLifecycleCommandsDUnitTest.java


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

Branch: refs/heads/feature/GEODE-420
Commit: 7272c644493f04b5c8451c9fee5a9d09599e13c9
Parents: 59adbcc
Author: Udo Kohlmeyer <ukohlmeyer@pivotal.io>
Authored: Tue Aug 30 12:21:11 2016 +1000
Committer: Udo Kohlmeyer <ukohlmeyer@pivotal.io>
Committed: Tue Aug 30 12:21:11 2016 +1000

----------------------------------------------------------------------
 .../LauncherLifecycleCommandsDUnitTest.java     | 476 ++++++++++---------
 .../gemfire/distributed/LocatorLauncher.java    |   3 +-
 .../internal/tcpserver/TcpClient.java           |   5 +
 .../internal/net/SocketCreatorFactory.java      |   6 +-
 .../gemfire/management/JMXMBeanDUnitTest.java   |  25 -
 5 files changed, 253 insertions(+), 262 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7272c644/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
index 1d91834..1610b8e 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
@@ -16,8 +16,51 @@
  */
 package com.gemstone.gemfire.management.internal.cli.commands;
 
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.Wait.*;
+
+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.apache.commons.io.FileUtils;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runners.MethodSorters;
+
 import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.client.*;
+import com.gemstone.gemfire.cache.client.ClientCache;
+import com.gemstone.gemfire.cache.client.ClientCacheFactory;
+import com.gemstone.gemfire.cache.client.ClientRegionFactory;
+import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
+import com.gemstone.gemfire.cache.client.Pool;
+import com.gemstone.gemfire.cache.client.PoolFactory;
+import com.gemstone.gemfire.cache.client.PoolManager;
 import com.gemstone.gemfire.distributed.AbstractLauncher.ServiceState;
 import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
 import com.gemstone.gemfire.distributed.LocatorLauncher;
@@ -39,39 +82,10 @@ import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
 import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
 import com.gemstone.gemfire.test.dunit.WaitCriterion;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runners.MethodSorters;
-
-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 java.io.*;
-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 static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-import static com.gemstone.gemfire.test.dunit.Wait.waitForCriterion;
 
 /**
  * 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 com.gemstone.gemfire.distributed.AbstractLauncher
@@ -88,8 +102,6 @@ import static com.gemstone.gemfire.test.dunit.Wait.waitForCriterion;
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
 public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
 
-  protected static final long COMMAND_EXECUTION_TIMEOUT = TimeUnit.MINUTES.toSeconds(2);
-
   protected static final DateFormat TIMESTAMP = new SimpleDateFormat("yyyyMMddHHmmssSSS");
 
   private final Queue<Integer> processIds = new ConcurrentLinkedDeque<>();
@@ -98,13 +110,11 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
     return getMemberId(InetAddress.getLocalHost().getHostName(), jmxManagerPort, memberName);
   }
 
-  protected static String getMemberId(final String jmxManagerHost, final int jmxManagerPort,
-      final String memberName) throws Exception {
+  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)));
+      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();
 
@@ -137,8 +147,7 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
     while ((pid = processIds.poll()) != null) {
       if (launcherLifecycleCommands.isVmWithProcessIdRunning(pid)) {
         try {
-          String killCommand = String.format("%1$s %2$d", SystemUtils.isWindows() ? "taskkill /F /PID" : "kill -9",
-              pid);
+          String killCommand = String.format("%1$s %2$d", SystemUtils.isWindows() ? "taskkill /F /PID" : "kill -9", pid);
           Runtime.getRuntime().exec(killCommand);
         } catch (Throwable ignore) {
         }
@@ -161,15 +170,9 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
   }
 
   protected Integer readPid(final File workingDirectory) throws IOException {
-    assertTrue(String.format("The working directory (%1$s) must exist!", workingDirectory),
-        workingDirectory != null && workingDirectory.isDirectory());
+    assertTrue(String.format("The working directory (%1$s) must exist!", workingDirectory), workingDirectory != null && workingDirectory.isDirectory());
 
-    File[] files = workingDirectory.listFiles(new FileFilter() {
-      @Override
-      public boolean accept(final File pathname) {
-        return (pathname != null && pathname.isFile() && pathname.getAbsolutePath().endsWith(".pid"));
-      }
-    });
+    File[] files = workingDirectory.listFiles(pathname -> (pathname != null && pathname.isFile() && pathname.getAbsolutePath().endsWith(".pid")));
 
     assertNotNull(files);
     assertTrue(files.length > 0);
@@ -195,11 +198,10 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
   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"));
+    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")));
+    return serviceStateStatus.substring(0, serviceStateStatus.indexOf("Uptime"))
+                             .concat(serviceStateStatus.substring(serviceStateStatus.indexOf("JVM Arguments")));
   }
 
   protected Status stopLocator(final File workingDirectory) {
@@ -207,18 +209,14 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
   }
 
   protected Status stopLocator(final String workingDirectory) {
-    return waitForGemFireProcessToStop(
-        new Builder().setCommand(Command.STOP).setWorkingDirectory(workingDirectory).build().stop(), workingDirectory);
-  }
-
-  protected Status stopServer(final File workingDirectory) {
-    return stopServer(IOUtils.tryGetCanonicalPathElseGetAbsolutePath(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);
+    return waitForGemFireProcessToStop(new ServerLauncher.Builder().setCommand(ServerLauncher.Command.STOP)
+                                                                   .setWorkingDirectory(workingDirectory)
+                                                                   .build()
+                                                                   .stop(), workingDirectory);
   }
 
   protected String toString(final Result result) {
@@ -287,7 +285,7 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
     final int locatorPort = AvailablePortHelper.getRandomAvailableTCPPort();
 
     String pathname = (getClass().getSimpleName() + "_" + getTestMethodName());
-    File workingDirectory = new File(pathname);
+    File workingDirectory = temporaryFolder.newFolder(pathname);
 
     assertTrue(workingDirectory.isDirectory() || workingDirectory.mkdir());
 
@@ -303,12 +301,11 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
     CommandStringBuilder command = new CommandStringBuilder(CliStrings.START_LOCATOR);
 
     command.addOption(CliStrings.START_LOCATOR__MEMBER_NAME, pathname);
-    command.addOption(CliStrings.START_LOCATOR__DIR, 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());
+    command.addOption(CliStrings.START_LOCATOR__J, "-D" + DistributionConfig.GEMFIRE_PREFIX + "jmx-manager-port=" + AvailablePortHelper.getRandomAvailableTCPPort());
 
     CommandResult result = executeCommand(command.toString());
 
@@ -317,12 +314,10 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
 
     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: com.gemstone.gemfire.internal.process.FileAlreadyExistsException: Pid file already exists: " + IOUtils.tryGetCanonicalFileElseGetAbsoluteFile(
-            pidFile)));
+    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: com.gemstone.gemfire.internal.process.FileAlreadyExistsException: Pid file already exists: " + IOUtils
+      .tryGetCanonicalFileElseGetAbsoluteFile(pidFile)));
   }
 
   /*
@@ -344,12 +339,15 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
   }
 
   @Test
-  public void test001StartLocatorFailsFastOnMissingGemFirePropertiesFile() {
+  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, getClass().getSimpleName().concat("_").concat(getTestMethodName()));
+    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");
@@ -364,18 +362,19 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
 
     String resultString = toString(result);
 
-    assertTrue(resultString, resultString.contains(
-        MessageFormat.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, StringUtils.EMPTY_STRING,
-            gemfirePropertiesPathname)));
+    assertTrue(resultString, resultString.contains(MessageFormat.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, StringUtils.EMPTY_STRING, gemfirePropertiesPathname)));
   }
 
   @Test
-  public void test002StartLocatorFailsFastOnMissingGemFireSecurityPropertiesFile() {
+  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, getClass().getSimpleName().concat("_").concat(getTestMethodName()));
+    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");
@@ -390,18 +389,19 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
 
     String resultString = toString(result);
 
-    assertTrue(resultString, resultString.contains(
-        MessageFormat.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, "Security ",
-            gemfireSecurityPropertiesPathname)));
+    assertTrue(resultString, resultString.contains(MessageFormat.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, "Security ", gemfireSecurityPropertiesPathname)));
   }
 
   @Test
-  public void test003StartServerFailsFastOnMissingCacheXmlFile() {
+  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, getClass().getSimpleName().concat("_").concat(getTestMethodName()));
+    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());
@@ -411,17 +411,20 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
 
     String resultString = toString(result);
 
-    assertTrue(resultString,
-        resultString.contains(MessageFormat.format(CliStrings.CACHE_XML_NOT_FOUND_MESSAGE, cacheXmlPathname)));
+    assertTrue(resultString, resultString.contains(MessageFormat.format(CliStrings.CACHE_XML_NOT_FOUND_MESSAGE, cacheXmlPathname)));
   }
 
   @Test
-  public void test004StartServerFailsFastOnMissingGemFirePropertiesFile() {
+  public void test004StartServerFailsFastOnMissingGemFirePropertiesFile() throws IOException {
     String gemfirePropertiesFile = "/path/to/missing/gemfire.properties";
 
     CommandStringBuilder command = new CommandStringBuilder(CliStrings.START_SERVER);
 
-    command.addOption(CliStrings.START_SERVER__NAME, getClass().getSimpleName().concat("_").concat(getTestMethodName()));
+    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());
@@ -431,18 +434,20 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
 
     String resultString = toString(result);
 
-    assertTrue(resultString, resultString.contains(
-        MessageFormat.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, StringUtils.EMPTY_STRING,
-            gemfirePropertiesFile)));
+    assertTrue(resultString, resultString.contains(MessageFormat.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, StringUtils.EMPTY_STRING, gemfirePropertiesFile)));
   }
 
   @Test
-  public void test005StartServerFailsFastOnMissingGemFireSecurityPropertiesFile() {
+  public void test005StartServerFailsFastOnMissingGemFireSecurityPropertiesFile() throws IOException {
     String gemfireSecuritiesPropertiesFile = "/path/to/missing/gemfire-securities.properties";
 
     CommandStringBuilder command = new CommandStringBuilder(CliStrings.START_SERVER);
 
-    command.addOption(CliStrings.START_SERVER__NAME, getClass().getSimpleName().concat("_").concat(getTestMethodName()));
+    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());
@@ -452,9 +457,7 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
 
     String resultString = toString(result);
 
-    assertTrue(resultString, resultString.contains(
-        MessageFormat.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, "Security ",
-            gemfireSecuritiesPropertiesFile)));
+    assertTrue(resultString, resultString.contains(MessageFormat.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, "Security ", gemfireSecuritiesPropertiesFile)));
   }
 
   @Test
@@ -475,8 +478,7 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
       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());
+      command.addOption(CliStrings.START_LOCATOR__J, "-D" + DistributionConfig.GEMFIRE_PREFIX + "jmx-manager-port=" + AvailablePortHelper.getRandomAvailableTCPPort());
 
       CommandResult result = executeCommand(command.toString());
 
@@ -486,8 +488,7 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
       String locatorOutput = toString(result);
 
       assertNotNull(locatorOutput);
-      assertTrue("Locator output was: " + locatorOutput,
-          locatorOutput.contains("Locator in " + IOUtils.tryGetCanonicalFileElseGetAbsoluteFile(workingDirectory)));
+      assertTrue("Locator output was: " + locatorOutput, locatorOutput.contains("Locator in " + IOUtils.tryGetCanonicalFileElseGetAbsoluteFile(workingDirectory)));
     } finally {
       stopLocator(workingDirectory);
     }
@@ -499,19 +500,18 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
 
     assertNotNull(result);
     assertEquals(Result.Status.ERROR, result.getStatus());
-    assertEquals(CliStrings.format(CliStrings.STATUS_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, "Locator"),
-        StringUtils.trim(toString(result)));
+    assertEquals(CliStrings.format(CliStrings.STATUS_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, "Locator"), StringUtils.trim(toString(result)));
   }
 
   @Test
-  public void test008StatusLocatorUsingMemberName() {
+  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 = new File(pathname);
+    File workingDirectory = temporaryFolder.newFolder(pathname);
 
     assertTrue(workingDirectory.isDirectory() || workingDirectory.mkdir());
 
@@ -520,7 +520,7 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
 
       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__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());
@@ -532,9 +532,11 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
       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();
+      LocatorLauncher locatorLauncher = new LocatorLauncher.Builder().setCommand(LocatorLauncher.Command.STATUS)
+                                                                     .setBindAddress(null)
+                                                                     .setPort(locatorPort)
+                                                                     .setWorkingDirectory(workingDirectory.getPath())
+                                                                     .build();
 
       assertNotNull(locatorLauncher);
 
@@ -552,17 +554,16 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
 
       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)));
+      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)));
+      assertTrue(serviceStateStatusStringNormalized(toString(result)).contains(serviceStateStatusStringNormalized(expectedLocatorState)));
     } finally {
       stopLocator(workingDirectory);
+      FileUtils.copyDirectory(workingDirectory.getCanonicalFile(), new File("/tmp"));
     }
   }
 
@@ -574,7 +575,7 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
     final int locatorPort = ports[1];
 
     String pathname = (getClass().getSimpleName() + "_" + getTestMethodName());
-    File workingDirectory = new File(pathname);
+    File workingDirectory = temporaryFolder.newFolder(pathname);
 
     assertTrue(workingDirectory.isDirectory() || workingDirectory.mkdir());
 
@@ -583,7 +584,7 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
 
       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__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());
@@ -595,9 +596,11 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
       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();
+      LocatorLauncher locatorLauncher = new LocatorLauncher.Builder().setCommand(LocatorLauncher.Command.STATUS)
+                                                                     .setBindAddress(null)
+                                                                     .setPort(locatorPort)
+                                                                     .setWorkingDirectory(workingDirectory.getPath())
+                                                                     .build();
 
       assertNotNull(locatorLauncher);
 
@@ -611,15 +614,14 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
       assertNotNull(result);
       assertEquals(Result.Status.OK, result.getStatus());
 
-      result = executeCommand(
-          String.format("%1$s --name=%2$s", CliStrings.STATUS_LOCATOR, getMemberId(jmxManagerPort, pathname)));
+      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)));
+      assertTrue(serviceStateStatusStringNormalized(toString(result)).contains(serviceStateStatusStringNormalized(expectedLocatorState)));
     } finally {
       stopLocator(workingDirectory);
+      FileUtils.copyDirectory(workingDirectory.getCanonicalFile(), new File("/tmp"));
     }
   }
 
@@ -629,95 +631,100 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
 
     assertNotNull(result);
     assertEquals(Result.Status.ERROR, result.getStatus());
-    assertEquals(CliStrings.format(CliStrings.STOP_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, "Locator"),
-        StringUtils.trim(toString(result)));
+    assertEquals(CliStrings.format(CliStrings.STOP_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, "Locator"), StringUtils.trim(toString(result)));
   }
 
   @Test
-  public void test011StopLocatorUsingMemberName() {
+  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 = new File(pathname);
+    File workingDirectory = temporaryFolder.newFolder(pathname);
 
-    assertTrue(workingDirectory.isDirectory() || workingDirectory.mkdir());
+    try {
+      assertTrue(workingDirectory.isDirectory() || workingDirectory.mkdir());
 
-    CommandStringBuilder command = new CommandStringBuilder(CliStrings.START_LOCATOR);
+      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__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);
+      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());
+      CommandResult result = executeCommand(command.toString());
 
-    assertNotNull(result);
-    assertEquals(Result.Status.OK, result.getStatus());
+      assertNotNull(result);
+      assertEquals(Result.Status.OK, result.getStatus());
 
-    final LocatorLauncher locatorLauncher = new LocatorLauncher.Builder().setCommand(
-        LocatorLauncher.Command.STOP).setBindAddress(null).setPort(locatorPort).setWorkingDirectory(
-        workingDirectory.getPath()).build();
+      final LocatorLauncher locatorLauncher = new Builder().setCommand(Command.STOP)
+                                                           .setBindAddress(null)
+                                                           .setPort(locatorPort)
+                                                           .setWorkingDirectory(workingDirectory.getPath())
+                                                           .build();
 
-    assertNotNull(locatorLauncher);
+      assertNotNull(locatorLauncher);
 
-    LocatorState locatorStatus = locatorLauncher.waitOnStatusResponse(60, 10, TimeUnit.SECONDS);
+      LocatorState locatorStatus = locatorLauncher.waitOnStatusResponse(60, 10, TimeUnit.SECONDS);
 
-    assertNotNull(locatorStatus);
-    assertEquals(Status.ONLINE, locatorStatus.getStatus());
+      assertNotNull(locatorStatus);
+      assertEquals(Status.ONLINE, locatorStatus.getStatus());
 
-    result = executeCommand(String.format("%1$s --locator=localhost[%2$d]", CliStrings.CONNECT, locatorPort));
+      result = executeCommand(String.format("%1$s --locator=localhost[%2$d]", CliStrings.CONNECT, locatorPort));
 
-    assertNotNull(result);
-    assertEquals(Result.Status.OK, result.getStatus());
+      assertNotNull(result);
+      assertEquals(Result.Status.OK, result.getStatus());
 
-    result = executeCommand(String.format("%1$s --name=invalidLocatorMemberName", CliStrings.STOP_LOCATOR));
+      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)));
+      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();
+      locatorStatus = locatorLauncher.status();
 
-    assertNotNull(locatorStatus);
-    assertEquals(Status.ONLINE, locatorStatus.getStatus());
+      assertNotNull(locatorStatus);
+      assertEquals(Status.ONLINE, locatorStatus.getStatus());
 
-    result = executeCommand(String.format("%1$s --name=%2$s", CliStrings.STOP_LOCATOR, pathname));
+      result = executeCommand(String.format("%1$s --name=%2$s", CliStrings.STOP_LOCATOR, pathname));
 
-    assertNotNull(result);
-    assertEquals(Result.Status.OK, result.getStatus());
+      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)));
+      // 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()));
-      }
+      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";
-      }
-    };
+        @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);
+      waitForCriterion(waitCriteria, 15 * 1000, 5000, true);
 
-    locatorStatus = locatorLauncher.status();
+      locatorStatus = locatorLauncher.status();
+
+      assertNotNull(locatorStatus);
+      assertEquals(Status.NOT_RESPONDING, locatorStatus.getStatus());
+    } finally {
+      FileUtils.copyDirectory(workingDirectory.getCanonicalFile(), new File("/tmp"));
+    }
 
-    assertNotNull(locatorStatus);
-    assertEquals(Status.NOT_RESPONDING, locatorStatus.getStatus());
   }
 
   // @see Trac Bug # 46760
@@ -729,73 +736,79 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
     final int locatorPort = ports[1];
 
     String pathname = (getClass().getSimpleName() + "_" + getTestMethodName());
-    File workingDirectory = new File(pathname);
+    File workingDirectory = temporaryFolder.newFolder(pathname);
 
-    assertTrue(workingDirectory.isDirectory() || workingDirectory.mkdir());
+    try {
+      assertTrue(workingDirectory.isDirectory() || workingDirectory.mkdir());
 
-    CommandStringBuilder command = new CommandStringBuilder(CliStrings.START_LOCATOR);
+      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__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);
+      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());
+      CommandResult result = executeCommand(command.toString());
 
-    assertNotNull(result);
-    assertEquals(Result.Status.OK, result.getStatus());
+      assertNotNull(result);
+      assertEquals(Result.Status.OK, result.getStatus());
 
-    final LocatorLauncher locatorLauncher = new LocatorLauncher.Builder().setCommand(
-        LocatorLauncher.Command.STOP).setBindAddress(null).setPort(locatorPort).setWorkingDirectory(
-        workingDirectory.getPath()).build();
+      final LocatorLauncher locatorLauncher = new Builder().setCommand(Command.STOP)
+                                                                           .setBindAddress(null)
+                                                                           .setPort(locatorPort)
+                                                                           .setWorkingDirectory(workingDirectory.getPath())
+                                                                           .build();
 
-    assertNotNull(locatorLauncher);
+      assertNotNull(locatorLauncher);
 
-    LocatorState locatorState = locatorLauncher.waitOnStatusResponse(60, 10, TimeUnit.SECONDS);
+      LocatorState locatorState = locatorLauncher.waitOnStatusResponse(60, 10, TimeUnit.SECONDS);
 
-    assertNotNull(locatorState);
-    assertEquals(Status.ONLINE, locatorState.getStatus());
+      assertNotNull(locatorState);
+      assertEquals(Status.ONLINE, locatorState.getStatus());
 
-    result = executeCommand(String.format("%1$s --locator=localhost[%2$d]", CliStrings.CONNECT, locatorPort));
+      result = executeCommand(String.format("%1$s --locator=localhost[%2$d]", CliStrings.CONNECT, locatorPort));
 
-    assertNotNull(result);
-    assertEquals(Result.Status.OK, result.getStatus());
+      assertNotNull(result);
+      assertEquals(Result.Status.OK, result.getStatus());
 
-    String memberId = getMemberId(jmxManagerPort, pathname);
+      String memberId = getMemberId(jmxManagerPort, pathname);
 
-    result = executeCommand(String.format("%1$s --name=%2$s", CliStrings.STOP_LOCATOR, memberId));
+      result = executeCommand(String.format("%1$s --name=%2$s", CliStrings.STOP_LOCATOR, memberId));
 
-    assertNotNull(result);
-    assertEquals(Result.Status.OK, result.getStatus());
+      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)));
+      // 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()));
-      }
+      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";
-      }
-    };
+        @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);
+      waitForCriterion(waitCriteria, 15 * 1000, 5000, true);
 
-    locatorState = locatorLauncher.status();
+      locatorState = locatorLauncher.status();
 
-    assertNotNull(locatorState);
-    assertEquals(Status.NOT_RESPONDING, locatorState.getStatus());
+      assertNotNull(locatorState);
+      assertEquals(Status.NOT_RESPONDING, locatorState.getStatus());
+    } finally {
+      FileUtils.copyDirectory(workingDirectory.getCanonicalFile(),new File("/tmp"));
+    }
   }
 
   @Test
@@ -805,7 +818,7 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
     final int locatorPort = ports[1];
 
     String pathname = getClass().getSimpleName().concat("_").concat(getTestMethodName());
-    File workingDirectory = new File(pathname);
+    File workingDirectory = temporaryFolder.newFolder(pathname);
 
     assertTrue(workingDirectory.isDirectory() || workingDirectory.mkdir());
 
@@ -816,12 +829,10 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
     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, pathname);
-    command.addOption(CliStrings.START_SERVER__CACHE_XML_FILE,
-        IOUtils.tryGetCanonicalPathElseGetAbsolutePath(writeAndGetCacheXmlFile(workingDirectory)));
+    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 + "]");
+    command.addOption(CliStrings.START_SERVER__J, "-D" + DistributionConfig.GEMFIRE_PREFIX + "" + START_LOCATOR + "=localhost[" + locatorPort + "]");
 
 
     CommandResult result = executeCommand(command.toString());
@@ -830,9 +841,9 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
     assertNotNull(result);
     assertEquals(Result.Status.OK, result.getStatus());
 
-    ServerLauncher serverLauncher = new ServerLauncher.Builder().setCommand(
-        ServerLauncher.Command.STATUS).setWorkingDirectory(
-        IOUtils.tryGetCanonicalPathElseGetAbsolutePath(workingDirectory)).build();
+    ServerLauncher serverLauncher = new ServerLauncher.Builder().setCommand(ServerLauncher.Command.STATUS)
+                                                                .setWorkingDirectory(IOUtils.tryGetCanonicalPathElseGetAbsolutePath(workingDirectory))
+                                                                .build();
 
     assertNotNull(serverLauncher);
 
@@ -905,8 +916,7 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
     BufferedWriter fileWriter = null;
 
     try {
-      fileWriter = new BufferedWriter(
-          new OutputStreamWriter(new FileOutputStream(cacheXml, false), Charset.forName("UTF-8").newEncoder()));
+      fileWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(cacheXml, false), Charset.forName("UTF-8").newEncoder()));
       fileWriter.write(buffer.toString());
       fileWriter.flush();
     } finally {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7272c644/geode-core/src/main/java/com/gemstone/gemfire/distributed/LocatorLauncher.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/LocatorLauncher.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/LocatorLauncher.java
index 0b1efd3..2f16c59 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/LocatorLauncher.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/LocatorLauncher.java
@@ -21,6 +21,7 @@ import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
 
 import com.gemstone.gemfire.cache.client.internal.locator.*;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl;
 import com.gemstone.gemfire.distributed.internal.InternalLocator;
 import com.gemstone.gemfire.distributed.internal.tcpserver.*;
 import com.gemstone.gemfire.internal.DistributionLocator;
@@ -249,7 +250,7 @@ public final class LocatorLauncher extends AbstractLauncher<String> {
     final int timeout = Integer.MAX_VALUE; // 2 minutes
 
     try {
-      TcpClient client = new TcpClient();
+      TcpClient client = new TcpClient(new DistributionConfigImpl(new Properties()));
       return (LocatorStatusResponse) client.requestToServer(bindAddress, port,
         new LocatorStatusRequest(), timeout, true);
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7272c644/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpClient.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpClient.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpClient.java
index 78c6d95..9aaee9f 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpClient.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpClient.java
@@ -33,6 +33,7 @@ import org.apache.logging.log4j.Logger;
 
 import com.gemstone.gemfire.DataSerializer;
 import com.gemstone.gemfire.cache.UnsupportedVersionException;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.internal.Version;
 import com.gemstone.gemfire.internal.VersionedDataInputStream;
 import com.gemstone.gemfire.internal.VersionedDataOutputStream;
@@ -56,6 +57,10 @@ public class TcpClient {
 
   private final SocketCreator socketCreator;
 
+  public TcpClient(DistributionConfig distributionConfig) {
+    this(SocketCreatorFactory.setDistributionConfig(distributionConfig).getSocketCreatorForComponent(SecurableComponent.LOCATOR));
+  }
+
   /**
    * Constructs a new TcpClient using the default (Locator) SocketCreator.
    * SocketCreatorFactory should be initialized before invoking this method.

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7272c644/geode-core/src/main/java/com/gemstone/gemfire/internal/net/SocketCreatorFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/net/SocketCreatorFactory.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/net/SocketCreatorFactory.java
index 6e39381..337ca9c 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/net/SocketCreatorFactory.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/net/SocketCreatorFactory.java
@@ -79,7 +79,7 @@ public class SocketCreatorFactory {
         return createSSLSocketCreator(sslComponent, sslConfig);
       }
     }
-    return createSSLSocketCreator(SecurableComponent.NONE, sslConfig);
+    return createSSLSocketCreator(sslComponent, sslConfig);
   }
 
 
@@ -98,10 +98,10 @@ public class SocketCreatorFactory {
       socketCreator = new SocketCreator(sslConfig);
       registerSocketCreatorForComponent(sslEnableComponent, socketCreator);
     } else {
-      socketCreator = getRegisteredSocketCreatorForComponent(SecurableComponent.NONE);
+      socketCreator = getRegisteredSocketCreatorForComponent(sslEnableComponent);
       if (socketCreator == null) {
         socketCreator = new SocketCreator(sslConfig);
-        registerSocketCreatorForComponent(SecurableComponent.NONE, socketCreator);
+        registerSocketCreatorForComponent(sslEnableComponent, socketCreator);
       }
     }
     return socketCreator;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7272c644/geode-core/src/test/java/com/gemstone/gemfire/management/JMXMBeanDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/JMXMBeanDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/JMXMBeanDUnitTest.java
index bc90ee0..f08c172 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/JMXMBeanDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/JMXMBeanDUnitTest.java
@@ -176,9 +176,6 @@ public class JMXMBeanDUnitTest extends DistributedTestCase {
       System.setProperty("javax.net.ssl.trustStore", useMulti ? getMultiKeyTruststore() : getSimpleSingleKeyKeystore());
       System.setProperty("javax.net.ssl.trustStoreType", "JKS");
       System.setProperty("javax.net.ssl.trustStorePassword", "password");
-//      System.setProperty("com.sun.management.jmxremote.ssl.need.client.auth", "true");
-//      System.setProperty("com.sun.management.jmxremote.ssl", "true");
-//      System.setProperty("com.sun.management.jmxremote.registry.ssl", "true");
       environment.put("com.sun.jndi.rmi.factory.socket", new SslRMIClientSocketFactory());
     }
 
@@ -227,12 +224,6 @@ public class JMXMBeanDUnitTest extends DistributedTestCase {
 
   }
 
-  private Properties configureServerProperties(final Properties properties, final String locators) {
-    configureCommonProperties(properties);
-    properties.setProperty(LOCATORS, locators);
-    return properties;
-  }
-
   private Properties configureJMXSSLProperties(final Properties properties, final boolean isLegacy, final boolean useMultiKey) {
     if (isLegacy) {
       properties.setProperty(JMX_MANAGER_SSL_CIPHERS, "any");
@@ -299,20 +290,4 @@ public class JMXMBeanDUnitTest extends DistributedTestCase {
     properties.setProperty(USE_CLUSTER_CONFIGURATION, "false");
     return properties;
   }
-
-  private static class GemFireRMIClientSocketFactory implements RMIClientSocketFactory, Serializable {
-
-    private static final long serialVersionUID = -7604285019188827617L;
-
-    private/* final hack to prevent serialization */ transient SocketCreator sc;
-
-    public GemFireRMIClientSocketFactory(SocketCreator sc) {
-      this.sc = sc;
-    }
-
-    @Override
-    public Socket createSocket(String host, int port) throws IOException {
-      return this.sc.connectForClient(host, port, 0/* no timeout */);
-    }
-  }
 }


Mime
View raw message