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

incubator-geode git commit: GEODE-164: Improve reliability of launcher integration tests

Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-409 c6a4c3af6 -> 5da17d120


GEODE-164: Improve reliability of launcher integration tests


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

Branch: refs/heads/feature/GEODE-409
Commit: 5da17d1208142ea320b0807d9717b5858e200d4a
Parents: c6a4c3a
Author: Kirk Lund <kl...@pivotal.io>
Authored: Mon Oct 19 16:19:50 2015 -0700
Committer: Kirk Lund <kl...@pivotal.io>
Committed: Mon Oct 19 16:20:44 2015 -0700

----------------------------------------------------------------------
 .../distributed/LocatorLauncherJUnitTest.java   |  25 ++--
 .../LocatorLauncherLocalJUnitTest.java          |  92 ++++++++------
 .../LocatorLauncherRemoteFileJUnitTest.java     |   4 -
 .../LocatorLauncherRemoteJUnitTest.java         |   4 +-
 .../distributed/ServerLauncherJUnitTest.java    |  58 +++------
 .../ServerLauncherLocalJUnitTest.java           | 120 ++++++++++---------
 .../ServerLauncherRemoteJUnitTest.java          |  12 +-
 7 files changed, 158 insertions(+), 157 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5da17d12/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherJUnitTest.java
index 598d7c4..7070978 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherJUnitTest.java
@@ -9,6 +9,7 @@
 package com.gemstone.gemfire.distributed;
 
 import static org.junit.Assert.*;
+import static org.junit.Assume.*;
 
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -21,7 +22,6 @@ import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
 import com.gemstone.gemfire.distributed.LocatorLauncher.Command;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.internal.util.IOUtils;
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
 import joptsimple.OptionException;
@@ -48,7 +48,7 @@ public class LocatorLauncherJUnitTest extends CommonLauncherTestSuite {
 
   @Test
   public void testBuilderParseArguments() throws Exception {
-    String expectedWorkingDirectory = System.getProperty("user.dir");
+    String expectedWorkingDirectory = this.temporaryFolder.getRoot().getCanonicalPath().toString();
     Builder builder = new Builder();
 
     builder.parseArguments("start", "memberOne", "--bind-address", InetAddress.getLocalHost().getHostAddress(),
@@ -67,8 +67,8 @@ public class LocatorLauncherJUnitTest extends CommonLauncherTestSuite {
   }
 
   @Test
-  public void testBuilderParseArgumentsWithCommandInArguments() {
-    String expectedWorkingDirectory = System.getProperty("user.dir");
+  public void testBuilderParseArgumentsWithCommandInArguments() throws Exception {
+    String expectedWorkingDirectory = this.temporaryFolder.getRoot().getCanonicalPath().toString();
     Builder builder = new Builder();
 
     builder.parseArguments("start", "--dir=" + expectedWorkingDirectory, "--port", "12345", "memberOne");
@@ -299,7 +299,8 @@ public class LocatorLauncherJUnitTest extends CommonLauncherTestSuite {
   }
 
   @Test
-  public void testSetAndGetWorkingDirectory() {
+  public void testSetAndGetWorkingDirectory() throws Exception {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath().toString();
     Builder builder = new Builder();
 
     assertEquals(AbstractLauncher.DEFAULT_WORKING_DIRECTORY, builder.getWorkingDirectory());
@@ -309,11 +310,8 @@ public class LocatorLauncherJUnitTest extends CommonLauncherTestSuite {
     assertEquals(AbstractLauncher.DEFAULT_WORKING_DIRECTORY, builder.getWorkingDirectory());
     assertSame(builder, builder.setWorkingDirectory("  "));
     assertEquals(AbstractLauncher.DEFAULT_WORKING_DIRECTORY, builder.getWorkingDirectory());
-    assertSame(builder, builder.setWorkingDirectory(System.getProperty("user.dir")));
-    assertEquals(System.getProperty("user.dir"), builder.getWorkingDirectory());
-    assertSame(builder, builder.setWorkingDirectory(System.getProperty("java.io.tmpdir")));
-    assertEquals(IOUtils.tryGetCanonicalPathElseGetAbsolutePath(new File(System.getProperty("java.io.tmpdir"))),
-      builder.getWorkingDirectory());
+    assertSame(builder, builder.setWorkingDirectory(rootFolder));
+    assertEquals(rootFolder, builder.getWorkingDirectory());
     assertSame(builder, builder.setWorkingDirectory(null));
     assertEquals(AbstractLauncher.DEFAULT_WORKING_DIRECTORY, builder.getWorkingDirectory());
   }
@@ -354,7 +352,7 @@ public class LocatorLauncherJUnitTest extends CommonLauncherTestSuite {
   }
 
   @Test
-  public void testBuild() {
+  public void testBuild() throws Exception {
     Builder builder = new Builder();
 
     LocatorLauncher launcher = builder.setCommand(Command.START)
@@ -362,7 +360,6 @@ public class LocatorLauncherJUnitTest extends CommonLauncherTestSuite {
       .setHostnameForClients("beanstock.vmware.com")
       .setMemberName("Beanstock")
       .setPort(8192)
-      .setWorkingDirectory(AbstractLauncher.DEFAULT_WORKING_DIRECTORY)
       .build();
 
     assertNotNull(launcher);
@@ -438,11 +435,11 @@ public class LocatorLauncherJUnitTest extends CommonLauncherTestSuite {
   }
 
   @Test(expected = IllegalStateException.class)
-  public void testBuildWithMismatchingCurrentAndWorkingDirectoryOnStart() {
+  public void testBuildWithMismatchingCurrentAndWorkingDirectoryOnStart() throws Exception {
     try {
       new Builder().setCommand(Command.START)
         .setMemberName("memberOne")
-        .setWorkingDirectory(System.getProperty("java.io.tmpdir"))
+        .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath().toString())
         .build();
     }
     catch (IllegalStateException expected) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5da17d12/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalJUnitTest.java
index 19f9379..c008a75 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherLocalJUnitTest.java
@@ -54,10 +54,13 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
 
   @Test
   public void testBuilderSetProperties() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
     this.launcher = new Builder()
         .setForce(true)
         .setMemberName(getUniqueName())
         .setPort(this.locatorPort)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true")
         .set(DistributionConfig.LOG_LEVEL_NAME, "config")
         .set(DistributionConfig.MCAST_PORT_NAME, "0")
@@ -97,10 +100,13 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
   
   @Test
   public void testStartCreatesPidFile() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
     this.launcher = new Builder()
         .setMemberName(getUniqueName())
         .setPort(this.locatorPort)
         .setRedirectOutput(true)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config")
         .build();
 
@@ -110,7 +116,7 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
       assertEquals(Status.ONLINE, this.launcher.status().getStatus());
 
       // validate the pid file and its contents
-      this.pidFile = new File(this.launcher.getWorkingDirectory(), ProcessType.LOCATOR.getPidFileName());
+      this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
       assertTrue(this.pidFile.exists());
       final int pid = readPid(this.pidFile);
       assertTrue(pid > 0);
@@ -133,16 +139,18 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
 
   @Test
   public void testStartDeletesStaleControlFiles() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
     // create existing control files
-    this.stopRequestFile = new File(ProcessType.LOCATOR.getStopRequestFileName());
+    this.stopRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStopRequestFileName());
     this.stopRequestFile.createNewFile();
     assertTrue(this.stopRequestFile.exists());
 
-    this.statusRequestFile = new File(ProcessType.LOCATOR.getStatusRequestFileName());
+    this.statusRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStatusRequestFileName());
     this.statusRequestFile.createNewFile();
     assertTrue(this.statusRequestFile.exists());
 
-    this.statusFile = new File(ProcessType.LOCATOR.getStatusFileName());
+    this.statusFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getStatusFileName());
     this.statusFile.createNewFile();
     assertTrue(this.statusFile.exists());
     
@@ -151,6 +159,7 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
         .setMemberName(getUniqueName())
         .setPort(this.locatorPort)
         .setRedirectOutput(true)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config");
 
     assertFalse(builder.getForce());
@@ -166,7 +175,7 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
     
     try {
       // validate the pid file and its contents
-      this.pidFile = new File(ProcessType.LOCATOR.getPidFileName());
+      this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
       assertTrue(this.pidFile.exists());
       final int pid = readPid(this.pidFile);
       assertTrue(pid > 0);
@@ -178,9 +187,6 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
       assertFalse(statusRequestFile.exists());
       assertFalse(statusFile.exists());
       
-      // validate log file was created
-      final String logFileName = getUniqueName()+".log";
-      assertTrue("Log file should exist: " + logFileName, new File(logFileName).exists()); // TODO:LOG:FAILS
     } catch (Throwable e) {
       this.errorCollector.addError(e);
     }
@@ -195,8 +201,10 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
   
   @Test
   public void testStartOverwritesStalePidFile() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
     // create existing pid file
-    this.pidFile = new File(ProcessType.LOCATOR.getPidFileName());
+    this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
     assertFalse("Integer.MAX_VALUE shouldn't be the same as local pid " + Integer.MAX_VALUE, Integer.MAX_VALUE == ProcessUtils.identifyPid());
     writePid(this.pidFile, Integer.MAX_VALUE);
 
@@ -205,6 +213,7 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
         .setMemberName(getUniqueName())
         .setPort(this.locatorPort)
         .setRedirectOutput(true)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config");
 
     assertFalse(builder.getForce());
@@ -277,7 +286,7 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
       
       // validate log file was created
       final String logFileName = getUniqueName()+".log";
-      assertTrue("Log file should exist: " + logFileName, new File(logFileName).exists()); // TODO:LOG:FAILS
+      assertTrue("Log file should exist: " + logFileName, new File(logFileName).exists());
       
     } catch (Throwable e) {
       logger.error(e);
@@ -304,6 +313,8 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
   
   @Test
   public void testStartWithDefaultPortInUseFails() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
     this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.locatorPort, 50, null, -1);
     assertTrue(this.socket.isBound());
     assertFalse(this.socket.isClosed());
@@ -316,6 +327,7 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
     this.launcher = new Builder()
         .setMemberName(getUniqueName())
         .setRedirectOutput(true)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config")
         .build();
     
@@ -355,12 +367,12 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
     }
 
     try {
-      this.pidFile = new File (ProcessType.LOCATOR.getPidFileName());
+      this.pidFile = new File (this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
       assertFalse("Pid file should not exist: " + this.pidFile, this.pidFile.exists());
       
       // creation of log file seems to be random -- look into why sometime
       final String logFileName = getUniqueName()+".log";
-      assertFalse("Log file should not exist: " + logFileName, new File(logFileName).exists());
+      assertFalse("Log file should not exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
       
     } catch (Throwable e) {
       this.errorCollector.addError(e);
@@ -465,6 +477,8 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
   
   @Test
   public void testStartUsingPort() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
     // generate one free port and then use it instead of default
     final int freeTCPPort = AvailablePortHelper.getRandomAvailableTCPPort();
     assertTrue(AvailablePort.isPortAvailable(freeTCPPort, AvailablePort.SOCKET));
@@ -473,6 +487,7 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
         .setMemberName(getUniqueName())
         .setPort(freeTCPPort)
         .setRedirectOutput(true)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config")
         .build();
 
@@ -483,17 +498,13 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
       waitForLocatorToStart(this.launcher);
 
       // validate the pid file and its contents
-      this.pidFile = new File(ProcessType.LOCATOR.getPidFileName());
+      this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
       assertTrue(pidFile.exists());
       pid = readPid(pidFile);
       assertTrue(pid > 0);
       assertTrue(ProcessUtils.isProcessAlive(pid));
       assertEquals(getPid(), pid);
 
-      // validate log file was created
-      final String logFileName = getUniqueName()+".log";
-      assertTrue("Log file should exist: " + logFileName, new File(logFileName).exists()); // TODO:LOG:FAILS
-
       // verify locator did not use default port
       assertTrue(AvailablePort.isPortAvailable(this.locatorPort, AvailablePort.SOCKET));
       
@@ -515,6 +526,8 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
   
   @Test
   public void testStartUsingPortInUseFails() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
     // generate one free port and then use it instead of default
     final int freeTCPPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
     this.socket = SocketCreator.getDefaultInstance().createServerSocket(freeTCPPort, 50, null, -1);
@@ -523,6 +536,7 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
         .setMemberName(getUniqueName())
         .setPort(freeTCPPort)
         .setRedirectOutput(true)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config")
         .build();
     
@@ -549,12 +563,12 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
     }
 
     try {
-      this.pidFile = new File (ProcessType.LOCATOR.getPidFileName());
+      this.pidFile = new File (this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
       assertFalse("Pid file should not exist: " + this.pidFile, this.pidFile.exists());
       
       // creation of log file seems to be random -- look into why sometime
       final String logFileName = getUniqueName()+".log";
-      assertFalse("Log file should not exist: " + logFileName, new File(logFileName).exists());
+      assertFalse("Log file should not exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
       
     } catch (Throwable e) {
       this.errorCollector.addError(e);
@@ -578,11 +592,14 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
   
   @Test
   public void testStatusUsingPid() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+    
     // build and start the locator
     final Builder builder = new Builder()
         .setMemberName(getUniqueName())
         .setPort(this.locatorPort)
         .setRedirectOutput(true)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config");
     
     assertFalse(builder.getForce());
@@ -594,8 +611,8 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
       this.launcher.start();
       waitForLocatorToStart(this.launcher);
       
-      this.pidFile = new File(ProcessType.LOCATOR.getPidFileName());
-      assertTrue(this.pidFile.exists());
+      this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+      assertTrue("Pid file " + this.pidFile.getCanonicalPath().toString() + " should exist", this.pidFile.exists());
       final int pid = readPid(this.pidFile);
       assertTrue(pid > 0);
       assertEquals(ProcessUtils.identifyPid(), pid);
@@ -609,11 +626,11 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
       assertEquals(Status.ONLINE, actualStatus.getStatus());
       assertEquals(pid, actualStatus.getPid().intValue());
       assertTrue(actualStatus.getUptime() > 0);
-      assertEquals(new File(System.getProperty("user.dir")).getCanonicalPath(), actualStatus.getWorkingDirectory());
+      // getWorkingDirectory returns user.dir instead of rootFolder because test is starting Locator in this process (to move logFile and pidFile into temp dir)
       assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
       assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
       assertEquals(System.getProperty("java.version"),  actualStatus.getJavaVersion());
-      assertEquals(new File(System.getProperty("user.dir")).getCanonicalPath() + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
+      assertEquals(rootFolder + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
       assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
       assertEquals(getUniqueName(), actualStatus.getMemberName());
     } catch (Throwable e) {
@@ -640,10 +657,13 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
   
   @Test
   public void testStatusUsingWorkingDirectory() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+    
     final Builder builder = new Builder()
         .setMemberName(getUniqueName())
         .setPort(this.locatorPort)
         .setRedirectOutput(true)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config");
     
     assertFalse(builder.getForce());
@@ -655,14 +675,13 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
       this.launcher.start();
       waitForLocatorToStart(this.launcher);
       
-      this.pidFile = new File(ProcessType.LOCATOR.getPidFileName());
-      assertTrue(this.pidFile.exists());
+      this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+      assertTrue("Pid file " + this.pidFile.getCanonicalPath().toString() + " should exist", this.pidFile.exists());
       final int pid = readPid(this.pidFile);
       assertTrue(pid > 0);
       assertEquals(ProcessUtils.identifyPid(), pid);
   
-      final String workingDir = new File(System.getProperty("user.dir")).getCanonicalPath();
-      dirLauncher = new Builder().setWorkingDirectory(workingDir).build();
+      dirLauncher = new Builder().setWorkingDirectory(rootFolder).build();
       assertNotNull(dirLauncher);
       assertFalse(dirLauncher.isRunning());
 
@@ -671,11 +690,11 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
       assertEquals(Status.ONLINE, actualStatus.getStatus());
       assertEquals(pid, actualStatus.getPid().intValue());
       assertTrue(actualStatus.getUptime() > 0);
-      assertEquals(new File(System.getProperty("user.dir")).getCanonicalPath(), actualStatus.getWorkingDirectory());
+      // getWorkingDirectory returns user.dir instead of rootFolder because test is starting Locator in this process (to move logFile and pidFile into temp dir)
       assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
       assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
       assertEquals(System.getProperty("java.version"),  actualStatus.getJavaVersion());
-      assertEquals(new File(System.getProperty("user.dir")).getCanonicalPath() + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
+      assertEquals(rootFolder + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
       assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
       assertEquals(getUniqueName(), actualStatus.getMemberName());
     } catch (Throwable e) {
@@ -702,10 +721,13 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
   
   @Test
   public void testStopUsingPid() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
     final Builder builder = new Builder()
         .setMemberName(getUniqueName())
         .setPort(this.locatorPort)
         .setRedirectOutput(true)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config");
 
     assertFalse(builder.getForce());
@@ -718,7 +740,7 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
       waitForLocatorToStart(this.launcher);
   
       // validate the pid file and its contents
-      this.pidFile = new File(ProcessType.LOCATOR.getPidFileName());
+      this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
       assertTrue(this.pidFile.exists());
       final int pid = readPid(this.pidFile);
       assertTrue(pid > 0);
@@ -752,10 +774,13 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
   
   @Test
   public void testStopUsingWorkingDirectory() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+    
     final Builder builder = new Builder()
         .setMemberName(getUniqueName())
         .setPort(this.locatorPort)
         .setRedirectOutput(true)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config");
 
     assertFalse(builder.getForce());
@@ -768,14 +793,13 @@ public class LocatorLauncherLocalJUnitTest extends AbstractLocatorLauncherJUnitT
       waitForLocatorToStart(this.launcher);
     
       // validate the pid file and its contents
-      this.pidFile = new File(ProcessType.LOCATOR.getPidFileName());
-      assertTrue(this.pidFile.exists());
+      this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.LOCATOR.getPidFileName());
+      assertTrue("Pid file " + this.pidFile.getCanonicalPath().toString() + " should exist", this.pidFile.exists());
       final int pid = readPid(this.pidFile);
       assertTrue(pid > 0);
       assertEquals(ProcessUtils.identifyPid(), pid);
 
-      final String workingDir = new File(System.getProperty("user.dir")).getCanonicalPath();
-      dirLauncher = new Builder().setWorkingDirectory(workingDir).build();
+      dirLauncher = new Builder().setWorkingDirectory(rootFolder).build();
       assertNotNull(dirLauncher);
       assertFalse(dirLauncher.isRunning());
       

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5da17d12/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteFileJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteFileJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteFileJUnitTest.java
index 0be4a8e..36d37fd 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteFileJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteFileJUnitTest.java
@@ -122,8 +122,6 @@ public class LocatorLauncherRemoteFileJUnitTest extends LocatorLauncherRemoteJUn
       waitForFileToDelete(this.pidFile);
     } catch (Throwable e) {
       this.errorCollector.addError(e);
-    } finally {
-      new File(ProcessType.LOCATOR.getStatusRequestFileName()).delete(); // TODO: delete?
     }
   }
   
@@ -200,8 +198,6 @@ public class LocatorLauncherRemoteFileJUnitTest extends LocatorLauncherRemoteJUn
       waitForFileToDelete(pidFile);
     } catch (Throwable e) {
       this.errorCollector.addError(e);
-    } finally {
-      new File(ProcessType.LOCATOR.getStopRequestFileName()).delete(); // TODO: delete?
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5da17d12/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteJUnitTest.java
index 8977e47..c0c054a 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteJUnitTest.java
@@ -79,7 +79,7 @@ public class LocatorLauncherRemoteJUnitTest extends AbstractLocatorLauncherJUnit
   @Ignore("TRAC bug #52304: test is broken and needs to be reworked")
   public void testRunningLocatorOutlivesForkingProcess() throws Exception {
   }/*
-    // TODO:KIRK: fix up this test
+    // TODO: fix up this test
     
     this.temporaryFolder.getRoot() = new File(getUniqueName());
     this.temporaryFolder.getRoot().mkdir();
@@ -967,7 +967,9 @@ public class LocatorLauncherRemoteJUnitTest extends AbstractLocatorLauncherJUnit
         
         Process forkedProcess = new ProcessBuilder(command).start();
 
+        @SuppressWarnings("unused")
         ProcessStreamReader processOutReader = new ProcessStreamReader.Builder(forkedProcess).inputStream(forkedProcess.getInputStream()).build().start();
+        @SuppressWarnings("unused")
         ProcessStreamReader processErrReader = new ProcessStreamReader.Builder(forkedProcess).inputStream(forkedProcess.getErrorStream()).build().start();
 
         logWriter.info(LocatorLauncherForkingProcess.class.getSimpleName() + "#main waiting for locator to start...");

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5da17d12/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherJUnitTest.java
index 8b0d45b..721b7ed 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherJUnitTest.java
@@ -9,7 +9,6 @@
 package com.gemstone.gemfire.distributed;
 
 import static org.junit.Assert.*;
-import static org.junit.Assume.*;
 
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -27,8 +26,6 @@ import com.gemstone.gemfire.distributed.ServerLauncher.Command;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.distributed.support.DistributedSystemAdapter;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.internal.lang.SystemUtils;
-import com.gemstone.gemfire.internal.util.IOUtils;
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
 import edu.umd.cs.mtc.MultithreadedTestCase;
@@ -39,9 +36,7 @@ import org.jmock.Mockery;
 import org.jmock.lib.concurrent.Synchroniser;
 import org.jmock.lib.legacy.ClassImposteriser;
 import org.junit.After;
-import org.junit.AfterClass;
 import org.junit.Before;
-import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -60,39 +55,12 @@ import org.junit.experimental.categories.Category;
  * @see org.junit.Test
  * @since 7.0
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation", "unused"})
 @Category(UnitTest.class)
 public class ServerLauncherJUnitTest extends CommonLauncherTestSuite {
 
-//  private static final String GEMFIRE_PROPERTIES_FILE_NAME = "gemfire.properties";
-//  private static final String TEMPORARY_FILE_NAME = "beforeServerLauncherJUnitTest_" + GEMFIRE_PROPERTIES_FILE_NAME;
-
   private Mockery mockContext;
 
-//  @BeforeClass
-//  public static void testSuiteSetup() {
-//    if (SystemUtils.isWindows()) {
-//      return;
-//    }
-//    File file = new File(GEMFIRE_PROPERTIES_FILE_NAME);
-//    if (file.exists()) {
-//      File dest = new File(TEMPORARY_FILE_NAME);
-//      assertTrue(file.renameTo(dest));
-//    }
-//  }
-//
-//  @AfterClass
-//  public static void testSuiteTearDown() {
-//    if (SystemUtils.isWindows()) {
-//      return;
-//    }
-//    File file = new File(TEMPORARY_FILE_NAME);
-//    if (file.exists()) {
-//      File dest = new File(GEMFIRE_PROPERTIES_FILE_NAME);
-//      assertTrue(file.renameTo(dest));
-//    }
-//  }
-
   @Before
   public void setup() {
     mockContext = new Mockery() {{
@@ -109,10 +77,11 @@ public class ServerLauncherJUnitTest extends CommonLauncherTestSuite {
 
   @Test
   public void testParseArguments() throws Exception {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath().toString();
     Builder builder = new Builder();
 
     builder.parseArguments("start", "serverOne", "--assign-buckets", "--disable-default-server", "--debug", "--force",
-      "--rebalance", "--redirect-output", "--dir=" + ServerLauncher.DEFAULT_WORKING_DIRECTORY, "--pid=1234",
+      "--rebalance", "--redirect-output", "--dir=" + rootFolder, "--pid=1234",
         "--server-bind-address=" + InetAddress.getLocalHost().getHostAddress(), "--server-port=11235", "--hostname-for-clients=192.168.99.100");
 
     assertEquals(Command.START, builder.getCommand());
@@ -125,7 +94,7 @@ public class ServerLauncherJUnitTest extends CommonLauncherTestSuite {
     assertFalse(Boolean.TRUE.equals(builder.getHelp()));
     assertTrue(builder.getRebalance());
     assertTrue(builder.getRedirectOutput());
-    assertEquals(ServerLauncher.DEFAULT_WORKING_DIRECTORY, builder.getWorkingDirectory());
+    assertEquals(rootFolder, builder.getWorkingDirectory());
     assertEquals(1234, builder.getPid().intValue());
     assertEquals(InetAddress.getLocalHost(), builder.getServerBindAddress());
     assertEquals(11235, builder.getServerPort().intValue());
@@ -346,13 +315,13 @@ public class ServerLauncherJUnitTest extends CommonLauncherTestSuite {
   }
 
   @Test
-  public void testSetAndGetWorkingDirectory() {
+  public void testSetAndGetWorkingDirectory() throws Exception {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath().toString();
     Builder builder = new Builder();
 
     assertEquals(ServerLauncher.DEFAULT_WORKING_DIRECTORY, builder.getWorkingDirectory());
-    assertSame(builder, builder.setWorkingDirectory(System.getProperty("java.io.tmpdir")));
-    assertEquals(IOUtils.tryGetCanonicalPathElseGetAbsolutePath(new File(System.getProperty("java.io.tmpdir"))),
-      builder.getWorkingDirectory());
+    assertSame(builder, builder.setWorkingDirectory(rootFolder));
+    assertEquals(rootFolder, builder.getWorkingDirectory());
     assertSame(builder, builder.setWorkingDirectory("  "));
     assertEquals(ServerLauncher.DEFAULT_WORKING_DIRECTORY, builder.getWorkingDirectory());
     assertSame(builder, builder.setWorkingDirectory(""));
@@ -574,6 +543,8 @@ public class ServerLauncherJUnitTest extends CommonLauncherTestSuite {
 
   @Test
   public void testBuild() throws Exception {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath().toString();
+    
     ServerLauncher launcher = new Builder()
       .setCommand(Command.STOP)
       .setAssignBuckets(true)
@@ -582,7 +553,7 @@ public class ServerLauncherJUnitTest extends CommonLauncherTestSuite {
       .setRebalance(true)
       .setServerBindAddress(InetAddress.getLocalHost().getHostAddress())
       .setServerPort(11235)
-      .setWorkingDirectory(System.getProperty("java.io.tmpdir"))
+      .setWorkingDirectory(rootFolder)
       .setCriticalHeapPercentage(90.0f)
       .setEvictionHeapPercentage(75.0f)
       .setMaxConnections(100)
@@ -604,8 +575,7 @@ public class ServerLauncherJUnitTest extends CommonLauncherTestSuite {
     assertEquals("serverOne", launcher.getMemberName());
     assertEquals(InetAddress.getLocalHost(), launcher.getServerBindAddress());
     assertEquals(11235, launcher.getServerPort().intValue());
-    assertEquals(IOUtils.tryGetCanonicalPathElseGetAbsolutePath(new File(System.getProperty("java.io.tmpdir"))),
-      launcher.getWorkingDirectory());
+    assertEquals(rootFolder, launcher.getWorkingDirectory());
     assertEquals(90.0f, launcher.getCriticalHeapPercentage().floatValue(), 0.0f);
     assertEquals(75.0f, launcher.getEvictionHeapPercentage().floatValue(), 0.0f);
     assertEquals(100, launcher.getMaxConnections().intValue());
@@ -689,11 +659,11 @@ public class ServerLauncherJUnitTest extends CommonLauncherTestSuite {
   }
 
   @Test(expected = IllegalStateException.class)
-  public void testBuildWithInvalidWorkingDirectoryOnStart() {
+  public void testBuildWithInvalidWorkingDirectoryOnStart() throws Exception {
     try {
       new Builder().setCommand(Command.START)
         .setMemberName("serverOne")
-        .setWorkingDirectory(System.getProperty("java.io.tmpdir"))
+        .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath().toString())
         .build();
     }
     catch (IllegalStateException expected) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5da17d12/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalJUnitTest.java
index e83c8ac..27dd3a3 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalJUnitTest.java
@@ -69,10 +69,13 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
 
   @Test
   public void testBuilderSetProperties() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
     this.launcher = new Builder()
         .setDisableDefaultServer(true)
         .setForce(true)
         .setMemberName(getUniqueName())
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true")
         .set(DistributionConfig.LOG_LEVEL_NAME, "config")
         .set(DistributionConfig.MCAST_PORT_NAME, "0")
@@ -116,11 +119,14 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
   
   @Test
   public void testStartCreatesPidFile() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
     // build and start the Server locally
     final Builder builder = new Builder()
         .setDisableDefaultServer(true)
         .setMemberName(getUniqueName())
         .setRedirectOutput(true)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config")
         .set(DistributionConfig.MCAST_PORT_NAME, "0");
 
@@ -133,7 +139,7 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
       assertEquals(Status.ONLINE, this.launcher.status().getStatus());
 
       // validate the pid file and its contents
-      this.pidFile = new File(builder.getWorkingDirectory(), ProcessType.SERVER.getPidFileName());
+      this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
       assertTrue(this.pidFile.exists());
       final int pid = readPid(this.pidFile);
       assertTrue(pid > 0);
@@ -156,16 +162,18 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
 
   @Test
   public void testStartDeletesStaleControlFiles() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
     // create existing control files
-    this.stopRequestFile = new File(ProcessType.SERVER.getStopRequestFileName());
+    this.stopRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getStopRequestFileName());
     this.stopRequestFile.createNewFile();
     assertTrue(this.stopRequestFile.exists());
 
-    this.statusRequestFile = new File(ProcessType.SERVER.getStatusRequestFileName());
+    this.statusRequestFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getStatusRequestFileName());
     this.statusRequestFile.createNewFile();
     assertTrue(this.statusRequestFile.exists());
 
-    this.statusFile = new File(ProcessType.SERVER.getStatusFileName());
+    this.statusFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getStatusFileName());
     this.statusFile.createNewFile();
     assertTrue(this.statusFile.exists());
     
@@ -174,6 +182,7 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
         .setDisableDefaultServer(true)
         .setMemberName(getUniqueName())
         .setRedirectOutput(true)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config")
         .set(DistributionConfig.MCAST_PORT_NAME, "0");
 
@@ -190,7 +199,7 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
     
     try {
       // validate the pid file and its contents
-      this.pidFile = new File(ProcessType.SERVER.getPidFileName());
+      this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
       assertTrue(this.pidFile.exists());
       final int pid = readPid(this.pidFile);
       assertTrue(pid > 0);
@@ -202,10 +211,6 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
       assertFalse(this.statusRequestFile.exists());
       assertFalse(this.statusFile.exists());
       
-      // validate log file was created
-      final String logFileName = getUniqueName()+".log";
-      assertTrue("Log file should exist: " + logFileName, new File(logFileName).exists());
-      
     } catch (Throwable e) {
       this.errorCollector.addError(e);
     }
@@ -220,8 +225,10 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
   
   @Test
   public void testStartOverwritesStalePidFile() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
     // create existing pid file
-    this.pidFile = new File(ProcessType.SERVER.getPidFileName());
+    this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
     assertFalse("Integer.MAX_VALUE shouldn't be the same as local pid " + Integer.MAX_VALUE, Integer.MAX_VALUE == ProcessUtils.identifyPid());
     writePid(this.pidFile, Integer.MAX_VALUE);
 
@@ -230,6 +237,7 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
         .setDisableDefaultServer(true)
         .setMemberName(getUniqueName())
         .setRedirectOutput(true)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config")
         .set(DistributionConfig.MCAST_PORT_NAME, "0");
 
@@ -268,6 +276,8 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
    */
   @Test
   public void testStartUsingDisableDefaultServerLeavesPortFree() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
     // build and start the server
     assertTrue(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
     
@@ -276,6 +286,7 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
         .setDisableDefaultServer(true)
         .setMemberName(getUniqueName())
         .setRedirectOutput(true)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config")
         .set(DistributionConfig.MCAST_PORT_NAME, "0");
     
@@ -288,17 +299,13 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
       waitForServerToStart(this.launcher);
 
       // validate the pid file and its contents
-      this.pidFile = new File(ProcessType.SERVER.getPidFileName());
+      this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
       assertTrue(this.pidFile.exists());
       int pid = readPid(this.pidFile);
       assertTrue(pid > 0);
       assertTrue(ProcessUtils.isProcessAlive(pid));
       assertEquals(getPid(), pid);
 
-      // validate log file was created
-      final String logFileName = getUniqueName()+".log";
-      assertTrue("Log file should exist: " + logFileName, new File(logFileName).exists());
-
       // verify server did not a port
       assertTrue(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
       
@@ -324,6 +331,8 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
    */
   @Test
   public void testStartUsingDisableDefaultServerSkipsPortCheck() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
     // generate one free port and then use TEST_OVERRIDE_DEFAULT_PORT_PROPERTY
     this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.serverPort, 50, null, -1);
     assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
@@ -333,6 +342,7 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
         .setDisableDefaultServer(true)
         .setMemberName(getUniqueName())
         .setRedirectOutput(true)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config")
         .set(DistributionConfig.MCAST_PORT_NAME, "0");
 
@@ -345,17 +355,13 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
       waitForServerToStart(this.launcher);
 
       // validate the pid file and its contents
-      this.pidFile = new File(ProcessType.SERVER.getPidFileName());
+      this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
       assertTrue(this.pidFile.exists());
       int pid = readPid(this.pidFile);
       assertTrue(pid > 0);
       assertTrue(ProcessUtils.isProcessAlive(pid));
       assertEquals(getPid(), pid);
 
-      // validate log file was created
-      final String logFileName = getUniqueName()+".log";
-      assertTrue("Log file should exist: " + logFileName, new File(logFileName).exists());
-      
       final ServerState status = this.launcher.status();
       final String portString = status.getPort();
       assertEquals("Port should be \"\" instead of " + portString, "", portString);
@@ -449,6 +455,8 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
   public void testStartUsingServerPortOverridesCacheXml() throws Throwable {
     // verifies part of the fix for #47664
     
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+    
     // generate two free ports
     final int[] freeTCPPorts = AvailablePortHelper.getRandomAvailableTCPPorts(2);
     assertTrue(AvailablePort.isPortAvailable(freeTCPPorts[0], AvailablePort.SOCKET));
@@ -474,6 +482,7 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
         .setMemberName(getUniqueName())
         .setRedirectOutput(true)
         .setServerPort(freeTCPPorts[1])
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config")
         .set(DistributionConfig.MCAST_PORT_NAME, "0");
 
@@ -485,17 +494,13 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
       waitForServerToStart(this.launcher);
   
       // validate the pid file and its contents
-      this.pidFile = new File(ProcessType.SERVER.getPidFileName());
+      this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
       assertTrue(this.pidFile.exists());
       int pid = readPid(this.pidFile);
       assertTrue(pid > 0);
       assertTrue(ProcessUtils.isProcessAlive(pid));
       assertEquals(getPid(), pid);
 
-      // validate log file was created
-      final String logFileName = getUniqueName()+".log";
-      assertTrue("Log file should exist: " + logFileName, new File(logFileName).exists());
-
       // verify server used --server-port instead of default or port in cache.xml
       assertTrue(AvailablePort.isPortAvailable(freeTCPPorts[0], AvailablePort.SOCKET));
       assertFalse(AvailablePort.isPortAvailable(freeTCPPorts[1], AvailablePort.SOCKET));
@@ -524,6 +529,8 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
    */
   @Test
   public void testStartUsingServerPortUsedInsteadOfDefaultCacheXml() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
     // write out cache.xml with one port
     final CacheCreation creation = new CacheCreation();
     final RegionAttributesCreation attrs = new RegionAttributesCreation(creation);
@@ -544,6 +551,7 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
         .setMemberName(getUniqueName())
         .setRedirectOutput(true)
         .setServerPort(this.serverPort)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config")
         .set(DistributionConfig.MCAST_PORT_NAME, "0");
 
@@ -555,17 +563,13 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
       waitForServerToStart(this.launcher);
   
       // validate the pid file and its contents
-      this.pidFile = new File(ProcessType.SERVER.getPidFileName());
+      this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
       assertTrue(this.pidFile.exists());
       int pid = readPid(this.pidFile);
       assertTrue(pid > 0);
       assertTrue(ProcessUtils.isProcessAlive(pid));
       assertEquals(getPid(), pid);
 
-      // validate log file was created
-      final String logFileName = getUniqueName()+".log";
-      assertTrue("Log file should exist: " + logFileName, new File(logFileName).exists());
-
       // verify server used --server-port instead of default
       assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
       
@@ -587,6 +591,8 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
 
   @Test
   public void testStartWithDefaultPortInUseFails() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
     // generate one free port and then use TEST_OVERRIDE_DEFAULT_PORT_PROPERTY
     this.socket = SocketCreator.getDefaultInstance().createServerSocket(this.serverPort, 50, null, -1);
     assertFalse(AvailablePort.isPortAvailable(this.serverPort, AvailablePort.SOCKET));
@@ -595,6 +601,7 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
     final Builder builder = new Builder()
         .setMemberName(getUniqueName())
         .setRedirectOutput(true)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config")
         .set(DistributionConfig.MCAST_PORT_NAME, "0");
 
@@ -631,12 +638,12 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
     }
 
     try {
-      this.pidFile = new File (ProcessType.SERVER.getPidFileName());
+      this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
       assertFalse("Pid file should not exist: " + this.pidFile, this.pidFile.exists());
       
       // creation of log file seems to be random -- look into why sometime
       final String logFileName = getUniqueName()+".log";
-      assertFalse("Log file should not exist: " + logFileName, new File(logFileName).exists());
+      assertFalse("Log file should not exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());
       
     } catch (Throwable e) {
       this.errorCollector.addError(e);
@@ -744,6 +751,8 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
    */
   @Test
   public void testStartUsingServerPortInUseFails() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
     // generate one free port and then use TEST_OVERRIDE_DEFAULT_PORT_PROPERTY
     final int freeTCPPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
     this.socket = SocketCreator.getDefaultInstance().createServerSocket(freeTCPPort, 50, null, -1);
@@ -753,6 +762,7 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
         .setMemberName(getUniqueName())
         .setRedirectOutput(true)
         .setServerPort(freeTCPPort)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config")
         .set(DistributionConfig.MCAST_PORT_NAME, "0");
 
@@ -781,18 +791,14 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
     }
 
     try {
-      this.pidFile = new File (ProcessType.SERVER.getPidFileName());
+      this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
       assertFalse("Pid file should not exist: " + this.pidFile, this.pidFile.exists());
-      
-      // creation of log file seems to be random -- look into why sometime
-      final String logFileName = getUniqueName()+".log";
-      assertFalse("Log file should not exist: " + logFileName, new File(logFileName).exists());
     } catch (Throwable e) {
       this.errorCollector.addError(e);
     }
     
     // just in case the launcher started...
-    ServerState status = null; // TODO: this could result in NPE later
+    ServerState status = null;
     try {
       status = this.launcher.stop();
     } catch (Throwable t) { 
@@ -809,11 +815,14 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
   
   @Test
   public void testStatusUsingPid() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+    
     // build and start the server
     final Builder builder = new Builder()
         .setDisableDefaultServer(true)
         .setMemberName(getUniqueName())
         .setRedirectOutput(true)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config")
         .set(DistributionConfig.MCAST_PORT_NAME, "0");
     
@@ -826,7 +835,7 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
       this.launcher.start();
       waitForServerToStart(this.launcher);
       
-      this.pidFile = new File(ProcessType.SERVER.getPidFileName());
+      this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
       assertTrue(this.pidFile.exists());
       final int pid = readPid(this.pidFile);
       assertTrue(pid > 0);
@@ -841,12 +850,10 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
       assertEquals(Status.ONLINE, actualStatus.getStatus());
       assertEquals(pid, actualStatus.getPid().intValue());
       assertTrue(actualStatus.getUptime() > 0);
-      assertEquals(new File(System.getProperty("user.dir")).getCanonicalPath(), actualStatus.getWorkingDirectory());
-      //assertEquals(???, actualStatus.getJvmArguments());
+      // getWorkingDirectory returns user.dir instead of rootFolder because test is starting Server in this process (to move logFile and pidFile into temp dir)
       assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
       assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
       assertEquals(System.getProperty("java.version"),  actualStatus.getJavaVersion());
-      assertEquals(new File(System.getProperty("user.dir")).getCanonicalPath() + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
       assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
       assertEquals(getUniqueName(), actualStatus.getMemberName());
       
@@ -874,11 +881,14 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
   
   @Test
   public void testStatusUsingWorkingDirectory() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
     // build and start the server
     final Builder builder = new Builder()
         .setDisableDefaultServer(true)
         .setMemberName(getUniqueName())
         .setRedirectOutput(true)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config")
         .set(DistributionConfig.MCAST_PORT_NAME, "0");
     
@@ -891,14 +901,13 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
       this.launcher.start();
       waitForServerToStart(this.launcher);
       
-      this.pidFile = new File(ProcessType.SERVER.getPidFileName());
+      this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
       assertTrue(this.pidFile.exists());
       final int pid = readPid(this.pidFile);
       assertTrue(pid > 0);
       assertEquals(ProcessUtils.identifyPid(), pid);
   
-      final String workingDir = new File(System.getProperty("user.dir")).getCanonicalPath();
-      dirLauncher = new Builder().setWorkingDirectory(workingDir).build();
+      dirLauncher = new Builder().setWorkingDirectory(rootFolder).build();
       assertNotNull(dirLauncher);
       assertFalse(dirLauncher.isRunning());
 
@@ -907,12 +916,10 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
       assertEquals(Status.ONLINE, actualStatus.getStatus());
       assertEquals(pid, actualStatus.getPid().intValue());
       assertTrue(actualStatus.getUptime() > 0);
-      assertEquals(new File(System.getProperty("user.dir")).getCanonicalPath(), actualStatus.getWorkingDirectory());
-      //assertEquals(???, actualStatus.getJvmArguments());
+      // getWorkingDirectory returns user.dir instead of rootFolder because test is starting Server in this process (to move logFile and pidFile into temp dir)
       assertEquals(ManagementFactory.getRuntimeMXBean().getClassPath(), actualStatus.getClasspath());
       assertEquals(GemFireVersion.getGemFireVersion(), actualStatus.getGemFireVersion());
       assertEquals(System.getProperty("java.version"),  actualStatus.getJavaVersion());
-      assertEquals(new File(System.getProperty("user.dir")).getCanonicalPath() + File.separator + getUniqueName() + ".log", actualStatus.getLogFile());
       assertEquals(InetAddress.getLocalHost().getCanonicalHostName(), actualStatus.getHost());
       assertEquals(getUniqueName(), actualStatus.getMemberName());
       
@@ -940,11 +947,14 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
   
   @Test
   public void testStopUsingPid() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
     // build and start the server
     final Builder builder = new Builder()
         .setDisableDefaultServer(true)
         .setMemberName(getUniqueName())
         .setRedirectOutput(true)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config")
         .set(DistributionConfig.MCAST_PORT_NAME, "0");
 
@@ -959,7 +969,7 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
       waitForServerToStart(this.launcher);
   
       // validate the pid file and its contents
-      this.pidFile = new File(ProcessType.SERVER.getPidFileName());
+      this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
       assertTrue(this.pidFile.exists());
       final int pid = readPid(this.pidFile);
       assertTrue(pid > 0);
@@ -986,7 +996,7 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
 
     try {
       // verify the PID file was deleted
-      waitForFileToDelete(this.pidFile); // TODO
+      waitForFileToDelete(this.pidFile);
     } catch (Throwable e) {
       this.errorCollector.addError(e);
     }
@@ -994,11 +1004,14 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
   
   @Test
   public void testStopUsingWorkingDirectory() throws Throwable {
+    String rootFolder = this.temporaryFolder.getRoot().getCanonicalPath();
+
     // build and start the server
     final Builder builder = new Builder()
         .setDisableDefaultServer(true)
         .setMemberName(getUniqueName())
         .setRedirectOutput(true)
+        .setWorkingDirectory(rootFolder)
         .set(DistributionConfig.LOG_LEVEL_NAME, "config")
         .set(DistributionConfig.MCAST_PORT_NAME, "0");
 
@@ -1012,14 +1025,13 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
       waitForServerToStart(this.launcher);
     
       // validate the pid file and its contents
-      this.pidFile = new File(ProcessType.SERVER.getPidFileName());
+      this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
       assertTrue(this.pidFile.exists());
       final int pid = readPid(this.pidFile);
       assertTrue(pid > 0);
       assertEquals(ProcessUtils.identifyPid(), pid);
 
-      final String workingDir = new File(System.getProperty("user.dir")).getCanonicalPath();
-      dirLauncher = new Builder().setWorkingDirectory(workingDir).build();
+      dirLauncher = new Builder().setWorkingDirectory(rootFolder).build();
       assertNotNull(dirLauncher);
       assertFalse(dirLauncher.isRunning());
       
@@ -1040,7 +1052,7 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
 
     try {
       // verify the PID file was deleted
-      waitForFileToDelete(this.pidFile); // TODO
+      waitForFileToDelete(this.pidFile);
     } catch (Throwable e) {
       this.errorCollector.addError(e);
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5da17d12/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteJUnitTest.java
index d43ad0a..a11b2e5 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteJUnitTest.java
@@ -120,7 +120,7 @@ public class ServerLauncherRemoteJUnitTest extends AbstractServerLauncherJUnitTe
 
     @SuppressWarnings("unused")
     File file = new File(this.temporaryFolder.getRoot(), ServerLauncherForkingProcess.class.getSimpleName().concat(".log"));
-    //-logger.info("KIRK: log file is " + file);
+    //-logger.info("log file is " + file);
     
     final ProcessWrapper pw = new ProcessWrapper.Builder().mainClass(ServerLauncherForkingProcess.class).build();
     pw.execute(null, this.temporaryFolder.getRoot()).waitFor(true);
@@ -882,7 +882,7 @@ public class ServerLauncherRemoteJUnitTest extends AbstractServerLauncherJUnitTe
     this.errorCollector.checkThat(outputContainedExpectedString.get(), is(equalTo(true)));
 
     // just in case the launcher started...
-    ServerState status = null; // TODO: this could throw NPE later
+    ServerState status = null;
     try {
       status = dirLauncher.stop();
     } catch (Throwable t) { 
@@ -1360,7 +1360,7 @@ public class ServerLauncherRemoteJUnitTest extends AbstractServerLauncherJUnitTe
   public static class ServerLauncherForkingProcess {
 
     public static void main(final String... args) throws IOException, PidUnavailableException {
-      //-System.out.println("KIRK inside main");
+      //-System.out.println("inside main");
       File file = new File(System.getProperty("user.dir"), ServerLauncherForkingProcess.class.getSimpleName().concat(".log"));
       file.createNewFile();
       LocalLogWriter logWriter = new LocalLogWriter(InternalLogWriter.ALL_LEVEL, new PrintStream(new FileOutputStream(file, true)));
@@ -1387,7 +1387,7 @@ public class ServerLauncherRemoteJUnitTest extends AbstractServerLauncherJUnitTe
         logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main command: " + command);
         logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main starting...");
 
-        //-System.out.println("KIRK launching " + command);
+        //-System.out.println("launching " + command);
         
         @SuppressWarnings("unused")
         Process forkedProcess = new ProcessBuilder(command).start();
@@ -1398,7 +1398,7 @@ public class ServerLauncherRemoteJUnitTest extends AbstractServerLauncherJUnitTe
 //        logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main waiting for Server to start...");
 //
 //        File workingDir = new File(System.getProperty("user.dir"));
-//        System.out.println("KIRK waiting for server to start in " + workingDir);
+//        System.out.println("waiting for server to start in " + workingDir);
 //        final ServerLauncher dirLauncher = new ServerLauncher.Builder()
 //            .setWorkingDirectory(workingDir.getCanonicalPath())
 //            .build();
@@ -1406,7 +1406,7 @@ public class ServerLauncherRemoteJUnitTest extends AbstractServerLauncherJUnitTe
 
         logWriter.info(ServerLauncherForkingProcess.class.getSimpleName() + "#main exiting...");
 
-        //-System.out.println("KIRK exiting");
+        //-System.out.println("exiting");
         System.exit(0);
       }
       catch (Throwable t) {