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 2016/04/27 01:17:23 UTC

[11/16] incubator-geode git commit: Updating and fixing tests

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteJUnitTest.java
index 63c7c74..d6c2e40 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherRemoteJUnitTest.java
@@ -121,7 +121,7 @@ public class LocatorLauncherRemoteJUnitTest extends AbstractLocatorLauncherJUnit
     Thread waiting = new Thread(new Runnable() {
       public void run() {
         try {
-          assertEquals(0, process.waitFor());
+          assertIndexDetailsEquals(0, process.waitFor());
         }
         catch (InterruptedException ignore) {
           logger.error("Interrupted while waiting for process!", ignore);
@@ -142,8 +142,8 @@ public class LocatorLauncherRemoteJUnitTest extends AbstractLocatorLauncherJUnit
 
     LocatorLauncher locatorLauncher = new Builder().setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath()).build();
 
-    assertEquals(Status.ONLINE, locatorLauncher.status().getStatus());
-    assertEquals(Status.STOPPED, locatorLauncher.stop().getStatus());
+    assertIndexDetailsEquals(Status.ONLINE, locatorLauncher.status().getStatus());
+    assertIndexDetailsEquals(Status.STOPPED, locatorLauncher.stop().getStatus());
   }
   */
 
@@ -584,7 +584,7 @@ public class LocatorLauncherRemoteJUnitTest extends AbstractLocatorLauncherJUnit
       // check the status
       final LocatorState locatorState = dirLauncher.status();
       assertNotNull(locatorState);
-      assertEquals(Status.NOT_RESPONDING, locatorState.getStatus());
+      assertIndexDetailsEquals(Status.NOT_RESPONDING, locatorState.getStatus());
       
       final String logFileName = getUniqueName()+".log";
       assertFalse("Log file should not exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorStateJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorStateJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorStateJUnitTest.java
index 248c39f..90d8ece 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorStateJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorStateJUnitTest.java
@@ -40,6 +40,22 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest;
 @Category(UnitTest.class)
 public class LocatorStateJUnitTest {
 
+  private String classpath = "test_classpath";
+  private String gemFireVersion = "test_gemfireversion";
+  private String host = "test_host";
+  private String javaVersion = "test_javaversion";
+  private String jvmArguments = "test_jvmarguments";
+  private String serviceLocation = "test_location";
+  private String logFile = "test_logfile";
+  private String memberName = "test_membername";
+  private Integer pid = 6396;
+  private String port = "test_port";
+  private String statusDescription = Status.NOT_RESPONDING.getDescription();
+  private String statusMessage = "test_statusmessage";
+  private Long timestampTime = 1450728233024L;
+  private Long uptime = 1629L;
+  private String workingDirectory = "test_workingdirectory";
+
   @Test
   public void fromJsonWithEmptyStringThrowsIllegalArgumentException() throws Exception {
     // given: empty string
@@ -122,66 +138,64 @@ public class LocatorStateJUnitTest {
     return LocatorState.fromJson(value);
   }
 
-  private String classpath = "test_classpath";
-  private String gemFireVersion = "test_gemfireversion";
-  private String host = "test_host";
-  private String javaVersion = "test_javaversion";
-  private String jvmArguments = "test_jvmarguments";
-  private String serviceLocation = "test_location";
-  private String logFile = "test_logfile";
-  private String memberName = "test_membername";
-  private Integer pid = 6396;
-  private String port = "test_port";
-  private String statusDescription = Status.NOT_RESPONDING.getDescription();
-  private String statusMessage = "test_statusmessage";
-  private Long timestampTime = 1450728233024L;
-  private Long uptime = 1629L;
-  private String workingDirectory = "test_workingdirectory";
-  
   private String getClasspath() {
     return this.classpath;
   }
+
   private String getGemFireVersion() {
     return this.gemFireVersion;
   }
+
   private String getHost() {
     return this.host;
   }
+
   private String getJavaVersion() {
     return this.javaVersion;
   }
+
   private List<String> getJvmArguments() {
     List<String> list = new ArrayList<String>();
     list.add(this.jvmArguments);
     return list;
   }
+
   private String getServiceLocation() {
     return this.serviceLocation;
   }
+
   private String getLogFile() {
     return this.logFile;
   }
+
   private String getMemberName() {
     return this.memberName;
   }
+
   private Integer getPid() {
     return this.pid;
   }
+
   private String getPort() {
     return this.port;
   }
+
   private String getStatusDescription() {
     return this.statusDescription;
   }
+
   private String getStatusMessage() {
     return this.statusMessage;
   }
+
   private Long getTimestampTime() {
     return this.timestampTime;
   }
+
   private Long getUptime() {
     return this.uptime;
   }
+
   private String getWorkingDirectory() {
     return this.workingDirectory;
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherJUnitTest.java
index 395a9e6..4462ca3 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherJUnitTest.java
@@ -18,40 +18,35 @@ package com.gemstone.gemfire.distributed;
 
 import static org.junit.Assert.*;
 
-import java.io.File;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.Collections;
-import java.util.Properties;
 import java.util.concurrent.atomic.AtomicBoolean;
 
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.server.CacheServer;
-import com.gemstone.gemfire.distributed.ServerLauncher.Builder;
-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.test.junit.categories.UnitTest;
-
 import edu.umd.cs.mtc.MultithreadedTestCase;
 import edu.umd.cs.mtc.TestFramework;
-
 import org.jmock.Expectations;
 import org.jmock.Mockery;
 import org.jmock.lib.concurrent.Synchroniser;
 import org.jmock.lib.legacy.ClassImposteriser;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.contrib.java.lang.system.RestoreSystemProperties;
 import org.junit.experimental.categories.Category;
 import org.junit.rules.TestName;
 
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.server.CacheServer;
+import com.gemstone.gemfire.distributed.ServerLauncher.Builder;
+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.test.junit.categories.UnitTest;
+
 /**
  * The ServerLauncherJUnitTest class is a test suite of unit tests testing the contract, functionality and invariants
  * of the ServerLauncher class.
@@ -744,6 +739,7 @@ public class ServerLauncherJUnitTest {
     assertFalse(serverLauncher.isDisableDefaultServer());
     assertFalse(serverLauncher.isDefaultServerEnabled(mockCache));
   }
+
   @Test
   public void testIsDefaultServerEnabledWhenNoCacheServersExistAndDefaultServerDisabled() {
     final Cache mockCache = mockContext.mock(Cache.class, "Cache");
@@ -826,12 +822,6 @@ public class ServerLauncherJUnitTest {
     serverLauncher.startCacheServer(mockCache);
   }
   
-  public static void main(final String... args) {
-    System.err.printf("Thread (%1$s) is daemon (%2$s)%n", Thread.currentThread().getName(),
-      Thread.currentThread().isDaemon());
-    new Builder(args).setCommand(Command.START).build().run();
-  }
-
   private final class ServerWaitMultiThreadedTestCase extends MultithreadedTestCase {
 
     private final AtomicBoolean connectionStateHolder = new AtomicBoolean(true);
@@ -845,7 +835,8 @@ public class ServerLauncherJUnitTest {
       final Cache mockCache = mockContext.mock(Cache.class, "Cache");
 
       final DistributedSystem mockDistributedSystem = new DistributedSystemAdapter() {
-        @Override public boolean isConnected() {
+        @Override
+        public boolean isConnected() {
           return connectionStateHolder.get();
         }
       };

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalJUnitTest.java
index fd7d806..dd028d2 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherLocalJUnitTest.java
@@ -432,7 +432,7 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
       final int pid = readPid(this.pidFile);
       assertTrue(pid > 0);
       assertTrue(ProcessUtils.isProcessAlive(pid));
-      assertEquals(getPid(), pid);
+      assertIndexDetailsEquals(getPid(), pid);
       
       // validate log file was created
       final String logFileName = getUniqueName()+".log";
@@ -446,7 +446,7 @@ public class ServerLauncherLocalJUnitTest extends AbstractServerLauncherJUnitTes
     }
 
     try {
-      assertEquals(Status.STOPPED, this.launcher.stop().getStatus());
+      assertIndexDetailsEquals(Status.STOPPED, this.launcher.stop().getStatus());
       waitForFileToDelete(this.pidFile);
     } catch (Throwable e) {
       logger.error(e);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteJUnitTest.java
index 056e6ce..700cb18 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherRemoteJUnitTest.java
@@ -137,7 +137,7 @@ public class ServerLauncherRemoteJUnitTest extends AbstractServerLauncherJUnitTe
 //      @Override
 //      public void run() {
 //        try {
-//          assertEquals(0, process.waitFor());
+//          assertIndexDetailsEquals(0, process.waitFor());
 //        } catch (InterruptedException e) {
 //          logger.error("Interrupted while waiting for process", e);
 //        }
@@ -958,7 +958,7 @@ public class ServerLauncherRemoteJUnitTest extends AbstractServerLauncherJUnitTe
       // check the status
       final ServerState serverState = dirLauncher.status();
       assertNotNull(serverState);
-      assertEquals(Status.NOT_RESPONDING, serverState.getStatus());
+      assertIndexDetailsEquals(Status.NOT_RESPONDING, serverState.getStatus());
       
       final String logFileName = getUniqueName()+".log";
       assertFalse("Log file should not exist: " + logFileName, new File(this.temporaryFolder.getRoot(), logFileName).exists());

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/AtomicLongWithTerminalStateJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/AtomicLongWithTerminalStateJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/AtomicLongWithTerminalStateJUnitTest.java
index aca6874..eec4730 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/AtomicLongWithTerminalStateJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/AtomicLongWithTerminalStateJUnitTest.java
@@ -16,18 +16,17 @@
  */
 package com.gemstone.gemfire.distributed.internal;
 
+import static org.junit.Assert.*;
+
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
-import junit.framework.TestCase;
-
-/**
- *
- */
 @Category(UnitTest.class)
-public class AtomicLongWithTerminalStateJUnitTest extends TestCase {
-  
+public class AtomicLongWithTerminalStateJUnitTest {
+
+  @Test
   public void test() {
     AtomicLongWithTerminalState al = new AtomicLongWithTerminalState();
     assertEquals(23, al.compareAddAndGet(-1, 23));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java
index d2b5643..cc6310f 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java
@@ -16,49 +16,60 @@
  */
 package com.gemstone.gemfire.distributed.internal;
 
-import com.gemstone.gemfire.InternalGemFireException;
-import com.gemstone.gemfire.UnmodifiableException;
-import com.gemstone.gemfire.internal.ConfigSource;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
+import static org.junit.Assert.*;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.*;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import java.io.File;
-import java.lang.reflect.Method;
-import java.util.*;
-
-import static org.junit.Assert.*;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
+import com.gemstone.gemfire.InternalGemFireException;
+import com.gemstone.gemfire.UnmodifiableException;
+import com.gemstone.gemfire.internal.ConfigSource;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
-/**
- * Created by jiliao on 2/2/16.
- */
 @Category(UnitTest.class)
-
 public class DistributionConfigJUnitTest {
-  static Map<String, ConfigAttribute> attributes;
-  static Map<String, Method> setters;
-  static Map<String, Method> getters;
-  static Map<String, Method> isModifiables;
-  static Map<String, Method> checkers;
-  static String[] attNames;
-  DistributionConfigImpl config;
-
-  @BeforeClass
-  public static void beforeClass() {
+
+  private Map<Class<?>, Class<?>> classMap;
+
+  private Map<String, ConfigAttribute> attributes;
+  private Map<String, Method> setters;
+  private Map<String, Method> getters;
+  private Map<String, Method> checkers;
+  private String[] attNames;
+
+  private DistributionConfigImpl config;
+
+  @Before
+  public void before() {
+    classMap = new HashMap<Class<?>, Class<?>>();
+    classMap.put(boolean.class, Boolean.class);
+    classMap.put(byte.class, Byte.class);
+    classMap.put(short.class, Short.class);
+    classMap.put(char.class, Character.class);
+    classMap.put(int.class, Integer.class);
+    classMap.put(long.class, Long.class);
+    classMap.put(float.class, Float.class);
+    classMap.put(double.class, Double.class);
+
     attributes = DistributionConfig.attributes;
     setters = DistributionConfig.setters;
     getters = DistributionConfig.getters;
     attNames = DistributionConfig.dcValidAttributeNames;
     checkers = AbstractDistributionConfig.checkers;
-  }
 
-  @Before
-  public void before() {
     config = new DistributionConfigImpl(new Properties());
   }
 
@@ -96,6 +107,7 @@ public class DistributionConfigJUnitTest {
     System.out.println("filelList: " + fileList);
     System.out.println();
     System.out.println("otherList: " + otherList);
+
     assertEquals(boolList.size(), 30);
     assertEquals(intList.size(), 33);
     assertEquals(stringList.size(), 69);
@@ -227,6 +239,7 @@ public class DistributionConfigJUnitTest {
         modifiables.add(attName);
       }
     }
+
     assertEquals(modifiables.size(), 10);
     assertEquals(modifiables.get(0), "archive-disk-space-limit");
     assertEquals(modifiables.get(1), "archive-file-size-limit");
@@ -238,7 +251,6 @@ public class DistributionConfigJUnitTest {
     assertEquals(modifiables.get(7), "statistic-archive-file");
     assertEquals(modifiables.get(8), "statistic-sample-rate");
     assertEquals(modifiables.get(9), "statistic-sampling-enabled");
-
   }
 
   @Test(expected = IllegalArgumentException.class)
@@ -297,17 +309,4 @@ public class DistributionConfigJUnitTest {
     assertTrue(config.isAttributeModifiable(DistributionConfig.HTTP_SERVICE_PORT_NAME));
     assertTrue(config.isAttributeModifiable("jmx-manager-http-port"));
   }
-
-  public final static Map<Class<?>, Class<?>> classMap = new HashMap<Class<?>, Class<?>>();
-
-  static {
-    classMap.put(boolean.class, Boolean.class);
-    classMap.put(byte.class, Byte.class);
-    classMap.put(short.class, Short.class);
-    classMap.put(char.class, Character.class);
-    classMap.put(int.class, Integer.class);
-    classMap.put(long.class, Long.class);
-    classMap.put(float.class, Float.class);
-    classMap.put(double.class, Double.class);
-  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystemJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystemJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystemJUnitTest.java
index 2024bf2..8832459 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystemJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystemJUnitTest.java
@@ -132,7 +132,7 @@ public class InternalDistributedSystemJUnitTest
     assertEquals(DistributionConfig.DEFAULT_LOG_FILE, config.getLogFile());
 
     //default log level gets overrided by the gemfire.properties created for unit tests.
-//    assertEquals(DistributionConfig.DEFAULT_LOG_LEVEL, config.getLogLevel());
+//    assertIndexDetailsEquals(DistributionConfig.DEFAULT_LOG_LEVEL, config.getLogLevel());
 
     assertEquals(DistributionConfig.DEFAULT_STATISTIC_SAMPLING_ENABLED,
                  config.getStatisticSamplingEnabled());
@@ -145,7 +145,7 @@ public class InternalDistributedSystemJUnitTest
 
     // ack-wait-threadshold is overridden on VM's command line using a
     // system property.  This is not a valid test.  Hrm.
-//     assertEquals(DistributionConfig.DEFAULT_ACK_WAIT_THRESHOLD, config.getAckWaitThreshold());
+//     assertIndexDetailsEquals(DistributionConfig.DEFAULT_ACK_WAIT_THRESHOLD, config.getAckWaitThreshold());
 
     assertEquals(DistributionConfig.DEFAULT_ACK_SEVERE_ALERT_THRESHOLD, config.getAckSevereAlertThreshold());
     
@@ -683,7 +683,7 @@ public class InternalDistributedSystemJUnitTest
     Locator locator = (Locator) locators.iterator().next();
     Assert.assertTrue(locator.isPeerLocator());
 //    Assert.assertFalse(locator.isServerLocator()); server location is forced on while licensing is disabled in GemFire
-//    Assert.assertEquals("127.0.0.1", locator.getBindAddress().getHostAddress());  removed this check for ipv6 testing
+//    Assert.assertIndexDetailsEquals("127.0.0.1", locator.getBindAddress().getHostAddress());  removed this check for ipv6 testing
     Assert.assertEquals(unusedPort, locator.getPort());
     deleteStateFile(unusedPort);
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
index 34ac767..fb391f9 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotJUnitTest.java
@@ -22,23 +22,18 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Map;
-import java.util.Map.Entry;
-import java.util.concurrent.atomic.AtomicInteger;
 
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.cache.server.ServerLoad;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
 /**
  * Tests the functionality of the LocatorLoadSnapshot, which
  * is the data structure that is used in the locator to compare
  * the load between multiple servers.
- * 
  */
 @Category(UnitTest.class)
 public class LocatorLoadSnapshotJUnitTest {
@@ -61,7 +56,6 @@ public class LocatorLoadSnapshotJUnitTest {
    * and then we test that after several requests, the
    * load balancer starts sending connections to the second
    * server.
-   * 
    */
   @Test
   public void testTwoServers() {
@@ -174,7 +168,7 @@ public class LocatorLoadSnapshotJUnitTest {
    * servers with interecting groups correctly.
    */
   @Test
-  public void testInterectingGroups() {
+  public void testIntersectingGroups() {
     LocatorLoadSnapshot sn = new LocatorLoadSnapshot();
     ServerLocation l1 = new ServerLocation("localhost", 1);
     ServerLocation l2 = new ServerLocation("localhost", 2);
@@ -258,88 +252,6 @@ public class LocatorLoadSnapshotJUnitTest {
     assertEquals(Arrays.asList(new ServerLocation[] {} ), sn.getServersForQueue(null, excludeAll, 3));
   }
   
-  /**
-   * A basic test of concurrent functionality. Starts a number of
-   * threads making requests and expects the load to be balanced between
-   * three servers.
-   * @throws InterruptedException
-   */
-  @Category(FlakyTest.class) // GEODE-613: lots of threads, async action, IntegrationTest-not-UnitTest, thread joins, time sensitive
-  @Test
-  public void testConcurrentBalancing() throws InterruptedException {
-    int NUM_THREADS = 50;
-    final int NUM_REQUESTS = 10000;
-    int ALLOWED_THRESHOLD = 50; //We should never be off by more than
-    //the number of concurrent threads.
-    
-    final LocatorLoadSnapshot sn = new LocatorLoadSnapshot();
-    final ServerLocation l1 = new ServerLocation("localhost", 1);
-    final ServerLocation l2 = new ServerLocation("localhost", 2);
-    final ServerLocation l3 = new ServerLocation("localhost", 3);
-    
-    int initialLoad1 = (int) (Math.random() * (NUM_REQUESTS / 2));
-    int initialLoad2 = (int) (Math.random() * (NUM_REQUESTS / 2));
-    int initialLoad3 = (int) (Math.random() * (NUM_REQUESTS / 2));
-    
-    sn.addServer(l1, new String[0], new ServerLoad(initialLoad1, 1, 0, 1));
-    sn.addServer(l2, new String[0], new ServerLoad(initialLoad2, 1, 0, 1));
-    sn.addServer(l3, new String[0], new ServerLoad(initialLoad3, 1, 0, 1));
-    
-    final Map loadCounts = new HashMap();
-    loadCounts.put(l1, new AtomicInteger(initialLoad1));
-    loadCounts.put(l2, new AtomicInteger(initialLoad2));
-    loadCounts.put(l3, new AtomicInteger(initialLoad3));
-    
-    Thread[] threads = new Thread[NUM_THREADS];
-//    final Object lock = new Object();
-    for(int i =0; i < NUM_THREADS; i++) {
-      threads[i] = new Thread("Thread-" + i) {
-        public void run() {
-          for(int ii = 0; ii < NUM_REQUESTS; ii++) {
-            ServerLocation location;
-//            synchronized(lock) {
-              location = sn.getServerForConnection(null, Collections.EMPTY_SET);
-//            }
-            AtomicInteger count = (AtomicInteger) loadCounts.get(location);
-            count.incrementAndGet();
-          }
-        }
-      };
-    }
-    
-    for(int i =0; i < NUM_THREADS; i++) {
-      threads[i].start();
-    }
-    
-    for(int i =0; i < NUM_THREADS; i++) {
-      Thread t = threads[i];
-      long ms = 30 * 1000;
-      t.join(30 * 1000);
-      if (t.isAlive()) {
-        for(int j =0; j < NUM_THREADS; j++) {
-          threads[j].interrupt();
-        }
-        fail("Thread did not terminate after " + ms + " ms: " + t);
-      }
-    }
-    
-    double expectedPerServer = ( initialLoad1 + initialLoad2 + initialLoad3 + 
-              NUM_REQUESTS * NUM_THREADS) / (double) loadCounts.size();
-//    for(Iterator itr = loadCounts.entrySet().iterator(); itr.hasNext(); ) {
-//      Map.Entry entry = (Entry) itr.next();
-//      ServerLocation location = (ServerLocation) entry.getKey();
-//      AI count= (AI) entry.getValue();
-//    }
-    
-    for(Iterator itr = loadCounts.entrySet().iterator(); itr.hasNext(); ) {
-      Map.Entry entry = (Entry) itr.next();
-      ServerLocation location = (ServerLocation) entry.getKey();
-      AtomicInteger count= (AtomicInteger) entry.getValue();
-      int difference = (int) Math.abs(count.get() - expectedPerServer);
-      assertTrue("Count " + count + " for server " + location + " is not within " + ALLOWED_THRESHOLD + " of " + expectedPerServer, difference < ALLOWED_THRESHOLD);
-    }
-  }
-  
   @Test
   public void testAreBalanced() {
     final LocatorLoadSnapshot sn = new LocatorLoadSnapshot();
@@ -367,19 +279,5 @@ public class LocatorLoadSnapshotJUnitTest {
     assertTrue(sn.hasBalancedConnections("a"));
     assertFalse(sn.hasBalancedConnections("b"));
   }
-  
-  public void _test2() { // delete this method?
-    final LocatorLoadSnapshot sn = new LocatorLoadSnapshot();
-    sn.addServer(new ServerLocation("hs20h.gemstone.com",28543), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
-    sn.addServer(new ServerLocation("hs20l.gemstone.com",22385), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
-    sn.addServer(new ServerLocation("hs20n.gemstone.com",23482), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
-    sn.addServer(new ServerLocation("hs20m.gemstone.com",23429), new String[0], new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
-    sn.addServer(new ServerLocation("hs20e.gemstone.com",20154), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
-    sn.addServer(new ServerLocation("hs20j.gemstone.com",24273), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
-    sn.addServer(new ServerLocation("hs20g.gemstone.com",27125), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
-    sn.addServer(new ServerLocation("hs20i.gemstone.com",25201), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
-    sn.addServer(new ServerLocation("hs20k.gemstone.com",23711), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
-    sn.addServer(new ServerLocation("hs20f.gemstone.com",21025), new String[0],new ServerLoad(0.0f, 0.00125f, 0.0f, 1.0f));
-  }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ProductUseLogJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ProductUseLogJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ProductUseLogJUnitTest.java
index ffcf09c..7e23f7b 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ProductUseLogJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ProductUseLogJUnitTest.java
@@ -16,71 +16,92 @@
  */
 package com.gemstone.gemfire.distributed.internal;
 
+import static org.junit.Assert.*;
+
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileReader;
 
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
+import org.junit.rules.TestName;
 
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
-import junit.framework.TestCase;
+@Category(UnitTest.class) // Fails on Windows -- see GEODE-373
+public class ProductUseLogJUnitTest {
 
-@Category(UnitTest.class)
-public class ProductUseLogJUnitTest extends TestCase {
+  private long oldMax;
+  private File logFile;
+  private ProductUseLog log;
 
-  public void testBasics() throws Exception {
-    File logFile = new File("ProductUseLogTest_testBasics.log");
-    if (logFile.exists()) {
-      logFile.delete();
+  @Rule
+  public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+  @Rule
+  public TestName testName = new TestName();
+
+  @Before
+  public void setUp() throws Exception {
+    oldMax = ProductUseLog.MAX_PRODUCT_USE_FILE_SIZE;
+    logFile = temporaryFolder.newFile(getClass().getSimpleName() + "_" + testName.getMethodName() + ".log");
+  }
+
+  @After
+  public void tearDown() throws Exception {
+    ProductUseLog.MAX_PRODUCT_USE_FILE_SIZE = oldMax;
+    if (log != null) {
+      log.close();
     }
-    ProductUseLog log = new ProductUseLog(logFile);
+  }
+
+  @Test
+  public void testBasics() throws Exception {
+    assertTrue(logFile.delete());
+
+    log = new ProductUseLog(logFile);
+
     assertTrue(logFile.exists());
+
     log.log("test message");
     log.close();
     log.log("shouldn't be logged");
     log.reopen();
     log.log("test message");
     log.close();
+
     BufferedReader reader = new BufferedReader(new  FileReader(logFile));
-    try {
-      String line = reader.readLine();
-      assertTrue(line.length() == 0);
-      line = reader.readLine();
-      assertTrue("expected first line to contain 'test message'", line.contains("test message"));
-
-      line = reader.readLine();
-      assertTrue(line.length() == 0);
-      line = reader.readLine();
-      assertTrue("expected second line to contain 'test message'", line.contains("test message"));
-
-      line = reader.readLine();
-      assertTrue("expected only two non-empty lines in the file", line == null);
-    } finally {
-      reader.close();
-    }
+
+    String line = reader.readLine();
+    assertTrue(line.length() == 0);
+    line = reader.readLine();
+    assertTrue("expected first line to contain 'test message'", line.contains("test message"));
+
+    line = reader.readLine();
+    assertTrue(line.length() == 0);
+    line = reader.readLine();
+    assertTrue("expected second line to contain 'test message'", line.contains("test message"));
+
+    line = reader.readLine();
+    assertTrue("expected only two non-empty lines in the file", line == null);
   }
 
+  @Test
   public void testSizeLimit() throws Exception {
-    long oldMax = ProductUseLog.MAX_PRODUCT_USE_FILE_SIZE;
     ProductUseLog.MAX_PRODUCT_USE_FILE_SIZE = 2000L;
-    try {
-      File logFile = new File("ProductUseLogTest_testSizeLimit.log");
-      assertTrue(logFile.createNewFile());
-      ProductUseLog log = new ProductUseLog(logFile);
-      try {
-        String logEntry = "log entry";
-        for (long i=0; i<ProductUseLog.MAX_PRODUCT_USE_FILE_SIZE; i++) {
-          log.log(logEntry);
-          assertTrue("expected " + logFile.getPath() + " to remain under "+ 
-              ProductUseLog.MAX_PRODUCT_USE_FILE_SIZE + " bytes in length",
-              logFile.length() < ProductUseLog.MAX_PRODUCT_USE_FILE_SIZE);
-        }
-      } finally {
-        log.close();
-      }
-    } finally {
-      ProductUseLog.MAX_PRODUCT_USE_FILE_SIZE = oldMax;
+
+    ProductUseLog log = new ProductUseLog(logFile);
+
+    String logEntry = "log entry";
+    for (long i=0; i<ProductUseLog.MAX_PRODUCT_USE_FILE_SIZE; i++) {
+      log.log(logEntry);
+      assertTrue("expected " + logFile.getPath() + " to remain under "+
+          ProductUseLog.MAX_PRODUCT_USE_FILE_SIZE + " bytes in length",
+          logFile.length() < ProductUseLog.MAX_PRODUCT_USE_FILE_SIZE);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ServerLocatorJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ServerLocatorJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ServerLocatorJUnitTest.java
index 7690c87..bb83df9 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ServerLocatorJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ServerLocatorJUnitTest.java
@@ -20,33 +20,30 @@ import static org.junit.Assert.*;
 
 import java.io.IOException;
 
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.client.internal.locator.LocatorStatusRequest;
 import com.gemstone.gemfire.cache.client.internal.locator.LocatorStatusResponse;
 import com.gemstone.gemfire.i18n.LogWriterI18n;
-import com.gemstone.gemfire.internal.logging.LocalLogWriter;
 import com.gemstone.gemfire.internal.logging.InternalLogWriter;
+import com.gemstone.gemfire.internal.logging.LocalLogWriter;
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
 /**
  * The ServerLocatorJUnitTest class is a test suite of test cases testing the contract and functionality of the
  * ServerLocator class.
  * </p>
+ * TODO: write more unit tests for this class...
+ * </p>
  * @see com.gemstone.gemfire.distributed.internal.ServerLocator
  * @see org.junit.Assert
  * @see org.junit.Test
  * @since 7.0
  */
-// TODO Dan, write more unit tests for this class...
 @Category(UnitTest.class)
 public class ServerLocatorJUnitTest {
 
-  protected ServerLocator createServerLocator() throws IOException {
-    return new TestServerLocator();
-  }
-
   @Test
   public void testProcessRequestProcessesLocatorStatusRequest() throws IOException {
     final ServerLocator serverLocator = createServerLocator();
@@ -56,7 +53,11 @@ public class ServerLocatorJUnitTest {
     assertTrue(response instanceof LocatorStatusResponse);
   }
 
-  protected static class TestServerLocator extends ServerLocator {
+  private ServerLocator createServerLocator() throws IOException {
+    return new TestServerLocator();
+  }
+
+  private static class TestServerLocator extends ServerLocator {
     TestServerLocator() throws IOException {
       super();
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/SharedConfigurationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/SharedConfigurationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/SharedConfigurationJUnitTest.java
index f308855..8af42b6 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/SharedConfigurationJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/SharedConfigurationJUnitTest.java
@@ -31,7 +31,6 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
 /**
  * Unit tests for {@link SharedConfiguration}.
- * 
  *
  * @since 8.1
  */

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/StartupMessageDataJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/StartupMessageDataJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/StartupMessageDataJUnitTest.java
index aa0a88e..ee3f99e 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/StartupMessageDataJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/StartupMessageDataJUnitTest.java
@@ -16,6 +16,8 @@
  */
 package com.gemstone.gemfire.distributed.internal;
 
+import static org.junit.Assert.*;
+
 import java.io.DataInput;
 import java.io.DataOutputStream;
 import java.util.ArrayList;
@@ -24,6 +26,7 @@ import java.util.List;
 import java.util.Properties;
 import java.util.StringTokenizer;
 
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.DataSerializer;
@@ -33,21 +36,15 @@ import com.gemstone.gemfire.internal.ByteArrayData;
 import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId;
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
-import junit.framework.TestCase;
-
 /**
  * Tests {@link StartupMessageData}.
  * 
  * @since 7.0
  */
 @Category(UnitTest.class)
-public class StartupMessageDataJUnitTest extends TestCase {
-
-  public StartupMessageDataJUnitTest(String name) {
-    super(name);
-  }
-  
+public class StartupMessageDataJUnitTest {
 
+  @Test
   public void testWriteHostedLocatorsWithEmpty() throws Exception {
     Collection<String> hostedLocators = new ArrayList<String>();
     StartupMessageData data = new StartupMessageData();
@@ -55,6 +52,7 @@ public class StartupMessageDataJUnitTest extends TestCase {
     assertTrue(data.getOptionalFields().isEmpty());
   }
 
+  @Test
   public void testWriteHostedLocatorsWithNull() throws Exception {
     Collection<String> hostedLocators = null;
     StartupMessageData data = new StartupMessageData();
@@ -62,6 +60,7 @@ public class StartupMessageDataJUnitTest extends TestCase {
     assertTrue(data.getOptionalFields().isEmpty());
   }
 
+  @Test
   public void testWriteHostedLocatorsWithOne() throws Exception {
     String locatorString = createOneLocatorString();
     
@@ -74,6 +73,7 @@ public class StartupMessageDataJUnitTest extends TestCase {
     assertEquals(locatorString, data.getOptionalFields().get(StartupMessageData.HOSTED_LOCATORS));
   }
 
+  @Test
   public void testWriteHostedLocatorsWithThree() throws Exception {
     String[] locatorStrings = createManyLocatorStrings(3);
     List<String> hostedLocators = new ArrayList<String>();
@@ -94,7 +94,8 @@ public class StartupMessageDataJUnitTest extends TestCase {
       assertEquals(locatorStrings[i], st.nextToken());
     }
   }
-  
+
+  @Test
   public void testReadHostedLocatorsWithThree() throws Exception {
     // set up the data
     String[] locatorStrings = createManyLocatorStrings(3);
@@ -116,7 +117,8 @@ public class StartupMessageDataJUnitTest extends TestCase {
       i++;
     }
   }
-  
+
+  @Test
   public void testToDataWithEmptyHostedLocators() throws Exception {
     Collection<String> hostedLocators = new ArrayList<String>();
     StartupMessageData data = new StartupMessageData();
@@ -134,6 +136,7 @@ public class StartupMessageDataJUnitTest extends TestCase {
     assertNull(props);
   }
 
+  @Test
   public void testToDataWithNullHostedLocators() throws Exception {
     Collection<String> hostedLocators = null;
     StartupMessageData data = new StartupMessageData();
@@ -150,7 +153,8 @@ public class StartupMessageDataJUnitTest extends TestCase {
     Properties props = (Properties) DataSerializer.readObject(in);
     assertNull(props);
   }
-  
+
+  @Test
   public void testToDataWithOneHostedLocator() throws Exception {
     String locatorString = createOneLocatorString();
     
@@ -176,6 +180,7 @@ public class StartupMessageDataJUnitTest extends TestCase {
     assertEquals(locatorString, hostedLocatorsString);
   }
 
+  @Test
   public void testToDataWithThreeHostedLocators() throws Exception {
     String[] locatorStrings = createManyLocatorStrings(3);
     List<String> hostedLocators = new ArrayList<String>();
@@ -215,6 +220,7 @@ public class StartupMessageDataJUnitTest extends TestCase {
     }
   }
 
+  @Test
   public void testNullHostedLocator() throws Exception {
     String locatorString = null;
     DataInput in = getDataInputWithOneHostedLocator(locatorString);
@@ -223,7 +229,8 @@ public class StartupMessageDataJUnitTest extends TestCase {
     Collection<String> readHostedLocators = dataToRead.readHostedLocators();
     assertNull(readHostedLocators);
   }
-  
+
+  @Test
   public void testEmptyHostedLocator() throws Exception {
     String locatorString = "";
     DataInput in = getDataInputWithOneHostedLocator(locatorString);
@@ -232,7 +239,8 @@ public class StartupMessageDataJUnitTest extends TestCase {
     Collection<String> readHostedLocators = dataToRead.readHostedLocators();
     assertNull(readHostedLocators);
   }
-  
+
+  @Test
   public void testOneHostedLocator() throws Exception {
     String locatorString = createOneLocatorString();
     DataInput in = getDataInputWithOneHostedLocator(locatorString);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/DeadlockDetectorJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/DeadlockDetectorJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/DeadlockDetectorJUnitTest.java
deleted file mode 100644
index d27aa2c..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/DeadlockDetectorJUnitTest.java
+++ /dev/null
@@ -1,331 +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.internal.deadlock;
-
-import static org.junit.Assert.*;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.Set;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-import org.junit.After;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-/**
- *
- */
-@Category(UnitTest.class)
-public class DeadlockDetectorJUnitTest {
-  
-  private final Set<Thread> stuckThreads = Collections.synchronizedSet(new HashSet<Thread>());
-  
-  @After
-  public void tearDown() {
-    for(Thread thread: stuckThreads) {
-      thread.interrupt();
-      try {
-        thread.join(20 * 1000);
-      } catch (InterruptedException e) {
-        throw new RuntimeException("interrupted", e);
-      }
-      if(thread.isAlive()) {
-        fail("Couldn't kill" + thread);
-      }
-    }
-    stuckThreads.clear();
-  }
-  
-  @Test
-  public void testNoDeadlocks() {
-    DeadlockDetector detector = new DeadlockDetector();
-    detector.addDependencies(DeadlockDetector.collectAllDependencies("here"));
-    assertEquals(null, detector.findDeadlock());
-  }
-  
-  //this is commented out, because we can't
-  //clean up the threads deadlocked on monitors.
-  @Ignore
-  @Test
-  public void testMonitorDeadlock() throws InterruptedException {
-    final Object lock1 = new Object();
-    final Object lock2 = new Object();
-    Thread thread1 =  new Thread() {
-      public void run() {
-        stuckThreads.add(Thread.currentThread());
-        synchronized(lock1) {
-          Thread thread2 = new Thread() {
-            public void run() {
-              stuckThreads.add(Thread.currentThread());
-              synchronized(lock2) {
-               synchronized(lock1) {
-                 System.out.println("we won't get here");
-               }
-              }
-            }
-          };
-          thread2.start();
-          try {
-            Thread.sleep(1000);
-            synchronized(lock2) {
-              System.out.println("We won't get here");
-            }
-          } catch (InterruptedException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-          }
-        }
-      }
-    };
-    
-    thread1.start();
-    Thread.sleep(2000);
-    DeadlockDetector detector = new DeadlockDetector();
-    detector.addDependencies(DeadlockDetector.collectAllDependencies("here"));
-    LinkedList<Dependency> deadlocks = detector.findDeadlock();
-    System.out.println("deadlocks=" +  DeadlockDetector.prettyFormat(deadlocks));
-    assertEquals(4, detector.findDeadlock().size());
-  }
-
-  /**
-   * Make sure that we can detect a deadlock between two threads
-   * that are trying to acquire a two different syncs in the different orders.
-   * @throws InterruptedException
-   */
-  @Test
-  public void testSyncDeadlock() throws InterruptedException {
-
-    final Lock lock1 = new ReentrantLock();
-    final Lock lock2 = new ReentrantLock();
-    Thread thread1 =  new Thread() {
-      public void run() {
-        stuckThreads.add(Thread.currentThread());
-        lock1.lock();
-        Thread thread2 = new Thread() {
-          public void run() {
-            stuckThreads.add(Thread.currentThread());
-            lock2.lock();
-            try {
-              lock1.tryLock(10, TimeUnit.SECONDS);
-            } catch (InterruptedException e) {
-              //ignore
-            }
-            lock2.unlock();
-          }
-        };
-        thread2.start();
-        try {
-          Thread.sleep(1000);
-          lock2.tryLock(10, TimeUnit.SECONDS);
-        } catch (InterruptedException e) {
-          //ignore
-        }
-        lock1.unlock();
-      }
-    };
-    
-    thread1.start();
-    Thread.sleep(2000);
-    DeadlockDetector detector = new DeadlockDetector();
-    detector.addDependencies(DeadlockDetector.collectAllDependencies("here"));
-    LinkedList<Dependency> deadlocks = detector.findDeadlock();
-    System.out.println("deadlocks=" +  DeadlockDetector.prettyFormat(deadlocks));
-    assertEquals(4, detector.findDeadlock().size());
-  }
-  
-  //Semaphore are also not supported by the JDK
-  @Ignore
-  @Test
-  public void testSemaphoreDeadlock() throws InterruptedException {
-
-    final Semaphore lock1 = new Semaphore(1);
-    final Semaphore lock2 = new Semaphore(1);
-    Thread thread1 =  new Thread() {
-      public void run() {
-        stuckThreads.add(Thread.currentThread());
-        try {
-          lock1.acquire();
-        } catch (InterruptedException e1) {
-          e1.printStackTrace();
-        }
-        Thread thread2 = new Thread() {
-          public void run() {
-            stuckThreads.add(Thread.currentThread());
-            try {
-              lock2.acquire();
-              lock1.tryAcquire(10, TimeUnit.SECONDS);
-            } catch (InterruptedException e) {
-              //ignore
-            }
-            lock2.release();
-          }
-        };
-        thread2.start();
-        try {
-          Thread.sleep(1000);
-          lock2.tryAcquire(10, TimeUnit.SECONDS);
-        } catch (InterruptedException e) {
-          //ignore
-        }
-        lock1.release();
-      }
-    };
-    
-    thread1.start();
-    Thread.sleep(2000);
-    DeadlockDetector detector = new DeadlockDetector();
-    detector.addDependencies(DeadlockDetector.collectAllDependencies("here"));
-    LinkedList<Dependency> deadlocks = detector.findDeadlock();
-    System.out.println("deadlocks=" +  DeadlockDetector.prettyFormat(deadlocks));
-    assertEquals(4, detector.findDeadlock().size());
-  }
-  
-  /**
-   * This type of deadlock is currently not detected
-   * @throws InterruptedException
-   */
-  @Ignore
-  @Test
-  public void testReadLockDeadlock() throws InterruptedException {
-
-    final ReadWriteLock lock1 = new ReentrantReadWriteLock();
-    final ReadWriteLock lock2 = new ReentrantReadWriteLock();
-    Thread thread1 =  new Thread() {
-      public void run() {
-        stuckThreads.add(Thread.currentThread());
-        lock1.readLock().lock();
-        Thread thread2 = new Thread() {
-          public void run() {
-            stuckThreads.add(Thread.currentThread());
-            lock2.readLock().lock();
-            try {
-              lock1.writeLock().tryLock(10, TimeUnit.SECONDS);
-            } catch (InterruptedException e) {
-              e.printStackTrace();
-            }
-            lock2.readLock().unlock();
-          }
-        };
-        thread2.start();
-        try {
-          Thread.sleep(1000);
-          lock2.writeLock().tryLock(10, TimeUnit.SECONDS);
-        } catch (InterruptedException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-        }
-        lock1.readLock().unlock();
-      }
-    };
-    
-    thread1.start();
-    Thread.sleep(2000);
-    DeadlockDetector detector = new DeadlockDetector();
-    detector.addDependencies(DeadlockDetector.collectAllDependencies("here"));
-    LinkedList<Dependency> deadlocks = detector.findDeadlock();
-    System.out.println("deadlocks=" +  deadlocks);
-    assertEquals(4, detector.findDeadlock().size());
-  }
-  
-  /**
-   * Test that the deadlock detector will find deadlocks
-   * that are reported by the {@link DependencyMonitorManager}
-   */
-  @Test
-  public void testProgramaticDependencies() {
-    final CountDownLatch cdl = new CountDownLatch(1);
-    MockDependencyMonitor mock = new MockDependencyMonitor();
-    DependencyMonitorManager.addMonitor(mock);
-    
-    Thread t1 = startAThread(cdl);
-    Thread t2 = startAThread(cdl);
-    
-    String resource1 = "one";
-    String resource2 = "two";
-    
-    mock.addDependency(t1, resource1);
-    mock.addDependency(resource1, t2);
-    mock.addDependency(t2, resource2);
-    mock.addDependency(resource2, t1);
-    
-
-    DeadlockDetector detector = new DeadlockDetector();
-    detector.addDependencies(DeadlockDetector.collectAllDependencies("here"));
-    LinkedList<Dependency> deadlocks = detector.findDeadlock();
-    System.out.println("deadlocks=" + deadlocks);
-    assertEquals(4, deadlocks.size());
-    cdl.countDown();
-    DependencyMonitorManager.removeMonitor(mock);
-  }
-
-  private Thread startAThread(final CountDownLatch cdl) {
-    Thread thread = new Thread() {
-      public void run() {
-        try {
-          cdl.await();
-        } catch (InterruptedException e) {
-        }
-      }
-    };
-    thread.start();
-    
-    return thread;
-  }
-  
-  /**
-   * A fake dependency monitor.
-   *
-   */
-  private static class MockDependencyMonitor implements DependencyMonitor {
-    
-    Set<Dependency<Thread, Serializable>> blockedThreads = new HashSet<Dependency<Thread, Serializable>>();
-    Set<Dependency<Serializable, Thread>> held = new HashSet<Dependency<Serializable, Thread>>();
-
-    public Set<Dependency<Thread, Serializable>> getBlockedThreads(
-        Thread[] allThreads) {
-      return blockedThreads;
-    }
-
-    public void addDependency(String resource, Thread thread) {
-      held.add(new Dependency<Serializable, Thread>(resource, thread));
-      
-    }
-
-    public void addDependency(Thread thread, String resource) {
-      blockedThreads.add(new Dependency<Thread, Serializable>(thread, resource));
-    }
-
-    public Set<Dependency<Serializable, Thread>> getHeldResources(
-        Thread[] allThreads) {
-      return held;
-    }
-    
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/DeadlockDetectorTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/DeadlockDetectorTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/DeadlockDetectorTest.java
new file mode 100644
index 0000000..9490f47
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/DeadlockDetectorTest.java
@@ -0,0 +1,140 @@
+/*
+ * 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.internal.deadlock;
+
+import static org.junit.Assert.*;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.Set;
+import java.util.concurrent.CountDownLatch;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class DeadlockDetectorTest {
+  
+  private volatile Set<Thread> stuckThreads;
+
+  @Before
+  public void setUp() throws Exception {
+    stuckThreads = Collections.synchronizedSet(new HashSet<Thread>());
+  }
+
+  @After
+  public void tearDown() throws Exception {
+    for (Thread thread: stuckThreads) {
+      thread.interrupt();
+      thread.join(20 * 1000);
+      if (thread.isAlive()) {
+        fail("Couldn't kill" + thread);
+      }
+    }
+
+    stuckThreads.clear();
+  }
+  
+  @Test
+  public void testNoDeadlocks() {
+    DeadlockDetector detector = new DeadlockDetector();
+    detector.addDependencies(DeadlockDetector.collectAllDependencies("here"));
+    assertEquals(null, detector.findDeadlock());
+  }
+
+  /**
+   * Test that the deadlock detector will find deadlocks
+   * that are reported by the {@link DependencyMonitorManager}
+   */
+  @Test
+  public void testProgrammaticDependencies() throws Exception {
+    final CountDownLatch latch = new CountDownLatch(1);
+    MockDependencyMonitor mockDependencyMonitor = new MockDependencyMonitor();
+    DependencyMonitorManager.addMonitor(mockDependencyMonitor);
+    
+    Thread thread1 = startAThread(latch);
+    Thread thread2 = startAThread(latch);
+    
+    String resource1 = "one";
+    String resource2 = "two";
+    
+    mockDependencyMonitor.addDependency(thread1, resource1);
+    mockDependencyMonitor.addDependency(resource1, thread2);
+    mockDependencyMonitor.addDependency(thread2, resource2);
+    mockDependencyMonitor.addDependency(resource2, thread1);
+
+    DeadlockDetector detector = new DeadlockDetector();
+    detector.addDependencies(DeadlockDetector.collectAllDependencies("here"));
+    LinkedList<Dependency> deadlocks = detector.findDeadlock();
+
+    System.out.println("deadlocks=" + deadlocks);
+
+    assertEquals(4, deadlocks.size());
+
+    latch.countDown();
+    DependencyMonitorManager.removeMonitor(mockDependencyMonitor);
+  }
+
+  private Thread startAThread(final CountDownLatch latch) {
+    Thread thread = new Thread() {
+      @Override
+      public void run() {
+        try {
+          latch.await();
+        } catch (InterruptedException ignore) {
+        }
+      }
+    };
+
+    thread.start();
+    
+    return thread;
+  }
+  
+  /**
+   * A fake dependency monitor.
+   */
+  private static class MockDependencyMonitor implements DependencyMonitor {
+    
+    Set<Dependency<Thread, Serializable>> blockedThreads = new HashSet<>();
+    Set<Dependency<Serializable, Thread>> held = new HashSet<>();
+
+    @Override
+    public Set<Dependency<Thread, Serializable>> getBlockedThreads(Thread[] allThreads) {
+      return blockedThreads;
+    }
+
+    public void addDependency(String resource, Thread thread) {
+      held.add(new Dependency<>(resource, thread));
+    }
+
+    public void addDependency(Thread thread, String resource) {
+      blockedThreads.add(new Dependency<>(thread, resource));
+    }
+
+    @Override
+    public Set<Dependency<Serializable, Thread>> getHeldResources(Thread[] allThreads) {
+      return held;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/DependencyGraphJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/DependencyGraphJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/DependencyGraphJUnitTest.java
index b93ea09..93f47f0 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/DependencyGraphJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/DependencyGraphJUnitTest.java
@@ -16,23 +16,21 @@
  */
 package com.gemstone.gemfire.distributed.internal.deadlock;
 
+import static org.junit.Assert.*;
+
 import java.util.HashSet;
 import java.util.Set;
 
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
-import junit.framework.TestCase;
-
-/**
- *
- */
 @Category(UnitTest.class)
-public class DependencyGraphJUnitTest extends TestCase {
-  
+public class DependencyGraphJUnitTest {
+
+  @Test
   public void testFindCycle() {
-    
     DependencyGraph graph = new DependencyGraph();
     graph.addEdge(new Dependency("A", "B"));
     graph.addEdge(new Dependency("A", "F"));
@@ -47,9 +45,9 @@ public class DependencyGraphJUnitTest extends TestCase {
     expected.add(new Dependency("E", "A"));
     assertEquals(expected, new HashSet(graph.findCycle()));
   }
-  
+
+  @Test
   public void testSubGraph() {
-    
     DependencyGraph graph = new DependencyGraph();
     graph.addEdge(new Dependency("A", "B"));
     graph.addEdge(new Dependency("B", "C"));
@@ -68,7 +66,8 @@ public class DependencyGraphJUnitTest extends TestCase {
     DependencyGraph sub2 = graph.getSubGraph("E");
     assertEquals(null, sub2.findCycle());
   }
-  
+
+  @Test
   public void testTwoPaths() {
     DependencyGraph graph = new DependencyGraph();
     graph.addEdge(new Dependency("A", "B"));
@@ -78,7 +77,8 @@ public class DependencyGraphJUnitTest extends TestCase {
     
     assertEquals(null, graph.findCycle());
   }
-  
+
+  @Test
   public void testEmptySet() {
     DependencyGraph graph = new DependencyGraph();
     assertEquals(null, graph.findCycle());

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/UnsafeThreadLocalJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/UnsafeThreadLocalJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/UnsafeThreadLocalJUnitTest.java
index 7c7a7fc..41e2ff7 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/UnsafeThreadLocalJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/UnsafeThreadLocalJUnitTest.java
@@ -16,45 +16,62 @@
  */
 package com.gemstone.gemfire.distributed.internal.deadlock;
 
+import static org.junit.Assert.*;
+
 import java.util.concurrent.CountDownLatch;
 
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
-import junit.framework.TestCase;
-
-/**
- * 
- */
 @Category(UnitTest.class)
-public class UnsafeThreadLocalJUnitTest extends TestCase {
+public class UnsafeThreadLocalJUnitTest {
+
+  private static final long INTERVAL = 10;
+
+  private volatile boolean sleep;
+
+  @Before
+  public void setUp() throws Exception {
+    sleep = true;
+  }
+
+  @After
+  public void tearDown() throws Exception {
+    sleep = false;
+  }
 
   /**
    * Test that we can get the value of a thread local from another thread.
-   * 
-   * @throws InterruptedException
    */
+  @Test
   public void test() throws InterruptedException {
-    final UnsafeThreadLocal<String> utl = new UnsafeThreadLocal<String>();
+    final UnsafeThreadLocal<String> unsafeThreadLocal = new UnsafeThreadLocal<String>();
     final CountDownLatch localSet = new CountDownLatch(1);
 
     Thread test = new Thread() {
       public void run() {
-        utl.set("hello");
+        unsafeThreadLocal.set("hello");
         localSet.countDown();
         try {
-          Thread.sleep(100 * 1000);
+          while (sleep) {
+            Thread.sleep(INTERVAL);
+          }
         } catch (InterruptedException e) {
-          e.printStackTrace();
+          throw new AssertionError(e);
         }
       }
     };
+
     test.setDaemon(true);
     test.start();
+
     localSet.await();
-    assertEquals("hello", utl.get(test));
-    assertEquals(null, utl.get(Thread.currentThread()));
-  }
 
+    assertEquals("hello", unsafeThreadLocal.get(test));
+    assertEquals(null, unsafeThreadLocal.get(Thread.currentThread()));
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/NetViewJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/NetViewJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/NetViewJUnitTest.java
index dd7b432..5caf997 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/NetViewJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/NetViewJUnitTest.java
@@ -1,54 +1,42 @@
+/*
+ * 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.internal.membership;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.*;
 
-import java.io.IOException;
-import java.net.UnknownHostException;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
-import java.util.Timer;
 
-import org.junit.After;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
 
 import com.gemstone.gemfire.distributed.internal.DistributionManager;
-import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
-import com.gemstone.gemfire.distributed.internal.membership.NetView;
 import com.gemstone.gemfire.internal.SocketCreator;
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
-/*
- * 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.
- */
 @Category(UnitTest.class)
 public class NetViewJUnitTest {
-  List<InternalDistributedMember> members;
+
+  private List<InternalDistributedMember> members;
   
   @Before
   public void initMembers() throws Exception {
@@ -205,7 +193,6 @@ public class NetViewJUnitTest {
   
   /**
    * Test that failed weight calculations are correctly performed.  See bug #47342
-   * @throws Exception
    */
   @Test
   public void testFailedWeight() throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMemberJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMemberJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMemberJUnitTest.java
index 606ae1a..7eef594 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMemberJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/GMSMemberJUnitTest.java
@@ -16,32 +16,32 @@
  */
 package com.gemstone.gemfire.distributed.internal.membership.gms;
 
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
 
 import java.net.InetAddress;
 
 import org.jgroups.util.UUID;
-import org.junit.Assert;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.distributed.internal.membership.MemberAttributes;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
-@Category(UnitTest.class)
+@Category({ UnitTest.class, SecurityTest.class })
 public class GMSMemberJUnitTest {
 
   @Test
   public void testEqualsNotSameType() {
     GMSMember member = new GMSMember();
-    Assert.assertFalse(member.equals("Not a GMSMember"));
+    assertFalse(member.equals("Not a GMSMember"));
   }
   
   @Test
   public void testEqualsIsSame() {
     GMSMember member = new GMSMember();
-    Assert.assertTrue(member.equals(member));
+    assertTrue(member.equals(member));
   }
   
   @Test
@@ -49,7 +49,7 @@ public class GMSMemberJUnitTest {
     GMSMember member = new GMSMember();
     UUID uuid = new UUID(0, 0);
     member.setUUID(uuid);
-    Assert.assertEquals(0, member.compareTo(member));
+    assertEquals(0, member.compareTo(member));
   }
   
   private GMSMember createGMSMember(byte[] inetAddress, int viewId, long msb, long lsb) {
@@ -66,84 +66,85 @@ public class GMSMemberJUnitTest {
   public void testCompareToInetAddressIsLongerThan() {
     GMSMember member1 = createGMSMember(new byte[] {1, 1, 1, 1, 1}, 1, 1, 1);
     GMSMember member2 = createGMSMember(new byte[] {1, 1, 1, 1}, 1, 1, 1);
-    Assert.assertEquals(1, member1.compareTo(member2));
+    assertEquals(1, member1.compareTo(member2));
   }
   
   @Test
   public void testCompareToInetAddressIsShorterThan() {
     GMSMember member1 = createGMSMember(new byte[] {1, 1, 1, 1}, 1, 1, 1);
     GMSMember member2 = createGMSMember(new byte[] {1, 1, 1, 1, 1}, 1, 1, 1);
-    Assert.assertEquals(-1, member1.compareTo(member2));
+    assertEquals(-1, member1.compareTo(member2));
   }
   
   @Test
   public void testCompareToInetAddressIsGreater() {
     GMSMember member1 = createGMSMember(new byte[] {1, 2, 1, 1, 1}, 1, 1, 1);
     GMSMember member2 = createGMSMember(new byte[] {1, 1, 1, 1, 1}, 1, 1, 1);
-    Assert.assertEquals(1, member1.compareTo(member2));
+    assertEquals(1, member1.compareTo(member2));
   }
   
   @Test
   public void testCompareToInetAddressIsLessThan() {
     GMSMember member1 = createGMSMember(new byte[] {1, 1, 1, 1, 1}, 1, 1, 1);
     GMSMember member2 = createGMSMember(new byte[] {1, 2, 1, 1, 1}, 1, 1, 1);
-    Assert.assertEquals(-1, member1.compareTo(member2));
+    assertEquals(-1, member1.compareTo(member2));
   }
   
   @Test
   public void testCompareToMyViewIdLarger() {
     GMSMember member1 = createGMSMember(new byte[] {1}, 2, 1, 1);
     GMSMember member2 = createGMSMember(new byte[] {1}, 1, 1, 1);
-    Assert.assertEquals(1, member1.compareTo(member2));
+    assertEquals(1, member1.compareTo(member2));
   }
   
   @Test
   public void testCompareToTheirViewIdLarger() {
     GMSMember member1 = createGMSMember(new byte[] {1}, 1, 1, 1);
     GMSMember member2 = createGMSMember(new byte[] {1}, 2, 1, 1);
-    Assert.assertEquals(-1, member1.compareTo(member2));
+    assertEquals(-1, member1.compareTo(member2));
   }
   
   @Test
   public void testCompareToMyMSBLarger() {
     GMSMember member1 = createGMSMember(new byte[] {1}, 1, 2, 1);
     GMSMember member2 = createGMSMember(new byte[] {1}, 1, 1, 1);
-    Assert.assertEquals(1, member1.compareTo(member2));
+    assertEquals(1, member1.compareTo(member2));
   }
 
   @Test
   public void testCompareToTheirMSBLarger() {
     GMSMember member1 = createGMSMember(new byte[] {1}, 1, 1, 1);
     GMSMember member2 = createGMSMember(new byte[] {1}, 1, 2, 1);
-    Assert.assertEquals(-1, member1.compareTo(member2));
+    assertEquals(-1, member1.compareTo(member2));
   }
 
   @Test
   public void testCompareToMyLSBLarger() {
     GMSMember member1 = createGMSMember(new byte[] {1}, 1, 1, 2);
     GMSMember member2 = createGMSMember(new byte[] {1}, 1, 1, 1);
-    Assert.assertEquals(1, member1.compareTo(member2));
+    assertEquals(1, member1.compareTo(member2));
   }
   
   @Test
   public void testCompareToTheirLSBLarger() {
     GMSMember member1 = createGMSMember(new byte[] {1}, 1, 1, 1);
     GMSMember member2 = createGMSMember(new byte[] {1}, 1, 1, 2);
-    Assert.assertEquals(-1, member1.compareTo(member2));
+    assertEquals(-1, member1.compareTo(member2));
   }
 
-  
-  //Makes sure a NPE is not thrown
+  /**
+   * Makes sure a NPE is not thrown
+   */
   @Test
   public void testNoNPEWhenSetAttributesWithNull() {
     GMSMember member = new GMSMember();
     member.setAttributes(null);
     MemberAttributes attrs = member.getAttributes(); 
     MemberAttributes invalid = MemberAttributes.INVALID;
-    Assert.assertEquals(attrs.getVmKind(), invalid.getVmKind());
-    Assert.assertEquals(attrs.getPort(), invalid.getPort());
-    Assert.assertEquals(attrs.getVmViewId(), invalid.getVmViewId());
-    Assert.assertEquals(attrs.getName(), invalid.getName());
+    assertEquals(attrs.getVmKind(), invalid.getVmKind());
+    assertEquals(attrs.getPort(), invalid.getPort());
+    assertEquals(attrs.getVmViewId(), invalid.getVmViewId());
+    assertEquals(attrs.getName(), invalid.getName());
   }
   
   @Test
@@ -151,7 +152,7 @@ public class GMSMemberJUnitTest {
     GMSMember member = new GMSMember();
     UUID uuid = new UUID(0, 0);
     member.setUUID(uuid);
-    Assert.assertNull(member.getUUID());
+    assertNull(member.getUUID());
   }
   
   @Test
@@ -159,6 +160,6 @@ public class GMSMemberJUnitTest {
     GMSMember member = new GMSMember();
     UUID uuid = new UUID(1, 1);
     member.setUUID(uuid);
-    Assert.assertNotNull(member.getUUID());
+    assertNotNull(member.getUUID());
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/auth/GMSAuthenticatorJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/auth/GMSAuthenticatorJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/auth/GMSAuthenticatorJUnitTest.java
index 8246a43..022d1c7 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/auth/GMSAuthenticatorJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/auth/GMSAuthenticatorJUnitTest.java
@@ -16,6 +16,18 @@
  */
 package com.gemstone.gemfire.distributed.internal.membership.gms.auth;
 
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import java.security.Principal;
+import java.util.Properties;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.contrib.java.lang.system.RestoreSystemProperties;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.LogWriter;
 import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.distributed.internal.membership.gms.Services;
@@ -24,45 +36,34 @@ import com.gemstone.gemfire.security.AuthInitialize;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 import com.gemstone.gemfire.security.Authenticator;
 import com.gemstone.gemfire.security.GemFireSecurityException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
-import java.security.Principal;
-import java.util.Properties;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import static org.junit.Assert.*;
-
-@Category(UnitTest.class)
+@Category({ UnitTest.class, SecurityTest.class })
 public class GMSAuthenticatorJUnitTest {
 
-  static String prefix = "com.gemstone.gemfire.distributed.internal.membership.gms.auth.GMSAuthenticatorJUnitTest$";
+  private String prefix;
+  private Properties props;
+  private Services services;
+  private GMSAuthenticator authenticator;
+  private DistributedMember member;
 
-  Properties originalSystemProps = null;
-  Properties props = null;
-  Services services = null;
-  GMSAuthenticator authenticator = null;
-  DistributedMember member = null;
+  @Rule
+  public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
 
   @Before
   public void setUp() throws Exception {
-    originalSystemProps = System.getProperties();
+    prefix = getClass().getName() + "$";
     props = new Properties();
     authenticator = new GMSAuthenticator();
+
     services = mock(Services.class);
     InternalLogWriter securityLog = mock(InternalLogWriter.class);
-    when(services.getSecurityLogWriter()).thenReturn(securityLog);
+    when(services.getSecurityLogWriter()).thenReturn(mock(InternalLogWriter.class));
+
     authenticator.init(services);
-    member = mock(DistributedMember.class);
-  }
 
-  @After
-  public void tearDown() throws Exception {
-    System.setProperties(originalSystemProps);
+    member = mock(DistributedMember.class);
   }
 
   @Test
@@ -126,12 +127,12 @@ public class GMSAuthenticatorJUnitTest {
     verifyNegativeGetCredential(props, "expected get credential error");
   }
 
-  void verifyNegativeGetCredential(Properties props, String expectedError) throws Exception {
+  private void verifyNegativeGetCredential(Properties props, String expectedError) throws Exception {
     try {
       authenticator.getCredentials(member, props);
       fail("should catch: " + expectedError);
-    } catch (GemFireSecurityException e) {
-      assertTrue(e.getMessage().startsWith(expectedError));
+    } catch (GemFireSecurityException expected) {
+      assertTrue(expected.getMessage().startsWith(expectedError));
     }
   }
 
@@ -149,8 +150,8 @@ public class GMSAuthenticatorJUnitTest {
 
   @Test
   public void testAuthenticatorWithNoAuth() throws Exception {
-      String result = authenticator.authenticate(member, props, props, member);
-      assertNull(result);
+    String result = authenticator.authenticate(member, props, props, member);
+    assertNull(result);
   }
 
   @Test
@@ -195,27 +196,29 @@ public class GMSAuthenticatorJUnitTest {
     assertTrue(result, result.startsWith(expectedError));
   }
 
-  // ----------------------------------------
-  //           Test AuthInitialize
-  // ----------------------------------------
-
-  public static class TestAuthInit1 implements AuthInitialize {
+  private static class TestAuthInit1 implements AuthInitialize {
     public static AuthInitialize create() {
       return null;
     }
+    @Override
     public void init(LogWriter systemLogger, LogWriter securityLogger) throws AuthenticationFailedException {
     }
-    public Properties getCredentials(Properties props, DistributedMember server, boolean isPeer)
-        throws AuthenticationFailedException {
+    @Override
+    public Properties getCredentials(Properties props, DistributedMember server, boolean isPeer) throws AuthenticationFailedException {
       throw new AuthenticationFailedException("expected get credential error");
     }
+    @Override
     public void close() {
     }
   }
 
-  public static class TestAuthInit2 extends TestAuthInit1 {
-    static TestAuthInit2 instance = null;
-    static int createCount = 0;
+  private static class TestAuthInit2 extends TestAuthInit1 {
+
+    private static TestAuthInit2 instance = null;
+    private static int createCount = 0;
+
+    boolean closed = false;
+
     public static void setAuthInitialize(TestAuthInit2 auth) {
       instance = auth;
     }
@@ -223,11 +226,11 @@ public class GMSAuthenticatorJUnitTest {
       createCount ++;
       return instance;
     }
-    public Properties getCredentials(Properties props, DistributedMember server, boolean isPeer)
-        throws AuthenticationFailedException {
+    @Override
+    public Properties getCredentials(Properties props, DistributedMember server, boolean isPeer) throws AuthenticationFailedException {
       return props;
     }
-    boolean closed = false;
+    @Override
     public void close() {
       closed = true;
     }
@@ -239,59 +242,66 @@ public class GMSAuthenticatorJUnitTest {
     }
   }
 
-  public static class TestAuthInit3 extends TestAuthInit1 {
+  // used by reflection by test
+  private static class TestAuthInit3 extends TestAuthInit1 {
     public static AuthInitialize create() {
       return new TestAuthInit3();
     }
+    @Override
     public void init(LogWriter systemLogger, LogWriter securityLogger) throws AuthenticationFailedException {
       throw new AuthenticationFailedException("expected init error");
     }
   }
 
-  public static class TestAuthInit4 extends TestAuthInit1 {
+  private static class TestAuthInit4 extends TestAuthInit1 {
     public static AuthInitialize create() {
       return new TestAuthInit4();
     }
   }
 
-  // ----------------------------------------
-  //          Test Authenticator
-  // ----------------------------------------
-
-  public static class TestAuthenticator1 implements Authenticator {
+  private static class TestAuthenticator1 implements Authenticator {
     public static Authenticator create() {
       return null;
     }
+    @Override
     public void init(Properties securityProps, LogWriter systemLogger, LogWriter securityLogger) throws AuthenticationFailedException {
     }
+    @Override
     public Principal authenticate(Properties props, DistributedMember member) throws AuthenticationFailedException {
       return null;
     }
+    @Override
     public void close() {
     }
   }
 
-  public static class TestAuthenticator2 extends TestAuthenticator1 {
+  private static class TestAuthenticator2 extends TestAuthenticator1 {
     public static Authenticator create() {
       return new TestAuthenticator2();
     }
+    @Override
     public void init(Properties securityProps, LogWriter systemLogger, LogWriter securityLogger) throws AuthenticationFailedException {
       throw new AuthenticationFailedException("expected init error");
     }
   }
 
-  public static class TestAuthenticator3 extends TestAuthenticator1 {
+  private static class TestAuthenticator3 extends TestAuthenticator1 {
     public static Authenticator create() {
       return new TestAuthenticator3();
     }
+    @Override
     public Principal authenticate(Properties props, DistributedMember member) throws AuthenticationFailedException {
       throw new AuthenticationFailedException("expected authenticate error");
     }
   }
 
-  public static class TestAuthenticator4 extends TestAuthenticator1 {
-    static Authenticator instance = null;
-    static int createCount = 0;
+  private static class TestAuthenticator4 extends TestAuthenticator1 {
+
+    private static Authenticator instance = null;
+    private static int createCount = 0;
+
+    private boolean closed = false;
+
     public static void setAuthenticator(Authenticator auth) {
       instance = auth;
     }
@@ -299,10 +309,11 @@ public class GMSAuthenticatorJUnitTest {
       createCount ++;
       return instance;
     }
+    @Override
     public Principal authenticate(Properties props, DistributedMember member) throws AuthenticationFailedException {
       return null;
     }
-    boolean closed = false;
+    @Override
     public void close() {
       closed = true;
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0a6243/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java
index 2d042fc..00d9d05 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java
@@ -16,6 +16,20 @@
  */
 package com.gemstone.gemfire.distributed.internal.membership.gms.locator;
 
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.ObjectOutputStream;
+import java.net.InetAddress;
+import java.util.Properties;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.DataSerializer;
 import com.gemstone.gemfire.InternalGemFireException;
 import com.gemstone.gemfire.distributed.Locator;
@@ -30,28 +44,12 @@ import com.gemstone.gemfire.distributed.internal.membership.MemberFactory;
 import com.gemstone.gemfire.distributed.internal.membership.MembershipManager;
 import com.gemstone.gemfire.distributed.internal.membership.NetView;
 import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.internal.OSProcess;
 import com.gemstone.gemfire.internal.SocketCreator;
 import com.gemstone.gemfire.internal.Version;
 import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.ObjectOutputStream;
-import java.net.InetAddress;
-import java.util.Properties;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.mock;
-
-@Category(UnitTest.class)
+@Category(IntegrationTest.class)
 public class GMSLocatorRecoveryJUnitTest {
 
   File tempStateFile = null;