geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [17/37] incubator-geode git commit: GEODE-1255: Add test coverage for using a custom log4j2.xml with Geode
Date Fri, 06 May 2016 21:40:48 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTestCase.java
new file mode 100755
index 0000000..043b5ae
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherIntegrationTestCase.java
@@ -0,0 +1,254 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.junit.Assert.*;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.Callable;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.logging.log4j.Logger;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.contrib.java.lang.system.RestoreSystemProperties;
+import org.junit.rules.TestName;
+
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.internal.FileUtil;
+import com.gemstone.gemfire.internal.lang.StringUtils;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.internal.process.PidUnavailableException;
+import com.gemstone.gemfire.internal.process.ProcessStreamReader.InputListener;
+import com.gemstone.gemfire.internal.process.ProcessUtils;
+import com.gemstone.gemfire.internal.util.IOUtils;
+import com.gemstone.gemfire.internal.util.StopWatch;
+
+/**
+ * @since 8.0
+ */
+public abstract class AbstractLauncherIntegrationTestCase {
+  protected static final Logger logger = LogService.getLogger();
+  
+  protected static final int WAIT_FOR_PROCESS_TO_DIE_TIMEOUT = 5 * 60 * 1000; // 5 minutes
+  protected static final int TIMEOUT_MILLISECONDS = WAIT_FOR_PROCESS_TO_DIE_TIMEOUT;
+  protected static final int WAIT_FOR_FILE_CREATION_TIMEOUT = 10*1000;
+  protected static final int WAIT_FOR_FILE_DELETION_TIMEOUT = 10*1000;
+  protected static final int WAIT_FOR_MBEAN_TIMEOUT = 10*1000;
+  protected static final int INTERVAL = 100;
+  protected static final int INTERVAL_MILLISECONDS = INTERVAL;
+  
+  private static final String EXPECTED_EXCEPTION_ADD = "<ExpectedException action=add>{}</ExpectedException>";
+  private static final String EXPECTED_EXCEPTION_REMOVE = "<ExpectedException action=remove>{}</ExpectedException>";
+  private static final String EXPECTED_EXCEPTION_MBEAN_NOT_REGISTERED = "MBean Not Registered In GemFire Domain";
+  
+  protected volatile ServerSocket socket;
+  
+  protected volatile File pidFile;
+  protected volatile File stopRequestFile;
+  protected volatile File statusRequestFile;
+  protected volatile File statusFile;
+  
+  @Rule
+  public TestName testName= new TestName();
+
+  @Rule
+  public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
+  
+  @Before
+  public final void setUpAbstractLauncherIntegrationTestCase() throws Exception {
+    System.setProperty("gemfire." + DistributionConfig.MCAST_PORT_NAME, Integer.toString(0));
+    logger.info(EXPECTED_EXCEPTION_ADD, EXPECTED_EXCEPTION_MBEAN_NOT_REGISTERED);
+  }
+
+  @After
+  public final void tearDownAbstractLauncherIntegrationTestCase() throws Exception {
+    logger.info(EXPECTED_EXCEPTION_REMOVE, EXPECTED_EXCEPTION_MBEAN_NOT_REGISTERED);
+    if (this.socket != null) {
+      this.socket.close();
+      this.socket = null;
+    }
+    delete(this.pidFile); this.pidFile = null;
+    delete(this.stopRequestFile); this.stopRequestFile = null;
+    delete(this.statusRequestFile); this.statusRequestFile = null;
+    delete(this.statusFile); this.statusFile = null;
+  }
+  
+  protected void delete(final File file) throws Exception {
+    assertEventuallyTrue("deleting " + file, new Callable<Boolean>() {
+      @Override
+      public Boolean call() throws Exception {
+        if (file == null) {
+          return true;
+        }
+        try {
+          FileUtil.delete(file);
+        } catch (IOException e) {
+        }
+        return !file.exists();
+      }
+    }, WAIT_FOR_FILE_DELETION_TIMEOUT, INTERVAL);
+  }
+  
+  protected void waitForPidToStop(final int pid, boolean throwOnTimeout) throws Exception {
+    assertEventuallyFalse("Process never died", new Callable<Boolean>() {
+      @Override
+      public Boolean call() throws Exception {
+        return ProcessUtils.isProcessAlive(pid);
+      }
+    }, WAIT_FOR_PROCESS_TO_DIE_TIMEOUT, INTERVAL);
+  }
+  
+  protected void waitForPidToStop(final int pid) throws Exception {
+    waitForPidToStop(pid, true);
+  }
+  
+  protected void waitForFileToDelete(final File file, boolean throwOnTimeout) throws Exception {
+    if (file == null) {
+      return;
+    }
+    assertEventuallyTrue("waiting for file " + file + " to delete", new Callable<Boolean>() {
+      @Override
+      public Boolean call() throws Exception {
+        return !file.exists();
+      }
+    }, WAIT_FOR_FILE_DELETION_TIMEOUT, INTERVAL);
+  }
+  
+  protected void waitForFileToDelete(final File file) throws Exception {
+    waitForFileToDelete(file, true);
+  }
+  
+  protected static int getPid() throws PidUnavailableException {
+    return ProcessUtils.identifyPid();
+  }
+
+  protected InputListener createLoggingListener(final String name, final String header) {
+    return new InputListener() {
+      @Override
+      public void notifyInputLine(String line) {
+        logger.info(new StringBuilder("[").append(header).append("]").append(line).toString());
+      }
+      @Override
+      public String toString() {
+        return name;
+      }
+    };
+  }
+
+  protected InputListener createCollectionListener(final String name, final String header, final List<String> lines) {
+    return new InputListener() {
+      @Override
+      public void notifyInputLine(String line) {
+        lines.add(line);
+      }
+      @Override
+      public String toString() {
+        return name;
+      }
+    };
+  }
+
+  protected InputListener createExpectedListener(final String name, final String header, final String expected, final AtomicBoolean atomic) {
+    return new InputListener() {
+      @Override
+      public void notifyInputLine(String line) {
+        if (line.contains(expected)) {
+          atomic.set(true);
+        }
+      }
+      @Override
+      public String toString() {
+        return name;
+      }
+    };
+  }
+
+  protected void writeGemfireProperties(final Properties gemfireProperties, final File gemfirePropertiesFile) throws IOException {
+    if (!gemfirePropertiesFile.exists()) {
+      gemfireProperties.store(new FileWriter(gemfirePropertiesFile), "Configuration settings for the GemFire Server");
+    }
+  }
+
+  protected int readPid(final File pidFile) throws IOException {
+    BufferedReader reader = null;
+    try {
+      reader = new BufferedReader(new FileReader(pidFile));
+      return Integer.parseInt(StringUtils.trim(reader.readLine()));
+    }
+    finally {
+      IOUtils.close(reader);
+    }
+  }
+
+  protected void writePid(final File pidFile, final int pid) throws IOException {
+    FileWriter writer = new FileWriter(pidFile);
+    writer.write(String.valueOf(pid));
+    writer.write("\n");
+    writer.flush();
+    writer.close();
+  }
+
+  protected void waitForFileToExist(final File file, boolean throwOnTimeout) throws Exception {
+    assertEventuallyTrue("waiting for file " + file + " to exist", new Callable<Boolean>() {
+      @Override
+      public Boolean call() throws Exception {
+        return file.exists();
+      }
+    }, WAIT_FOR_FILE_CREATION_TIMEOUT, INTERVAL);
+  }
+  
+  protected void waitForFileToExist(final File file) throws Exception {
+    waitForFileToExist(file, true);
+  }
+  
+  protected String getUniqueName() {
+    return getClass().getSimpleName() + "_" + testName.getMethodName();
+  }
+  
+  protected static void assertEventuallyTrue(final String message, final Callable<Boolean> callable, final int timeout, final int interval) throws Exception {
+    boolean done = false;
+    for (StopWatch time = new StopWatch(true); !done && time.elapsedTimeMillis() < timeout; done = (callable.call())) {
+      Thread.sleep(interval);
+    }
+    assertTrue(message, done);
+  }
+  
+  protected static void assertEventuallyFalse(final String message, final Callable<Boolean> callable, final int timeout, final int interval) throws Exception {
+    boolean done = false;
+    for (StopWatch time = new StopWatch(true); !done && time.elapsedTimeMillis() < timeout; done = (!callable.call())) {
+      Thread.sleep(interval);
+    }
+    assertTrue(message, done);
+  }
+  
+  protected static void disconnectFromDS() {
+    InternalDistributedSystem ids = InternalDistributedSystem.getConnectedInstance();
+    if (ids != null) {
+      ids.disconnect();
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherJUnitTest.java
deleted file mode 100644
index f5867d4..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherJUnitTest.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static org.junit.Assert.*;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Properties;
-import java.util.concurrent.TimeUnit;
-
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.lang.StringUtils;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-/**
- * The AbstractLauncherJUnitTest class is a test suite of unit tests testing the contract and functionality
- * of the AbstractLauncher class.
- * <p/>
- * @see com.gemstone.gemfire.distributed.AbstractLauncher
- * @see org.junit.Assert
- * @see org.junit.Test
- * @since 7.0
- */
-@Category(UnitTest.class)
-public class AbstractLauncherJUnitTest {
-
-  protected AbstractLauncher<?> createAbstractLauncher(final String memberName, final String memberId) {
-    return new FakeServiceLauncher(memberName, memberId);
-  }
-
-  @Test
-  public void testIsAttachAPINotFound() {
-    final AbstractLauncher<?> launcher = createAbstractLauncher("012", "TestMember");
-
-    assertTrue(launcher.isAttachAPINotFound(new NoClassDefFoundError(
-      "Exception in thread \"main\" java.lang.NoClassDefFoundError: com/sun/tools/attach/AttachNotSupportedException")));
-    assertTrue(launcher.isAttachAPINotFound(new ClassNotFoundException(
-      "Caused by: java.lang.ClassNotFoundException: com.sun.tools.attach.AttachNotSupportedException")));
-    assertTrue(launcher.isAttachAPINotFound(new NoClassDefFoundError(
-      "Exception in thread \"main\" java.lang.NoClassDefFoundError: com/ibm/tools/attach/AgentNotSupportedException")));
-    assertTrue(launcher.isAttachAPINotFound(new ClassNotFoundException(
-      "Caused by: java.lang.ClassNotFoundException: com.ibm.tools.attach.AgentNotSupportedException")));
-    assertFalse(launcher.isAttachAPINotFound(new IllegalArgumentException(
-      "Caused by: java.lang.ClassNotFoundException: com.sun.tools.attach.AttachNotSupportedException")));
-    assertFalse(launcher.isAttachAPINotFound(new IllegalStateException(
-      "Caused by: java.lang.ClassNotFoundException: com.ibm.tools.attach.AgentNotSupportedException")));
-    assertFalse(launcher.isAttachAPINotFound(new NoClassDefFoundError(
-      "Exception in thread \"main\" java.lang.NoClassDefFoundError: com/companyx/app/service/MyServiceClass")));
-    assertFalse(launcher.isAttachAPINotFound(new ClassNotFoundException(
-      "Caused by: java.lang.ClassNotFoundException: com.companyx.app.attach.NutsNotAttachedException")));
-  }
-
-  @Test
-  public void testIsSet() {
-    final Properties properties = new Properties();
-
-    assertFalse(properties.containsKey(DistributionConfig.NAME_NAME));
-    assertFalse(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME));
-
-    properties.setProperty(DistributionConfig.NAME_NAME, "");
-
-    assertTrue(properties.containsKey(DistributionConfig.NAME_NAME));
-    assertFalse(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME));
-
-    properties.setProperty(DistributionConfig.NAME_NAME, "  ");
-
-    assertTrue(properties.containsKey(DistributionConfig.NAME_NAME));
-    assertFalse(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME));
-
-    properties.setProperty(DistributionConfig.NAME_NAME, "memberOne");
-
-    assertTrue(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME));
-    assertFalse(AbstractLauncher.isSet(properties, "NaMe"));
-  }
-
-  @Test
-  public void testLoadGemFirePropertiesWithNullURL() {
-    final Properties properties = AbstractLauncher.loadGemFireProperties(null);
-    assertNotNull(properties);
-    assertTrue(properties.isEmpty());
-  }
-
-  @Test
-  public void testLoadGemFirePropertiesWithNonExistingURL() throws MalformedURLException {
-    final Properties properties = AbstractLauncher.loadGemFireProperties(new URL("file:///path/to/non_existing/gemfire.properties"));
-    assertNotNull(properties);
-    assertTrue(properties.isEmpty());
-  }
-
-  @Test
-  public void testGetDistributedSystemProperties() {
-    AbstractLauncher<?> launcher = createAbstractLauncher("memberOne", "1");
-
-    assertNotNull(launcher);
-    assertEquals("1", launcher.getMemberId());
-    assertEquals("memberOne", launcher.getMemberName());
-
-    Properties distributedSystemProperties = launcher.getDistributedSystemProperties();
-
-    assertNotNull(distributedSystemProperties);
-    assertTrue(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME));
-    assertEquals("memberOne", distributedSystemProperties.getProperty(DistributionConfig.NAME_NAME));
-
-    launcher = createAbstractLauncher(null, "22");
-
-    assertNotNull(launcher);
-    assertEquals("22", launcher.getMemberId());
-    assertNull(launcher.getMemberName());
-
-    distributedSystemProperties = launcher.getDistributedSystemProperties();
-
-    assertNotNull(distributedSystemProperties);
-    assertFalse(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME));
-
-    launcher = createAbstractLauncher(StringUtils.EMPTY_STRING, "333");
-
-    assertNotNull(launcher);
-    assertEquals("333", launcher.getMemberId());
-    assertEquals(StringUtils.EMPTY_STRING, launcher.getMemberName());
-
-    distributedSystemProperties = launcher.getDistributedSystemProperties();
-
-    assertNotNull(distributedSystemProperties);
-    assertFalse(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME));
-
-    launcher = createAbstractLauncher("  ", "4444");
-
-    assertNotNull(launcher);
-    assertEquals("4444", launcher.getMemberId());
-    assertEquals("  ", launcher.getMemberName());
-
-    distributedSystemProperties = launcher.getDistributedSystemProperties();
-
-    assertNotNull(distributedSystemProperties);
-    assertFalse(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME));
-  }
-
-  @Test
-  public void testGetDistributedSystemPropertiesWithDefaults() {
-    AbstractLauncher<?> launcher = createAbstractLauncher("TestMember", "123");
-
-    assertNotNull(launcher);
-    assertEquals("123", launcher.getMemberId());
-    assertEquals("TestMember", launcher.getMemberName());
-
-    Properties defaults = new Properties();
-
-    defaults.setProperty("testKey", "testValue");
-
-    Properties distributedSystemProperties = launcher.getDistributedSystemProperties(defaults);
-
-    assertNotNull(distributedSystemProperties);
-    assertEquals(launcher.getMemberName(), distributedSystemProperties.getProperty(DistributionConfig.NAME_NAME));
-    assertEquals("testValue", distributedSystemProperties.getProperty("testKey"));
-  }
-
-  @Test
-  public void testGetMember() {
-    AbstractLauncher<?> launcher = createAbstractLauncher("memberOne", "123");
-
-    assertNotNull(launcher);
-    assertEquals("123", launcher.getMemberId());
-    assertEquals("memberOne", launcher.getMemberName());
-    assertEquals("memberOne", launcher.getMember());
-
-    launcher = createAbstractLauncher(null, "123");
-
-    assertNotNull(launcher);
-    assertEquals("123", launcher.getMemberId());
-    assertNull(launcher.getMemberName());
-    assertEquals("123", launcher.getMember());
-
-    launcher = createAbstractLauncher(StringUtils.EMPTY_STRING, "123");
-
-    assertNotNull(launcher);
-    assertEquals("123", launcher.getMemberId());
-    assertEquals(StringUtils.EMPTY_STRING, launcher.getMemberName());
-    assertEquals("123", launcher.getMember());
-
-    launcher = createAbstractLauncher(" ", "123");
-
-    assertNotNull(launcher);
-    assertEquals("123", launcher.getMemberId());
-    assertEquals(" ", launcher.getMemberName());
-    assertEquals("123", launcher.getMember());
-
-    launcher = createAbstractLauncher(null, StringUtils.EMPTY_STRING);
-
-    assertNotNull(launcher);
-    assertEquals(StringUtils.EMPTY_STRING, launcher.getMemberId());
-    assertNull(launcher.getMemberName());
-    assertNull(launcher.getMember());
-
-    launcher = createAbstractLauncher(null, " ");
-
-    assertNotNull(launcher);
-    assertEquals(" ", launcher.getMemberId());
-    assertNull(launcher.getMemberName());
-    assertNull(launcher.getMember());
-  }
-
-  @Test
-  public void testAbstractLauncherServiceStateToDaysHoursMinutesSeconds() {
-    assertEquals("", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(null));
-    assertEquals("0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(0l));
-    assertEquals("1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(1000l));
-    assertEquals("1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(1999l));
-    assertEquals("2 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(2001l));
-    assertEquals("45 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(45000l));
-    assertEquals("1 minute 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 1000l));
-    assertEquals("1 minute 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(61 * 1000l));
-    assertEquals("1 minute 30 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(90 * 1000l));
-    assertEquals("2 minutes 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(120 * 1000l));
-    assertEquals("2 minutes 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(121 * 1000l));
-    assertEquals("2 minutes 15 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(135 * 1000l));
-    assertEquals("1 hour 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 60 * 1000l));
-    assertEquals("1 hour 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 60 * 1000l + 1000l));
-    assertEquals("1 hour 15 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 60 * 1000l + 15000l));
-    assertEquals("1 hour 1 minute 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 61 * 1000l));
-    assertEquals("1 hour 1 minute 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 61 * 1000l + 1000l));
-    assertEquals("1 hour 1 minute 45 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 61 * 1000l + 45000l));
-    assertEquals("1 hour 2 minutes 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 62 * 1000l));
-    assertEquals("1 hour 5 minutes 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 65 * 1000l + 1000l));
-    assertEquals("1 hour 5 minutes 10 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 65 * 1000l + 10000l));
-    assertEquals("1 hour 59 minutes 11 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 119 * 1000l + 11000l));
-    assertEquals("1 day 1 hour 1 minute 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(
-      TimeUnit.DAYS.toMillis(1) + TimeUnit.HOURS.toMillis(1) + TimeUnit.MINUTES.toMillis(1) + TimeUnit.SECONDS.toMillis(1)));
-    assertEquals("1 day 5 hours 15 minutes 45 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(
-      TimeUnit.DAYS.toMillis(1) + TimeUnit.HOURS.toMillis(5) + TimeUnit.MINUTES.toMillis(15) + TimeUnit.SECONDS.toMillis(45)));
-    assertEquals("2 days 1 hour 30 minutes 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(
-      TimeUnit.DAYS.toMillis(2) + TimeUnit.HOURS.toMillis(1) + TimeUnit.MINUTES.toMillis(30) + TimeUnit.SECONDS.toMillis(1)));
-  }
-
-  protected static final class FakeServiceLauncher extends AbstractLauncher<String> {
-
-    private final String memberId;
-    private final String memberName;
-
-    public FakeServiceLauncher(final String memberName, final String memberId) {
-      this.memberId = memberId;
-      this.memberName = memberName;
-    }
-
-    @Override
-    boolean isAttachAPIOnClasspath() {
-      return false;
-    }
-
-    @Override
-    public String getLogFileName() {
-      throw new UnsupportedOperationException("Not Implemented!");
-    }
-
-    @Override
-    public String getMemberId() {
-      return memberId;
-    }
-
-    @Override
-    public String getMemberName() {
-      return memberName;
-    }
-
-    @Override
-    public Integer getPid() {
-      throw new UnsupportedOperationException("Not Implemented!");
-    }
-
-    @Override
-    public String getServiceName() {
-      return "TestService";
-    }
-
-    @Override
-    public void run() {
-      throw new UnsupportedOperationException("Not Implemented!");
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherJUnitTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherJUnitTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherJUnitTestCase.java
deleted file mode 100755
index 77961e0..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherJUnitTestCase.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.util.List;
-import java.util.Properties;
-import java.util.concurrent.Callable;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.logging.log4j.Logger;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.contrib.java.lang.system.RestoreSystemProperties;
-import org.junit.rules.TestName;
-
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.internal.FileUtil;
-import com.gemstone.gemfire.internal.lang.StringUtils;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.internal.process.PidUnavailableException;
-import com.gemstone.gemfire.internal.process.ProcessUtils;
-import com.gemstone.gemfire.internal.process.ProcessStreamReader.InputListener;
-import com.gemstone.gemfire.internal.util.IOUtils;
-import com.gemstone.gemfire.internal.util.StopWatch;
-
-/**
- * @since 8.0
- */
-public abstract class AbstractLauncherJUnitTestCase {
-  protected static final Logger logger = LogService.getLogger();
-  
-  protected static final int WAIT_FOR_PROCESS_TO_DIE_TIMEOUT = 5 * 60 * 1000; // 5 minutes
-  protected static final int TIMEOUT_MILLISECONDS = WAIT_FOR_PROCESS_TO_DIE_TIMEOUT;
-  protected static final int WAIT_FOR_FILE_CREATION_TIMEOUT = 10*1000;
-  protected static final int WAIT_FOR_FILE_DELETION_TIMEOUT = 10*1000;
-  protected static final int WAIT_FOR_MBEAN_TIMEOUT = 10*1000;
-  protected static final int INTERVAL = 100;
-  protected static final int INTERVAL_MILLISECONDS = INTERVAL;
-  
-  private static final String EXPECTED_EXCEPTION_ADD = "<ExpectedException action=add>{}</ExpectedException>";
-  private static final String EXPECTED_EXCEPTION_REMOVE = "<ExpectedException action=remove>{}</ExpectedException>";
-  private static final String EXPECTED_EXCEPTION_MBEAN_NOT_REGISTERED = "MBean Not Registered In GemFire Domain";
-  
-  protected volatile ServerSocket socket;
-  
-  protected volatile File pidFile;
-  protected volatile File stopRequestFile;
-  protected volatile File statusRequestFile;
-  protected volatile File statusFile;
-  
-  @Rule
-  public TestName testName= new TestName();
-
-  @Rule
-  public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
-  
-  @Before
-  public final void setUpLauncherTest() throws Exception {
-    System.setProperty("gemfire." + DistributionConfig.MCAST_PORT_NAME, Integer.toString(0));
-    logger.info(EXPECTED_EXCEPTION_ADD, EXPECTED_EXCEPTION_MBEAN_NOT_REGISTERED);
-  }
-
-  @After
-  public final void tearDownLauncherTest() throws Exception {    
-    logger.info(EXPECTED_EXCEPTION_REMOVE, EXPECTED_EXCEPTION_MBEAN_NOT_REGISTERED);
-    if (this.socket != null) {
-      this.socket.close();
-      this.socket = null;
-    }
-    delete(this.pidFile); this.pidFile = null;
-    delete(this.stopRequestFile); this.stopRequestFile = null;
-    delete(this.statusRequestFile); this.statusRequestFile = null;
-    delete(this.statusFile); this.statusFile = null;
-  }
-  
-  protected void delete(final File file) throws Exception {
-    assertEventuallyTrue("deleting " + file, new Callable<Boolean>() {
-      @Override
-      public Boolean call() throws Exception {
-        if (file == null) {
-          return true;
-        }
-        try {
-          FileUtil.delete(file);
-        } catch (IOException e) {
-        }
-        return !file.exists();
-      }
-    }, WAIT_FOR_FILE_DELETION_TIMEOUT, INTERVAL);
-  }
-  
-  protected void waitForPidToStop(final int pid, boolean throwOnTimeout) throws Exception {
-    assertEventuallyFalse("Process never died", new Callable<Boolean>() {
-      @Override
-      public Boolean call() throws Exception {
-        return ProcessUtils.isProcessAlive(pid);
-      }
-    }, WAIT_FOR_PROCESS_TO_DIE_TIMEOUT, INTERVAL);
-  }
-  
-  protected void waitForPidToStop(final int pid) throws Exception {
-    waitForPidToStop(pid, true);
-  }
-  
-  protected void waitForFileToDelete(final File file, boolean throwOnTimeout) throws Exception {
-    if (file == null) {
-      return;
-    }
-    assertEventuallyTrue("waiting for file " + file + " to delete", new Callable<Boolean>() {
-      @Override
-      public Boolean call() throws Exception {
-        return !file.exists();
-      }
-    }, WAIT_FOR_FILE_DELETION_TIMEOUT, INTERVAL);
-  }
-  
-  protected void waitForFileToDelete(final File file) throws Exception {
-    waitForFileToDelete(file, true);
-  }
-  
-  protected static int getPid() throws PidUnavailableException {
-    return ProcessUtils.identifyPid();
-  }
-
-  protected InputListener createLoggingListener(final String name, final String header) {
-    return new InputListener() {
-      @Override
-      public void notifyInputLine(String line) {
-        logger.info(new StringBuilder("[").append(header).append("]").append(line).toString());
-      }
-      @Override
-      public String toString() {
-        return name;
-      }
-    };
-  }
-
-  protected InputListener createCollectionListener(final String name, final String header, final List<String> lines) {
-    return new InputListener() {
-      @Override
-      public void notifyInputLine(String line) {
-        lines.add(line);
-      }
-      @Override
-      public String toString() {
-        return name;
-      }
-    };
-  }
-
-  protected InputListener createExpectedListener(final String name, final String header, final String expected, final AtomicBoolean atomic) {
-    return new InputListener() {
-      @Override
-      public void notifyInputLine(String line) {
-        if (line.contains(expected)) {
-          atomic.set(true);
-        }
-      }
-      @Override
-      public String toString() {
-        return name;
-      }
-    };
-  }
-
-  protected void writeGemfireProperties(final Properties gemfireProperties, final File gemfirePropertiesFile) throws IOException {
-    if (!gemfirePropertiesFile.exists()) {
-      gemfireProperties.store(new FileWriter(gemfirePropertiesFile), "Configuration settings for the GemFire Server");
-    }
-  }
-
-  protected int readPid(final File pidFile) throws IOException {
-    BufferedReader reader = null;
-    try {
-      reader = new BufferedReader(new FileReader(pidFile));
-      return Integer.parseInt(StringUtils.trim(reader.readLine()));
-    }
-    finally {
-      IOUtils.close(reader);
-    }
-  }
-
-  protected void writePid(final File pidFile, final int pid) throws IOException {
-    FileWriter writer = new FileWriter(pidFile);
-    writer.write(String.valueOf(pid));
-    writer.write("\n");
-    writer.flush();
-    writer.close();
-  }
-
-  protected void waitForFileToExist(final File file, boolean throwOnTimeout) throws Exception {
-    assertEventuallyTrue("waiting for file " + file + " to exist", new Callable<Boolean>() {
-      @Override
-      public Boolean call() throws Exception {
-        return file.exists();
-      }
-    }, WAIT_FOR_FILE_CREATION_TIMEOUT, INTERVAL);
-  }
-  
-  protected void waitForFileToExist(final File file) throws Exception {
-    waitForFileToExist(file, true);
-  }
-  
-  protected String getUniqueName() {
-    return getClass().getSimpleName() + "_" + testName.getMethodName();
-  }
-  
-  protected static void assertEventuallyTrue(final String message, final Callable<Boolean> callable, final int timeout, final int interval) throws Exception {
-    boolean done = false;
-    for (StopWatch time = new StopWatch(true); !done && time.elapsedTimeMillis() < timeout; done = (callable.call())) {
-      Thread.sleep(interval);
-    }
-    assertTrue(message, done);
-  }
-  
-  protected static void assertEventuallyFalse(final String message, final Callable<Boolean> callable, final int timeout, final int interval) throws Exception {
-    boolean done = false;
-    for (StopWatch time = new StopWatch(true); !done && time.elapsedTimeMillis() < timeout; done = (!callable.call())) {
-      Thread.sleep(interval);
-    }
-    assertTrue(message, done);
-  }
-  
-  protected static void disconnectFromDS() {
-    InternalDistributedSystem ids = InternalDistributedSystem.getConnectedInstance();
-    if (ids != null) {
-      ids.disconnect();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherServiceStatusJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherServiceStatusJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherServiceStatusJUnitTest.java
deleted file mode 100755
index ca24a4e..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherServiceStatusJUnitTest.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static org.junit.Assert.*;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Arrays;
-import java.util.List;
-
-import com.gemstone.gemfire.distributed.AbstractLauncherServiceStatusJUnitTest.TestLauncher.TestState;
-import com.gemstone.gemfire.internal.GemFireVersion;
-import com.gemstone.gemfire.internal.process.PidUnavailableException;
-import com.gemstone.gemfire.internal.process.ProcessUtils;
-import com.gemstone.gemfire.management.internal.cli.json.GfJsonArray;
-import com.gemstone.gemfire.management.internal.cli.json.GfJsonException;
-import com.gemstone.gemfire.management.internal.cli.json.GfJsonObject;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-/**
- * Tests marshaling of ServiceStatus to and from JSON.
- * 
- * @since 7.0
- */
-@Category(UnitTest.class)
-public class AbstractLauncherServiceStatusJUnitTest {
-
-  private static final String SERVICE_NAME = "Test";
-  private static final InetAddress HOST = getLocalHost();
-  private static final int PORT = 12345;
-  private static final String NAME = AbstractLauncherServiceStatusJUnitTest.class.getSimpleName();
-  private static final int PID = identifyPid();
-  private static final long UPTIME = 123456789;
-  private static final String WORKING_DIRECTORY = identifyWorkingDirectory();
-  private static final List<String> JVM_ARGUMENTS = ManagementFactory.getRuntimeMXBean().getInputArguments();
-  private static final String CLASSPATH = ManagementFactory.getRuntimeMXBean().getClassPath();
-  private static final String GEMFIRE_VERSION = GemFireVersion.getGemFireVersion();
-  private static final String JAVA_VERSION = System.getProperty("java.version");
-
-  private TestLauncher launcher;
-
-  @Before
-  public void setUp() {
-    this.launcher = new TestLauncher(HOST, PORT, NAME);
-  }
-
-  @Test
-  public void testMarshallingTestStatusToAndFromJson() {
-    final TestState status = this.launcher.status();
-    final String json = status.toJson();
-    validateJson(status, json);
-    validateStatus(status, TestState.fromJson(json));
-  }
-
-  private void validateStatus(final TestState expected, final TestState actual) {
-    assertEquals(expected.getClasspath(), actual.getClasspath());
-    assertEquals(expected.getGemFireVersion(), actual.getGemFireVersion());
-    assertEquals(expected.getJavaVersion(), actual.getJavaVersion());
-    assertEquals(expected.getJvmArguments(), actual.getJvmArguments());
-    assertEquals(expected.getPid(), actual.getPid());
-    assertEquals(expected.getStatus(), actual.getStatus());
-    assertEquals(expected.getTimestamp(), actual.getTimestamp());
-    assertEquals(expected.getUptime(), actual.getUptime());
-    assertEquals(expected.getWorkingDirectory(), actual.getWorkingDirectory());
-    assertEquals(expected.getHost(), actual.getHost());
-    assertEquals(expected.getPort(), actual.getPort());
-    assertEquals(expected.getMemberName(), actual.getMemberName());
-  }
-
-  private void validateJson(final TestState expected, final String json) {
-    final TestState actual = TestState.fromJson(json);
-    validateStatus(expected, actual);
-  }
-
-  private static int identifyPid() {
-    try {
-      return ProcessUtils.identifyPid();
-    }
-    catch (PidUnavailableException e) {
-      return 0;
-    }
-  }
-
-  private static String identifyWorkingDirectory() {
-    try {
-      return new File(System.getProperty("user.dir")).getCanonicalPath();
-    }
-    catch (IOException e) {
-      return new File(System.getProperty("user.dir")).getAbsolutePath();
-    }
-  }
-
-  private static InetAddress getLocalHost() {
-    try {
-      return InetAddress.getLocalHost();
-    }
-    catch (UnknownHostException e) {
-      return null;
-    }
-  }
-  
-  static class TestLauncher extends AbstractLauncher<String> {
-
-    private final InetAddress bindAddress;
-    private final int port;
-    private final String memberName;
-    private final File logFile;
-
-    TestLauncher(InetAddress bindAddress,
-                 int port,
-                 String memberName) {
-      this.bindAddress = bindAddress;
-      this.port = port;
-      this.memberName = memberName;
-      this.logFile = new File(memberName + ".log");
-    }
-
-    public TestState status() {
-      return new TestState(Status.ONLINE,
-        null,
-        System.currentTimeMillis(),
-        getId(),
-        PID,
-        UPTIME,
-        WORKING_DIRECTORY,
-        JVM_ARGUMENTS,
-        CLASSPATH,
-        GEMFIRE_VERSION,
-        JAVA_VERSION,
-        getLogFileName(),
-        getBindAddressAsString(),
-        getPortAsString(),
-        NAME);
-    }
-
-    @Override
-    public void run() {
-    }
-
-    public String getId() {
-      return getServiceName() + "@" + getBindAddress() + "[" + getPort() + "]";
-    }
-
-    @Override
-    public String getLogFileName() {
-      try {
-        return this.logFile.getCanonicalPath();
-      }
-      catch (IOException e) {
-        return this.logFile.getAbsolutePath();
-      }
-    }
-
-    @Override
-    public String getMemberName() {
-      return this.memberName;
-    }
-
-    @Override
-    public Integer getPid() {
-      return null;
-    }
-
-    @Override
-    public String getServiceName() {
-      return SERVICE_NAME;
-    }
-
-    InetAddress getBindAddress() {
-      return this.bindAddress;
-    }
-
-    String getBindAddressAsString() {
-      return this.bindAddress.getCanonicalHostName();
-    }
-
-    int getPort() {
-      return this.port;
-    }
-
-    String getPortAsString() {
-      return String.valueOf(getPort());
-    }
-
-    public static class TestState extends ServiceState<String> {
-
-      protected static TestState fromJson(final String json) {
-        try {
-          final GfJsonObject gfJsonObject = new GfJsonObject(json);
-
-          final Status status = Status.valueOfDescription(gfJsonObject.getString(JSON_STATUS));
-          final List<String> jvmArguments =
-            Arrays.asList(GfJsonArray.toStringArray(gfJsonObject.getJSONArray(JSON_JVMARGUMENTS)));
-
-          return new TestState(status,
-            gfJsonObject.getString(JSON_STATUSMESSAGE),
-            gfJsonObject.getLong(JSON_TIMESTAMP),
-            gfJsonObject.getString(JSON_LOCATION),
-            gfJsonObject.getInt(JSON_PID),
-            gfJsonObject.getLong(JSON_UPTIME),
-            gfJsonObject.getString(JSON_WORKINGDIRECTORY),
-            jvmArguments,
-            gfJsonObject.getString(JSON_CLASSPATH),
-            gfJsonObject.getString(JSON_GEMFIREVERSION),
-            gfJsonObject.getString(JSON_JAVAVERSION),
-            gfJsonObject.getString(JSON_LOGFILE),
-            gfJsonObject.getString(JSON_HOST),
-            gfJsonObject.getString(JSON_PORT),
-            gfJsonObject.getString(JSON_MEMBERNAME));
-        }
-        catch (GfJsonException e) {
-          throw new IllegalArgumentException("Unable to create TestState from JSON: " + json);
-        }
-      }
-
-      protected TestState(final Status status,
-                          final String statusMessage,
-                          final long timestamp,
-                          final String location,
-                          final Integer pid,
-                          final Long uptime,
-                          final String workingDirectory,
-                          final List<String> jvmArguments,
-                          final String classpath,
-                          final String gemfireVersion,
-                          final String javaVersion,
-                          final String logFile,
-                          final String host,
-                          final String port,
-                          final String name) {
-        super(status, statusMessage, timestamp, location, pid, uptime, workingDirectory, jvmArguments, classpath,
-          gemfireVersion, javaVersion, logFile, host, port, name);
-      }
-
-      @Override
-      protected String getServiceName() {
-        return SERVICE_NAME;
-      }
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherServiceStatusTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherServiceStatusTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherServiceStatusTest.java
new file mode 100755
index 0000000..c741def
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherServiceStatusTest.java
@@ -0,0 +1,264 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.distributed.AbstractLauncherServiceStatusTest.TestLauncher.TestState;
+import com.gemstone.gemfire.internal.GemFireVersion;
+import com.gemstone.gemfire.internal.process.PidUnavailableException;
+import com.gemstone.gemfire.internal.process.ProcessUtils;
+import com.gemstone.gemfire.management.internal.cli.json.GfJsonArray;
+import com.gemstone.gemfire.management.internal.cli.json.GfJsonException;
+import com.gemstone.gemfire.management.internal.cli.json.GfJsonObject;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * Tests marshaling of ServiceStatus to and from JSON.
+ * 
+ * @since 7.0
+ */
+@Category(UnitTest.class)
+public class AbstractLauncherServiceStatusTest {
+
+  private static final String SERVICE_NAME = "Test";
+  private static final InetAddress HOST = getLocalHost();
+  private static final int PORT = 12345;
+  private static final String NAME = AbstractLauncherServiceStatusTest.class.getSimpleName();
+  private static final int PID = identifyPid();
+  private static final long UPTIME = 123456789;
+  private static final String WORKING_DIRECTORY = identifyWorkingDirectory();
+  private static final List<String> JVM_ARGUMENTS = ManagementFactory.getRuntimeMXBean().getInputArguments();
+  private static final String CLASSPATH = ManagementFactory.getRuntimeMXBean().getClassPath();
+  private static final String GEMFIRE_VERSION = GemFireVersion.getGemFireVersion();
+  private static final String JAVA_VERSION = System.getProperty("java.version");
+
+  private TestLauncher launcher;
+
+  @Before
+  public void setUp() {
+    this.launcher = new TestLauncher(HOST, PORT, NAME);
+  }
+
+  @Test
+  public void testMarshallingTestStatusToAndFromJson() {
+    final TestState status = this.launcher.status();
+    final String json = status.toJson();
+    validateJson(status, json);
+    validateStatus(status, TestState.fromJson(json));
+  }
+
+  private void validateStatus(final TestState expected, final TestState actual) {
+    assertEquals(expected.getClasspath(), actual.getClasspath());
+    assertEquals(expected.getGemFireVersion(), actual.getGemFireVersion());
+    assertEquals(expected.getJavaVersion(), actual.getJavaVersion());
+    assertEquals(expected.getJvmArguments(), actual.getJvmArguments());
+    assertEquals(expected.getPid(), actual.getPid());
+    assertEquals(expected.getStatus(), actual.getStatus());
+    assertEquals(expected.getTimestamp(), actual.getTimestamp());
+    assertEquals(expected.getUptime(), actual.getUptime());
+    assertEquals(expected.getWorkingDirectory(), actual.getWorkingDirectory());
+    assertEquals(expected.getHost(), actual.getHost());
+    assertEquals(expected.getPort(), actual.getPort());
+    assertEquals(expected.getMemberName(), actual.getMemberName());
+  }
+
+  private void validateJson(final TestState expected, final String json) {
+    final TestState actual = TestState.fromJson(json);
+    validateStatus(expected, actual);
+  }
+
+  private static int identifyPid() {
+    try {
+      return ProcessUtils.identifyPid();
+    }
+    catch (PidUnavailableException e) {
+      return 0;
+    }
+  }
+
+  private static String identifyWorkingDirectory() {
+    try {
+      return new File(System.getProperty("user.dir")).getCanonicalPath();
+    }
+    catch (IOException e) {
+      return new File(System.getProperty("user.dir")).getAbsolutePath();
+    }
+  }
+
+  private static InetAddress getLocalHost() {
+    try {
+      return InetAddress.getLocalHost();
+    }
+    catch (UnknownHostException e) {
+      return null;
+    }
+  }
+  
+  static class TestLauncher extends AbstractLauncher<String> {
+
+    private final InetAddress bindAddress;
+    private final int port;
+    private final String memberName;
+    private final File logFile;
+
+    TestLauncher(InetAddress bindAddress,
+                 int port,
+                 String memberName) {
+      this.bindAddress = bindAddress;
+      this.port = port;
+      this.memberName = memberName;
+      this.logFile = new File(memberName + ".log");
+    }
+
+    public TestState status() {
+      return new TestState(Status.ONLINE,
+        null,
+        System.currentTimeMillis(),
+        getId(),
+        PID,
+        UPTIME,
+        WORKING_DIRECTORY,
+        JVM_ARGUMENTS,
+        CLASSPATH,
+        GEMFIRE_VERSION,
+        JAVA_VERSION,
+        getLogFileName(),
+        getBindAddressAsString(),
+        getPortAsString(),
+        NAME);
+    }
+
+    @Override
+    public void run() {
+    }
+
+    public String getId() {
+      return getServiceName() + "@" + getBindAddress() + "[" + getPort() + "]";
+    }
+
+    @Override
+    public String getLogFileName() {
+      try {
+        return this.logFile.getCanonicalPath();
+      }
+      catch (IOException e) {
+        return this.logFile.getAbsolutePath();
+      }
+    }
+
+    @Override
+    public String getMemberName() {
+      return this.memberName;
+    }
+
+    @Override
+    public Integer getPid() {
+      return null;
+    }
+
+    @Override
+    public String getServiceName() {
+      return SERVICE_NAME;
+    }
+
+    InetAddress getBindAddress() {
+      return this.bindAddress;
+    }
+
+    String getBindAddressAsString() {
+      return this.bindAddress.getCanonicalHostName();
+    }
+
+    int getPort() {
+      return this.port;
+    }
+
+    String getPortAsString() {
+      return String.valueOf(getPort());
+    }
+
+    public static class TestState extends ServiceState<String> {
+
+      protected static TestState fromJson(final String json) {
+        try {
+          final GfJsonObject gfJsonObject = new GfJsonObject(json);
+
+          final Status status = Status.valueOfDescription(gfJsonObject.getString(JSON_STATUS));
+          final List<String> jvmArguments =
+            Arrays.asList(GfJsonArray.toStringArray(gfJsonObject.getJSONArray(JSON_JVMARGUMENTS)));
+
+          return new TestState(status,
+            gfJsonObject.getString(JSON_STATUSMESSAGE),
+            gfJsonObject.getLong(JSON_TIMESTAMP),
+            gfJsonObject.getString(JSON_LOCATION),
+            gfJsonObject.getInt(JSON_PID),
+            gfJsonObject.getLong(JSON_UPTIME),
+            gfJsonObject.getString(JSON_WORKINGDIRECTORY),
+            jvmArguments,
+            gfJsonObject.getString(JSON_CLASSPATH),
+            gfJsonObject.getString(JSON_GEMFIREVERSION),
+            gfJsonObject.getString(JSON_JAVAVERSION),
+            gfJsonObject.getString(JSON_LOGFILE),
+            gfJsonObject.getString(JSON_HOST),
+            gfJsonObject.getString(JSON_PORT),
+            gfJsonObject.getString(JSON_MEMBERNAME));
+        }
+        catch (GfJsonException e) {
+          throw new IllegalArgumentException("Unable to create TestState from JSON: " + json);
+        }
+      }
+
+      protected TestState(final Status status,
+                          final String statusMessage,
+                          final long timestamp,
+                          final String location,
+                          final Integer pid,
+                          final Long uptime,
+                          final String workingDirectory,
+                          final List<String> jvmArguments,
+                          final String classpath,
+                          final String gemfireVersion,
+                          final String javaVersion,
+                          final String logFile,
+                          final String host,
+                          final String port,
+                          final String name) {
+        super(status, statusMessage, timestamp, location, pid, uptime, workingDirectory, jvmArguments, classpath,
+          gemfireVersion, javaVersion, logFile, host, port, name);
+      }
+
+      @Override
+      protected String getServiceName() {
+        return SERVICE_NAME;
+      }
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherTest.java
new file mode 100644
index 0000000..cabb5ff
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLauncherTest.java
@@ -0,0 +1,298 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.junit.Assert.*;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.lang.StringUtils;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * The AbstractLauncherTest class is a test suite of unit tests testing the contract and functionality
+ * of the AbstractLauncher class.
+ * <p/>
+ * @see com.gemstone.gemfire.distributed.AbstractLauncher
+ * @see org.junit.Assert
+ * @see org.junit.Test
+ * @since 7.0
+ */
+@Category(UnitTest.class)
+public class AbstractLauncherTest {
+
+  protected AbstractLauncher<?> createAbstractLauncher(final String memberName, final String memberId) {
+    return new FakeServiceLauncher(memberName, memberId);
+  }
+
+  @Test
+  public void testIsAttachAPINotFound() {
+    final AbstractLauncher<?> launcher = createAbstractLauncher("012", "TestMember");
+
+    assertTrue(launcher.isAttachAPINotFound(new NoClassDefFoundError(
+      "Exception in thread \"main\" java.lang.NoClassDefFoundError: com/sun/tools/attach/AttachNotSupportedException")));
+    assertTrue(launcher.isAttachAPINotFound(new ClassNotFoundException(
+      "Caused by: java.lang.ClassNotFoundException: com.sun.tools.attach.AttachNotSupportedException")));
+    assertTrue(launcher.isAttachAPINotFound(new NoClassDefFoundError(
+      "Exception in thread \"main\" java.lang.NoClassDefFoundError: com/ibm/tools/attach/AgentNotSupportedException")));
+    assertTrue(launcher.isAttachAPINotFound(new ClassNotFoundException(
+      "Caused by: java.lang.ClassNotFoundException: com.ibm.tools.attach.AgentNotSupportedException")));
+    assertFalse(launcher.isAttachAPINotFound(new IllegalArgumentException(
+      "Caused by: java.lang.ClassNotFoundException: com.sun.tools.attach.AttachNotSupportedException")));
+    assertFalse(launcher.isAttachAPINotFound(new IllegalStateException(
+      "Caused by: java.lang.ClassNotFoundException: com.ibm.tools.attach.AgentNotSupportedException")));
+    assertFalse(launcher.isAttachAPINotFound(new NoClassDefFoundError(
+      "Exception in thread \"main\" java.lang.NoClassDefFoundError: com/companyx/app/service/MyServiceClass")));
+    assertFalse(launcher.isAttachAPINotFound(new ClassNotFoundException(
+      "Caused by: java.lang.ClassNotFoundException: com.companyx.app.attach.NutsNotAttachedException")));
+  }
+
+  @Test
+  public void testIsSet() {
+    final Properties properties = new Properties();
+
+    assertFalse(properties.containsKey(DistributionConfig.NAME_NAME));
+    assertFalse(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME));
+
+    properties.setProperty(DistributionConfig.NAME_NAME, "");
+
+    assertTrue(properties.containsKey(DistributionConfig.NAME_NAME));
+    assertFalse(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME));
+
+    properties.setProperty(DistributionConfig.NAME_NAME, "  ");
+
+    assertTrue(properties.containsKey(DistributionConfig.NAME_NAME));
+    assertFalse(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME));
+
+    properties.setProperty(DistributionConfig.NAME_NAME, "memberOne");
+
+    assertTrue(AbstractLauncher.isSet(properties, DistributionConfig.NAME_NAME));
+    assertFalse(AbstractLauncher.isSet(properties, "NaMe"));
+  }
+
+  @Test
+  public void testLoadGemFirePropertiesWithNullURL() {
+    final Properties properties = AbstractLauncher.loadGemFireProperties(null);
+    assertNotNull(properties);
+    assertTrue(properties.isEmpty());
+  }
+
+  @Test
+  public void testLoadGemFirePropertiesWithNonExistingURL() throws MalformedURLException {
+    final Properties properties = AbstractLauncher.loadGemFireProperties(new URL("file:///path/to/non_existing/gemfire.properties"));
+    assertNotNull(properties);
+    assertTrue(properties.isEmpty());
+  }
+
+  @Test
+  public void testGetDistributedSystemProperties() {
+    AbstractLauncher<?> launcher = createAbstractLauncher("memberOne", "1");
+
+    assertNotNull(launcher);
+    assertEquals("1", launcher.getMemberId());
+    assertEquals("memberOne", launcher.getMemberName());
+
+    Properties distributedSystemProperties = launcher.getDistributedSystemProperties();
+
+    assertNotNull(distributedSystemProperties);
+    assertTrue(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME));
+    assertEquals("memberOne", distributedSystemProperties.getProperty(DistributionConfig.NAME_NAME));
+
+    launcher = createAbstractLauncher(null, "22");
+
+    assertNotNull(launcher);
+    assertEquals("22", launcher.getMemberId());
+    assertNull(launcher.getMemberName());
+
+    distributedSystemProperties = launcher.getDistributedSystemProperties();
+
+    assertNotNull(distributedSystemProperties);
+    assertFalse(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME));
+
+    launcher = createAbstractLauncher(StringUtils.EMPTY_STRING, "333");
+
+    assertNotNull(launcher);
+    assertEquals("333", launcher.getMemberId());
+    assertEquals(StringUtils.EMPTY_STRING, launcher.getMemberName());
+
+    distributedSystemProperties = launcher.getDistributedSystemProperties();
+
+    assertNotNull(distributedSystemProperties);
+    assertFalse(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME));
+
+    launcher = createAbstractLauncher("  ", "4444");
+
+    assertNotNull(launcher);
+    assertEquals("4444", launcher.getMemberId());
+    assertEquals("  ", launcher.getMemberName());
+
+    distributedSystemProperties = launcher.getDistributedSystemProperties();
+
+    assertNotNull(distributedSystemProperties);
+    assertFalse(distributedSystemProperties.containsKey(DistributionConfig.NAME_NAME));
+  }
+
+  @Test
+  public void testGetDistributedSystemPropertiesWithDefaults() {
+    AbstractLauncher<?> launcher = createAbstractLauncher("TestMember", "123");
+
+    assertNotNull(launcher);
+    assertEquals("123", launcher.getMemberId());
+    assertEquals("TestMember", launcher.getMemberName());
+
+    Properties defaults = new Properties();
+
+    defaults.setProperty("testKey", "testValue");
+
+    Properties distributedSystemProperties = launcher.getDistributedSystemProperties(defaults);
+
+    assertNotNull(distributedSystemProperties);
+    assertEquals(launcher.getMemberName(), distributedSystemProperties.getProperty(DistributionConfig.NAME_NAME));
+    assertEquals("testValue", distributedSystemProperties.getProperty("testKey"));
+  }
+
+  @Test
+  public void testGetMember() {
+    AbstractLauncher<?> launcher = createAbstractLauncher("memberOne", "123");
+
+    assertNotNull(launcher);
+    assertEquals("123", launcher.getMemberId());
+    assertEquals("memberOne", launcher.getMemberName());
+    assertEquals("memberOne", launcher.getMember());
+
+    launcher = createAbstractLauncher(null, "123");
+
+    assertNotNull(launcher);
+    assertEquals("123", launcher.getMemberId());
+    assertNull(launcher.getMemberName());
+    assertEquals("123", launcher.getMember());
+
+    launcher = createAbstractLauncher(StringUtils.EMPTY_STRING, "123");
+
+    assertNotNull(launcher);
+    assertEquals("123", launcher.getMemberId());
+    assertEquals(StringUtils.EMPTY_STRING, launcher.getMemberName());
+    assertEquals("123", launcher.getMember());
+
+    launcher = createAbstractLauncher(" ", "123");
+
+    assertNotNull(launcher);
+    assertEquals("123", launcher.getMemberId());
+    assertEquals(" ", launcher.getMemberName());
+    assertEquals("123", launcher.getMember());
+
+    launcher = createAbstractLauncher(null, StringUtils.EMPTY_STRING);
+
+    assertNotNull(launcher);
+    assertEquals(StringUtils.EMPTY_STRING, launcher.getMemberId());
+    assertNull(launcher.getMemberName());
+    assertNull(launcher.getMember());
+
+    launcher = createAbstractLauncher(null, " ");
+
+    assertNotNull(launcher);
+    assertEquals(" ", launcher.getMemberId());
+    assertNull(launcher.getMemberName());
+    assertNull(launcher.getMember());
+  }
+
+  @Test
+  public void testAbstractLauncherServiceStateToDaysHoursMinutesSeconds() {
+    assertEquals("", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(null));
+    assertEquals("0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(0l));
+    assertEquals("1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(1000l));
+    assertEquals("1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(1999l));
+    assertEquals("2 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(2001l));
+    assertEquals("45 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(45000l));
+    assertEquals("1 minute 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 1000l));
+    assertEquals("1 minute 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(61 * 1000l));
+    assertEquals("1 minute 30 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(90 * 1000l));
+    assertEquals("2 minutes 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(120 * 1000l));
+    assertEquals("2 minutes 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(121 * 1000l));
+    assertEquals("2 minutes 15 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(135 * 1000l));
+    assertEquals("1 hour 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 60 * 1000l));
+    assertEquals("1 hour 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 60 * 1000l + 1000l));
+    assertEquals("1 hour 15 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 60 * 1000l + 15000l));
+    assertEquals("1 hour 1 minute 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 61 * 1000l));
+    assertEquals("1 hour 1 minute 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 61 * 1000l + 1000l));
+    assertEquals("1 hour 1 minute 45 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 61 * 1000l + 45000l));
+    assertEquals("1 hour 2 minutes 0 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 62 * 1000l));
+    assertEquals("1 hour 5 minutes 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 65 * 1000l + 1000l));
+    assertEquals("1 hour 5 minutes 10 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 65 * 1000l + 10000l));
+    assertEquals("1 hour 59 minutes 11 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(60 * 119 * 1000l + 11000l));
+    assertEquals("1 day 1 hour 1 minute 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(
+      TimeUnit.DAYS.toMillis(1) + TimeUnit.HOURS.toMillis(1) + TimeUnit.MINUTES.toMillis(1) + TimeUnit.SECONDS.toMillis(1)));
+    assertEquals("1 day 5 hours 15 minutes 45 seconds", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(
+      TimeUnit.DAYS.toMillis(1) + TimeUnit.HOURS.toMillis(5) + TimeUnit.MINUTES.toMillis(15) + TimeUnit.SECONDS.toMillis(45)));
+    assertEquals("2 days 1 hour 30 minutes 1 second", AbstractLauncher.ServiceState.toDaysHoursMinutesSeconds(
+      TimeUnit.DAYS.toMillis(2) + TimeUnit.HOURS.toMillis(1) + TimeUnit.MINUTES.toMillis(30) + TimeUnit.SECONDS.toMillis(1)));
+  }
+
+  protected static final class FakeServiceLauncher extends AbstractLauncher<String> {
+
+    private final String memberId;
+    private final String memberName;
+
+    public FakeServiceLauncher(final String memberName, final String memberId) {
+      this.memberId = memberId;
+      this.memberName = memberName;
+    }
+
+    @Override
+    boolean isAttachAPIOnClasspath() {
+      return false;
+    }
+
+    @Override
+    public String getLogFileName() {
+      throw new UnsupportedOperationException("Not Implemented!");
+    }
+
+    @Override
+    public String getMemberId() {
+      return memberId;
+    }
+
+    @Override
+    public String getMemberName() {
+      return memberName;
+    }
+
+    @Override
+    public Integer getPid() {
+      throw new UnsupportedOperationException("Not Implemented!");
+    }
+
+    @Override
+    public String getServiceName() {
+      return "TestService";
+    }
+
+    @Override
+    public void run() {
+      throw new UnsupportedOperationException("Not Implemented!");
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherIntegrationTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherIntegrationTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherIntegrationTestCase.java
new file mode 100755
index 0000000..5434a01
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherIntegrationTestCase.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import java.util.concurrent.Callable;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.rules.ErrorCollector;
+import org.junit.rules.TemporaryFolder;
+
+import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
+import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
+import com.gemstone.gemfire.distributed.LocatorLauncher.LocatorState;
+import com.gemstone.gemfire.distributed.internal.SharedConfiguration;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.DistributionLocator;
+
+/**
+ * @since 8.0
+ */
+public abstract class AbstractLocatorLauncherIntegrationTestCase extends AbstractLauncherIntegrationTestCase {
+
+  protected volatile int locatorPort;
+  protected volatile LocatorLauncher launcher;
+  protected volatile String workingDirectory;
+  protected volatile String clusterConfigDirectory;
+
+  @Rule
+  public ErrorCollector errorCollector = new ErrorCollector();
+
+  @Rule
+  public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+  @Before
+  public final void setUpAbstractLocatorLauncherIntegrationTestCase() throws Exception {
+    final int port = AvailablePortHelper.getRandomAvailableTCPPort();
+    System.setProperty(DistributionLocator.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY, String.valueOf(port));
+    this.locatorPort = port;
+    this.workingDirectory = this.temporaryFolder.getRoot().getCanonicalPath();
+    this.clusterConfigDirectory = this.temporaryFolder.newFolder(SharedConfiguration.CLUSTER_CONFIG_DISK_DIR_PREFIX + getUniqueName()).getCanonicalPath();
+  }
+  
+  @After
+  public final void tearDownAbstractLocatorLauncherIntegrationTestCase() throws Exception {
+    this.locatorPort = 0;
+    if (this.launcher != null) {
+      this.launcher.stop();
+      this.launcher = null;
+    }
+  }
+
+  /**
+   * Override if needed
+   */
+  protected Status getExpectedStopStatusForNotRunning() {
+    return Status.NOT_RESPONDING;
+  }
+
+  protected void waitForLocatorToStart(final LocatorLauncher launcher, int timeout, int interval, boolean throwOnTimeout) throws Exception {
+    assertEventuallyTrue("waiting for process to start: " + launcher.status(), new Callable<Boolean>() {
+      @Override
+      public Boolean call() throws Exception {
+        try {
+          final LocatorState LocatorState = launcher.status();
+          return (LocatorState != null && Status.ONLINE.equals(LocatorState.getStatus()));
+        }
+        catch (RuntimeException e) {
+          return false;
+        }
+      }
+    }, timeout, interval);
+  }
+  
+  protected void waitForLocatorToStart(final LocatorLauncher launcher, int timeout, boolean throwOnTimeout) throws Exception {
+    waitForLocatorToStart(launcher, timeout, INTERVAL_MILLISECONDS, throwOnTimeout);
+  }
+  
+  protected void waitForLocatorToStart(final LocatorLauncher launcher, boolean throwOnTimeout) throws Exception {
+    waitForLocatorToStart(launcher, TIMEOUT_MILLISECONDS, INTERVAL_MILLISECONDS, throwOnTimeout);
+  }
+  
+  protected void waitForLocatorToStart(final LocatorLauncher launcher) throws Exception {
+    waitForLocatorToStart(launcher, TIMEOUT_MILLISECONDS, INTERVAL_MILLISECONDS, true);
+  }
+  
+  protected static void waitForLocatorToStart(int port, int timeout, int interval, boolean throwOnTimeout) throws Exception {
+    final LocatorLauncher locatorLauncher = new Builder().setPort(port).build();
+    assertEventuallyTrue("Waiting for Locator in other process to start.", new Callable<Boolean>() {
+      @Override
+      public Boolean call() throws Exception {
+        try {
+          final LocatorState locatorState = locatorLauncher.status();
+          return (locatorState != null && Status.ONLINE.equals(locatorState.getStatus()));
+        }
+        catch (RuntimeException e) {
+          return false;
+        }
+      }
+    }, timeout, interval);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherJUnitTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherJUnitTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherJUnitTestCase.java
deleted file mode 100755
index 62c4d86..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherJUnitTestCase.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import java.util.concurrent.Callable;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.rules.ErrorCollector;
-import org.junit.rules.TemporaryFolder;
-
-import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
-import com.gemstone.gemfire.distributed.LocatorLauncher.Builder;
-import com.gemstone.gemfire.distributed.LocatorLauncher.LocatorState;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.internal.DistributionLocator;
-
-/**
- * @since 8.0
- */
-public abstract class AbstractLocatorLauncherJUnitTestCase extends AbstractLauncherJUnitTestCase {
-
-  protected volatile int locatorPort;
-  protected volatile LocatorLauncher launcher;
-  
-  @Rule
-  public ErrorCollector errorCollector = new ErrorCollector();
-
-  @Rule
-  public TemporaryFolder temporaryFolder = new TemporaryFolder();
-
-  @Before
-  public final void setUpLocatorLauncherTest() throws Exception {
-    final int port = AvailablePortHelper.getRandomAvailableTCPPort();
-    System.setProperty(DistributionLocator.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY, String.valueOf(port));
-    this.locatorPort = port;
-  }
-  
-  @After
-  public final void tearDownLocatorLauncherTest() throws Exception {    
-    this.locatorPort = 0;
-    if (this.launcher != null) {
-      this.launcher.stop();
-      this.launcher = null;
-    }
-  }
-  
-  protected void waitForLocatorToStart(final LocatorLauncher launcher, int timeout, int interval, boolean throwOnTimeout) throws Exception {
-    assertEventuallyTrue("waiting for process to start: " + launcher.status(), new Callable<Boolean>() {
-      @Override
-      public Boolean call() throws Exception {
-        try {
-          final LocatorState LocatorState = launcher.status();
-          return (LocatorState != null && Status.ONLINE.equals(LocatorState.getStatus()));
-        }
-        catch (RuntimeException e) {
-          return false;
-        }
-      }
-    }, timeout, interval);
-  }
-  
-  protected void waitForLocatorToStart(final LocatorLauncher launcher, int timeout, boolean throwOnTimeout) throws Exception {
-    waitForLocatorToStart(launcher, timeout, INTERVAL_MILLISECONDS, throwOnTimeout);
-  }
-  
-  protected void waitForLocatorToStart(final LocatorLauncher launcher, boolean throwOnTimeout) throws Exception {
-    waitForLocatorToStart(launcher, TIMEOUT_MILLISECONDS, INTERVAL_MILLISECONDS, throwOnTimeout);
-  }
-  
-  protected void waitForLocatorToStart(final LocatorLauncher launcher) throws Exception {
-    waitForLocatorToStart(launcher, TIMEOUT_MILLISECONDS, INTERVAL_MILLISECONDS, true);
-  }
-  
-  protected static void waitForLocatorToStart(int port, int timeout, int interval, boolean throwOnTimeout) throws Exception {
-    final LocatorLauncher locatorLauncher = new Builder().setPort(port).build();
-    assertEventuallyTrue("Waiting for Locator in other process to start.", new Callable<Boolean>() {
-      @Override
-      public Boolean call() throws Exception {
-        try {
-          final LocatorState locatorState = locatorLauncher.status();
-          return (locatorState != null && Status.ONLINE.equals(locatorState.getStatus()));
-        }
-        catch (RuntimeException e) {
-          return false;
-        }
-      }
-    }, timeout, interval);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java
new file mode 100644
index 0000000..ecfb952
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.After;
+import org.junit.Before;
+
+import com.gemstone.gemfire.internal.process.ProcessStreamReader;
+
+public abstract class AbstractLocatorLauncherRemoteIntegrationTestCase extends AbstractLocatorLauncherIntegrationTestCase {
+
+  protected volatile Process process;
+  protected volatile ProcessStreamReader processOutReader;
+  protected volatile ProcessStreamReader processErrReader;
+
+  @Before
+  public final void setUpAbstractLocatorLauncherRemoteIntegrationTestCase() throws Exception {
+  }
+
+  @After
+  public final void tearDownAbstractLocatorLauncherRemoteIntegrationTestCase() throws Exception {
+    if (this.process != null) {
+      this.process.destroy();
+      this.process = null;
+    }
+    if (this.processOutReader != null && this.processOutReader.isRunning()) {
+      this.processOutReader.stop();
+    }
+    if (this.processErrReader != null && this.processErrReader.isRunning()) {
+      this.processErrReader.stop();
+    }
+  }
+
+  /**
+   * Override as needed.
+   */
+  protected List<String> getJvmArguments() {
+    final List<String> jvmArguments = new ArrayList<String>();
+    jvmArguments.add("-Dgemfire.log-level=config");
+    return jvmArguments;
+  }
+
+  /**
+   * Remove final if a test needs to override.
+   */
+  protected final AbstractLauncher.Status getExpectedStopStatusForNotRunning() {
+    return AbstractLauncher.Status.NOT_RESPONDING;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherIntegrationTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherIntegrationTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherIntegrationTestCase.java
new file mode 100755
index 0000000..5f4fd6f
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherIntegrationTestCase.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed;
+
+import static org.junit.Assert.*;
+
+import java.util.concurrent.Callable;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.rules.ErrorCollector;
+import org.junit.rules.TemporaryFolder;
+
+import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
+import com.gemstone.gemfire.distributed.ServerLauncher.ServerState;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.cache.AbstractCacheServer;
+
+/**
+ * @since 8.0
+ */
+public abstract class AbstractServerLauncherIntegrationTestCase extends AbstractLauncherIntegrationTestCase {
+  
+  protected volatile int serverPort;
+  protected volatile ServerLauncher launcher;
+  protected volatile String workingDirectory;
+
+  @Rule
+  public ErrorCollector errorCollector= new ErrorCollector();
+  
+  @Rule
+  public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+  @Before
+  public final void setUpServerLauncherTest() throws Exception {
+    System.setProperty("gemfire." + DistributionConfig.MCAST_PORT_NAME, Integer.toString(0));
+    final int port = AvailablePortHelper.getRandomAvailableTCPPort();
+    System.setProperty(AbstractCacheServer.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY, String.valueOf(port));
+    this.serverPort = port;
+    this.workingDirectory = this.temporaryFolder.getRoot().getCanonicalPath();
+  }
+
+  @After
+  public final void tearDownServerLauncherTest() throws Exception {    
+    this.serverPort = 0;
+    if (this.launcher != null) {
+      this.launcher.stop();
+      this.launcher = null;
+    }
+  }
+  
+  protected void waitForServerToStart(final ServerLauncher launcher, int timeout, int interval, boolean throwOnTimeout) throws Exception {
+    assertEventuallyTrue("waiting for local Server to start: " + launcher.status(), new Callable<Boolean>() {
+      @Override
+      public Boolean call() throws Exception {
+        try {
+          final ServerState serverState = launcher.status();
+          assertNotNull(serverState);
+          return Status.ONLINE.equals(serverState.getStatus());
+        }
+        catch (RuntimeException e) {
+          return false;
+        }
+      }
+    }, timeout, interval);
+  }
+
+  protected void waitForServerToStart(final ServerLauncher launcher, boolean throwOnTimeout) throws Exception {
+    waitForServerToStart(launcher, TIMEOUT_MILLISECONDS, INTERVAL_MILLISECONDS, throwOnTimeout);
+  }
+  
+  protected void waitForServerToStart(final ServerLauncher launcher, int timeout, boolean throwOnTimeout) throws Exception {
+    waitForServerToStart(launcher, timeout, INTERVAL_MILLISECONDS, throwOnTimeout);
+  }
+  
+  protected void waitForServerToStart(final ServerLauncher launcher) throws Exception {
+    waitForServerToStart(launcher, TIMEOUT_MILLISECONDS, INTERVAL_MILLISECONDS, true);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/566fce96/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherJUnitTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherJUnitTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherJUnitTestCase.java
deleted file mode 100755
index 0ee3e7c..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/AbstractServerLauncherJUnitTestCase.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.distributed;
-
-import static org.junit.Assert.*;
-
-import java.util.concurrent.Callable;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.rules.ErrorCollector;
-import org.junit.rules.TemporaryFolder;
-
-import com.gemstone.gemfire.distributed.AbstractLauncher.Status;
-import com.gemstone.gemfire.distributed.ServerLauncher.ServerState;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.internal.cache.AbstractCacheServer;
-
-/**
- * @since 8.0
- */
-public abstract class AbstractServerLauncherJUnitTestCase extends AbstractLauncherJUnitTestCase {
-  
-  protected volatile int serverPort;
-  protected volatile ServerLauncher launcher;
-
-  @Rule
-  public ErrorCollector errorCollector= new ErrorCollector();
-  
-  @Rule
-  public TemporaryFolder temporaryFolder = new TemporaryFolder();
-
-  @Before
-  public final void setUpServerLauncherTest() throws Exception {
-    System.setProperty("gemfire." + DistributionConfig.MCAST_PORT_NAME, Integer.toString(0));
-    final int port = AvailablePortHelper.getRandomAvailableTCPPort();
-    System.setProperty(AbstractCacheServer.TEST_OVERRIDE_DEFAULT_PORT_PROPERTY, String.valueOf(port));
-    this.serverPort = port;
-  }
-
-  @After
-  public final void tearDownServerLauncherTest() throws Exception {    
-    this.serverPort = 0;
-    if (this.launcher != null) {
-      this.launcher.stop();
-      this.launcher = null;
-    }
-  }
-  
-  protected void waitForServerToStart(final ServerLauncher launcher, int timeout, int interval, boolean throwOnTimeout) throws Exception {
-    assertEventuallyTrue("waiting for local Server to start: " + launcher.status(), new Callable<Boolean>() {
-      @Override
-      public Boolean call() throws Exception {
-        try {
-          final ServerState serverState = launcher.status();
-          assertNotNull(serverState);
-          return Status.ONLINE.equals(serverState.getStatus());
-        }
-        catch (RuntimeException e) {
-          return false;
-        }
-      }
-    }, timeout, interval);
-  }
-
-  protected void waitForServerToStart(final ServerLauncher launcher, boolean throwOnTimeout) throws Exception {
-    waitForServerToStart(launcher, TIMEOUT_MILLISECONDS, INTERVAL_MILLISECONDS, throwOnTimeout);
-  }
-  
-  protected void waitForServerToStart(final ServerLauncher launcher, int timeout, boolean throwOnTimeout) throws Exception {
-    waitForServerToStart(launcher, timeout, INTERVAL_MILLISECONDS, throwOnTimeout);
-  }
-  
-  protected void waitForServerToStart(final ServerLauncher launcher) throws Exception {
-    waitForServerToStart(launcher, TIMEOUT_MILLISECONDS, INTERVAL_MILLISECONDS, true);
-  }
-}



Mime
View raw message