Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-837 bb91dedc4 -> e80bd5a27


Convert utils and tests to JUnit4


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

Branch: refs/heads/feature/GEODE-837
Commit: e80bd5a279f8817bb8383ed22d727ca0cdeb7eaf
Parents: bb91ded
Author: Kirk Lund <[email protected]>
Authored: Wed Jun 1 22:44:52 2016 -0700
Committer: Kirk Lund <[email protected]>
Committed: Wed Jun 1 22:44:52 2016 -0700

----------------------------------------------------------------------
 .../cache/tier/sockets/CacheServerTestUtil.java | 198 ++++++++-----------
 .../sockets/DurableClientCrashDUnitTest.java    |  39 +---
 .../sockets/DurableClientNetDownDUnitTest.java  |  65 +++---
 .../sockets/DurableClientSimpleDUnitTest.java   |  56 ++----
 .../tier/sockets/DurableClientTestCase.java     |  44 ++---
 5 files changed, 152 insertions(+), 250 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e80bd5a2/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTestUtil.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTestUtil.java
 
b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTestUtil.java
index 108c649..e9bae1f 100755
--- 
a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTestUtil.java
+++ 
b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTestUtil.java
@@ -16,6 +16,8 @@
  */
 package com.gemstone.gemfire.internal.cache.tier.sockets;
 
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
 import java.io.File;
 import java.net.InetSocketAddress;
 import java.net.URISyntaxException;
@@ -49,18 +51,14 @@ import com.gemstone.gemfire.internal.AvailablePort;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 import com.gemstone.gemfire.internal.cache.PoolFactoryImpl;
 import com.gemstone.gemfire.internal.cache.PoolFactoryImpl.PoolAttributes;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
 import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
 import com.gemstone.gemfire.test.dunit.IgnoredException;
 import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-/**
- *
- *
- */
-public class CacheServerTestUtil extends DistributedTestCase
-{
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+
+public class CacheServerTestUtil extends JUnit4DistributedTestCase {
+
   private static Cache cache = null;
   private static IgnoredException expected;
 
@@ -71,17 +69,11 @@ public class CacheServerTestUtil extends DistributedTestCase
   protected final static int TYPE_INVALIDATE = 2;
   protected final static int TYPE_DESTROY = 3;
 
-  public CacheServerTestUtil(String name) {
-    super(name);
-  }
-
-  public static void createCacheClient(Pool poolAttr, String regionName)
-      throws Exception {
+  public static void createCacheClient(Pool poolAttr, String regionName) 
throws Exception {
     createCacheClient(poolAttr, regionName, getClientProperties(), 
Boolean.FALSE);
   }
 
-  public static void createCacheClient(Pool poolAttr, String regionName,
-      Properties dsProperties) throws Exception {
+  public static void createCacheClient(Pool poolAttr, String regionName, 
Properties dsProperties) throws Exception {
     createCacheClient(poolAttr, regionName, dsProperties, Boolean.FALSE);
   }
 
@@ -89,8 +81,7 @@ public class CacheServerTestUtil extends DistributedTestCase
     createClientCache(poolAttr, regionName, getClientProperties());
   }
 
-  public static void createClientCache(Pool poolAttr, String regionName,
-    Properties dsProperties) throws Exception {
+  public static void createClientCache(Pool poolAttr, String regionName, 
Properties dsProperties) throws Exception {
     ClientCacheFactory ccf = new ClientCacheFactory(dsProperties);
     if (poolAttr != null) {
       ccf
@@ -119,70 +110,60 @@ public class CacheServerTestUtil extends 
DistributedTestCase
         ccf.addPoolServer(server.getHostName(), server.getPort());
       }
     }
-    new CacheServerTestUtil("temp").createClientCache(dsProperties, ccf);
+    new CacheServerTestUtil().createClientCache(dsProperties, ccf);
     ClientCache cc = (ClientCache)cache;
     
cc.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY).create(regionName);
     pool = (PoolImpl)((GemFireCacheImpl)cc).getDefaultPool();
   }
 
-  
-  
   public static void createPool(PoolAttributes poolAttr) throws Exception {
     Properties props = new Properties();
     props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
     props.setProperty(DistributionConfig.LOCATORS_NAME, "");
     
-    DistributedSystem ds = new CacheServerTestUtil("tmp").getSystem(props);;
-    
-      PoolFactoryImpl pf = (PoolFactoryImpl)PoolManager.createFactory();
-      pf.init(poolAttr);
-      PoolImpl p = (PoolImpl)pf.create("CacheServerTestUtil");
-      AttributesFactory factory = new AttributesFactory();
-      factory.setScope(Scope.LOCAL);
-      factory.setPoolName(p.getName());
+    DistributedSystem ds = new CacheServerTestUtil().getSystem(props);;
     
-      RegionAttributes attrs = factory.create();
-      pool = p;
-    }
-  
-  
-  
-  
-  
-  
-  
-  public static void createCacheClient(Pool poolAttr, String regionName,
-    Properties dsProperties, Boolean addControlListener) throws Exception {
+    PoolFactoryImpl pf = (PoolFactoryImpl)PoolManager.createFactory();
+    pf.init(poolAttr);
+    PoolImpl p = (PoolImpl)pf.create("CacheServerTestUtil");
+    AttributesFactory factory = new AttributesFactory();
+    factory.setScope(Scope.LOCAL);
+    factory.setPoolName(p.getName());
+
+    RegionAttributes attrs = factory.create();
+    pool = p;
+  }
+
+  public static void createCacheClient(Pool poolAttr, String regionName, 
Properties dsProperties, Boolean addControlListener) throws Exception {
        createCacheClient(poolAttr, regionName, dsProperties, 
addControlListener, null);
   }
   
-  public static void createCacheClient(Pool poolAttr, String regionName,
-      Properties dsProperties, Boolean addControlListener, Properties 
javaSystemProperties) throws Exception {                 
-      new CacheServerTestUtil("temp").createCache(dsProperties);
-      
IgnoredException.addIgnoredException("java.net.ConnectException||java.net.SocketException");
-      
-      if (javaSystemProperties != null && javaSystemProperties.size() > 0) {
-       Enumeration e = javaSystemProperties.propertyNames();
+  public static void createCacheClient(Pool poolAttr, String regionName, 
Properties dsProperties, Boolean addControlListener, Properties 
javaSystemProperties) throws Exception {
+    new CacheServerTestUtil().createCache(dsProperties);
+    
IgnoredException.addIgnoredException("java.net.ConnectException||java.net.SocketException");
 
-        while (e.hasMoreElements()) {
-          String key = (String) e.nextElement();
-          System.setProperty(key, javaSystemProperties.getProperty(key));
-        }
-         }
-      
-      PoolFactoryImpl pf = (PoolFactoryImpl)PoolManager.createFactory();
-      pf.init(poolAttr);
-      PoolImpl p = (PoolImpl)pf.create("CacheServerTestUtil");
-      AttributesFactory factory = new AttributesFactory();
-      factory.setScope(Scope.LOCAL);
-      factory.setPoolName(p.getName());
-      if (addControlListener.booleanValue()) {
-        factory.addCacheListener(new ControlListener());
+    if (javaSystemProperties != null && javaSystemProperties.size() > 0) {
+      Enumeration e = javaSystemProperties.propertyNames();
+
+      while (e.hasMoreElements()) {
+        String key = (String) e.nextElement();
+        System.setProperty(key, javaSystemProperties.getProperty(key));
       }
-      RegionAttributes attrs = factory.create();
-      cache.createRegion(regionName, attrs);
-      pool = p;
     }
+
+    PoolFactoryImpl pf = (PoolFactoryImpl)PoolManager.createFactory();
+    pf.init(poolAttr);
+    PoolImpl p = (PoolImpl)pf.create("CacheServerTestUtil");
+    AttributesFactory factory = new AttributesFactory();
+    factory.setScope(Scope.LOCAL);
+    factory.setPoolName(p.getName());
+    if (addControlListener.booleanValue()) {
+      factory.addCacheListener(new ControlListener());
+    }
+    RegionAttributes attrs = factory.create();
+    cache.createRegion(regionName, attrs);
+    pool = p;
+  }
   
   public static void unsetJavaSystemProperties(Properties 
javaSystemProperties) {
        if (javaSystemProperties != null && javaSystemProperties.size() > 0) {
@@ -195,10 +176,8 @@ public class CacheServerTestUtil extends 
DistributedTestCase
          }
   }
   
-  public static void createCacheClient(Pool poolAttr, String regionName1,
-      String regionName2) throws Exception
-  {
-    new CacheServerTestUtil("temp").createCache(getClientProperties());
+  public static void createCacheClient(Pool poolAttr, String regionName1, 
String regionName2) throws Exception {
+    new CacheServerTestUtil().createCache(getClientProperties());
     PoolFactoryImpl pf = (PoolFactoryImpl)PoolManager.createFactory();
     pf.init(poolAttr);
     PoolImpl p = (PoolImpl)pf.create("CacheServerTestUtil");
@@ -286,10 +265,8 @@ public class CacheServerTestUtil extends 
DistributedTestCase
   /**
    * Create client regions
    */
-  public static void createCacheClients(Pool poolAttr, String regionName1,
-      String regionName2, Properties dsProperties) throws Exception
-  {
-    new CacheServerTestUtil("temp").createCache(dsProperties);
+  public static void createCacheClients(Pool poolAttr, String regionName1, 
String regionName2, Properties dsProperties) throws Exception {
+    new CacheServerTestUtil().createCache(dsProperties);
 
     // Initialize region1
     PoolFactoryImpl pf = (PoolFactoryImpl)PoolManager.createFactory();
@@ -308,29 +285,25 @@ public class CacheServerTestUtil extends 
DistributedTestCase
     cache.createRegion(regionName2, factory2.create());
   }
 
-  private static Properties getClientProperties()
-  {
+  private static Properties getClientProperties() {
     Properties props = new Properties();
     props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
     props.setProperty(DistributionConfig.LOCATORS_NAME, "");
     return props;
   }
   
-  private static Properties getClientProperties(boolean durable)
-  {
+  private static Properties getClientProperties(boolean durable) {
     Properties props = new Properties();
     props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
     props.setProperty(DistributionConfig.LOCATORS_NAME, "");
     return props;
   }
 
-  public static Integer createCacheServer(String regionName,
-      Boolean notifyBySubscription) throws Exception
-  {
+  public static Integer createCacheServer(String regionName, Boolean 
notifyBySubscription) throws Exception {
     Properties props = new Properties();
     props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
     props.setProperty(DistributionConfig.LOCATORS_NAME, 
"localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
-    new CacheServerTestUtil("temp").createCache(props);
+    new CacheServerTestUtil().createCache(props);
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.DISTRIBUTED_ACK);
     factory.setEnableBridgeConflation(true);
@@ -345,14 +318,11 @@ public class CacheServerTestUtil extends 
DistributedTestCase
     return new Integer(server1.getPort());
   }
 
-  public static Integer[] createCacheServerReturnPorts(String regionName,
-      Boolean notifyBySubscription) throws Exception
-  {
+  public static Integer[] createCacheServerReturnPorts(String regionName, 
Boolean notifyBySubscription) throws Exception {
     Properties props = new Properties();
-//    int mcastPort = 
AvailablePort.getRandomAvailablePort(AvailablePort.JGROUPS);
     props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
     props.setProperty(DistributionConfig.LOCATORS_NAME, 
"localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
-    new CacheServerTestUtil("temp").createCache(props);
+    new CacheServerTestUtil().createCache(props);
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.DISTRIBUTED_ACK);
     factory.setEnableBridgeConflation(true);
@@ -367,13 +337,11 @@ public class CacheServerTestUtil extends 
DistributedTestCase
     return new Integer[] {port, 0};
   }
 
-  public static void createCacheServer(String regionName,
-      Boolean notifyBySubscription, Integer serverPort)
-      throws Exception {
+  public static void createCacheServer(String regionName, Boolean 
notifyBySubscription, Integer serverPort) throws Exception {
     Properties props = new Properties();
     props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
     props.setProperty(DistributionConfig.LOCATORS_NAME, 
"localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
-    new CacheServerTestUtil("temp").createCache(props);
+    new CacheServerTestUtil().createCache(props);
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.DISTRIBUTED_ACK);
     factory.setEnableBridgeConflation(true);
@@ -386,10 +354,8 @@ public class CacheServerTestUtil extends 
DistributedTestCase
     server.start();
   }
 
-  public static Integer createCacheServer(String regionName1,
-      String regionName2, Boolean notifyBySubscription) throws Exception
-  {
-    new CacheServerTestUtil("temp").createCache(new Properties());
+  public static Integer createCacheServer(String regionName1, String 
regionName2, Boolean notifyBySubscription) throws Exception {
+    new CacheServerTestUtil().createCache(new Properties());
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.DISTRIBUTED_ACK);
     factory.setEnableBridgeConflation(true);
@@ -409,8 +375,7 @@ public class CacheServerTestUtil extends DistributedTestCase
     return new Integer(server1.getPort());
   }
 
-  private void createCache(Properties props) throws Exception
-  {
+  private void createCache(Properties props) throws Exception {
     DistributedSystem ds = getSystem(props);
     assertNotNull(ds);
     ds.disconnect();
@@ -419,8 +384,7 @@ public class CacheServerTestUtil extends DistributedTestCase
     assertNotNull(cache);
   }
 
-  private void createClientCache(Properties props, ClientCacheFactory ccf) 
throws Exception
-  {
+  private void createClientCache(Properties props, ClientCacheFactory ccf) 
throws Exception {
     DistributedSystem ds = getSystem(props);
     assertNotNull(ds);
     ds.disconnect();
@@ -431,8 +395,7 @@ public class CacheServerTestUtil extends DistributedTestCase
     expected = 
IgnoredException.addIgnoredException("java.net.ConnectionException||java.net.SocketException");
   }
 
-  public static void closeCache()
-  {
+  public static void closeCache() {
     if (expected != null) {
       expected.remove();
       expected = null;
@@ -443,8 +406,7 @@ public class CacheServerTestUtil extends DistributedTestCase
     }
   }
 
-  public static void closeCache(boolean keepalive)
-  {
+  public static void closeCache(boolean keepalive) {
     if (expected != null) {
       expected.remove();
       expected = null;
@@ -459,18 +421,15 @@ public class CacheServerTestUtil extends 
DistributedTestCase
     cache = null;
   }
   
-  public static void setClientCrash(boolean crashOnClose)
-  {
+  public static void setClientCrash(boolean crashOnClose) {
     
com.gemstone.gemfire.cache.client.internal.ConnectionImpl.setTEST_DURABLE_CLIENT_CRASH(crashOnClose);
   }
   
-  public static void disconnectClient()
-  {
+  public static void disconnectClient() {
     pool.endpointsNetDownForDUnitTest();
   }
   
-  public static void reconnectClient()
-  {
+  public static void reconnectClient() {
     if(pool != null) {
       pool.endpointsNetUpForDUnitTest();
     }
@@ -498,32 +457,28 @@ public class CacheServerTestUtil extends 
DistributedTestCase
     }
   }
 
-  public static Cache getCache()
-  {
+  public static Cache getCache() {
     return cache;
   }
 
-  public static PoolImpl getPool()
-  {
+  public static PoolImpl getPool() {
     return pool;
   }
 
   /**
    * Disables the shuffling of endpoints for a client
-   *
    */
-  public static void disableShufflingOfEndpoints()
-  {
+  public static void disableShufflingOfEndpoints() {
     // TODO DISABLE_RANDOM doesn't seem to be used anywhere
     System.setProperty("gemfire.PoolImpl.DISABLE_RANDOM", "true");
     System.setProperty("gemfire.bridge.disableShufflingOfEndpoints", "true");
   }
+
   /**
    * Enables the shuffling of endpoints for a client
    * @since 5.7
    */
-  public static void enableShufflingOfEndpoints()
-  {
+  public static void enableShufflingOfEndpoints() {
     // TODO DISABLE_RANDOM doesn't seem to be used anywhere
     System.setProperty("gemfire.PoolImpl.DISABLE_RANDOM", "false");
     System.setProperty("gemfire.bridge.disableShufflingOfEndpoints", "false");
@@ -531,10 +486,8 @@ public class CacheServerTestUtil extends 
DistributedTestCase
 
   /**
    * Resets the 'disableShufflingOfEndpoints' flag
-   * 
    */
-  public static void resetDisableShufflingOfEndpointsFlag()
-  {
+  public static void resetDisableShufflingOfEndpointsFlag() {
     System.setProperty("gemfire.bridge.disableShufflingOfEndpoints", "false");
   }
   
@@ -551,6 +504,7 @@ public class CacheServerTestUtil extends DistributedTestCase
       this.arg = ee.getCallbackArgument();
       this.type = type;
     }
+    @Override
     public String toString() {
       return "EventWrapper: event=" + event + ", type=" + type;
     }
@@ -583,6 +537,7 @@ public class CacheServerTestUtil extends DistributedTestCase
       } // synchronized
     }
 
+    @Override
     public void afterCreate(EntryEvent e) {
       synchronized(this.CONTROL_LOCK) {
         this.events.add(new EventWrapper(e, TYPE_CREATE));
@@ -590,6 +545,7 @@ public class CacheServerTestUtil extends DistributedTestCase
       }
     }
 
+    @Override
     public void afterUpdate(EntryEvent e) {
       synchronized(this.CONTROL_LOCK) {
         this.events.add(new EventWrapper(e, TYPE_UPDATE));
@@ -597,6 +553,7 @@ public class CacheServerTestUtil extends DistributedTestCase
       }
     }
 
+    @Override
     public void afterInvalidate(EntryEvent e) {
       synchronized(this.CONTROL_LOCK) {
         this.events.add(new EventWrapper(e, TYPE_INVALIDATE));
@@ -604,6 +561,7 @@ public class CacheServerTestUtil extends DistributedTestCase
       }
     }
 
+    @Override
     public void afterDestroy(EntryEvent e) {
       synchronized(this.CONTROL_LOCK) {
         this.events.add(new EventWrapper(e, TYPE_DESTROY));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e80bd5a2/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientCrashDUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientCrashDUnitTest.java
 
b/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientCrashDUnitTest.java
index 58f2cf4..115cd30 100755
--- 
a/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientCrashDUnitTest.java
+++ 
b/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientCrashDUnitTest.java
@@ -16,39 +16,29 @@
  */
 package com.gemstone.gemfire.internal.cache.tier.sockets;
 
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
 import static org.junit.Assert.*;
 
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.cache.CacheException;
 import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
 /**
  * Class <code>DurableClientCrashDUnitTest</code> tests durable client
  * functionality when clients crash.
- * 
- * 
+ *
  * @since 5.2
  */
 @Category(DistributedTest.class)
 public class DurableClientCrashDUnitTest extends DurableClientTestCase {
 
-  public DurableClientCrashDUnitTest() {
-    super();
-  }
-
   @Override
   protected final void postSetUpDurableClientTestCase() throws Exception {
     configureClientStop1();
   }
   
-  public void configureClientStop1()
-  {
+  public void configureClientStop1() {
     this.durableClientVM.invoke(() -> CacheServerTestUtil.setClientCrash(new 
Boolean(true)));    
   }
   
@@ -57,11 +47,11 @@ public class DurableClientCrashDUnitTest extends 
DurableClientTestCase {
     configureClientStop2();
   }
   
-  public void configureClientStop2()
-  {
+  public void configureClientStop2() {
     this.durableClientVM.invoke(() -> CacheServerTestUtil.setClientCrash(new 
Boolean(false)));    
   }
-  
+
+  @Override
   public void verifySimpleDurableClient() {
     this.server1VM
         .invoke(new CacheSerializableRunnable("Verify durable client") {
@@ -73,9 +63,9 @@ public class DurableClientCrashDUnitTest extends 
DurableClientTestCase {
           }
         });
   }
-  
-  public void verifySimpleDurableClientMultipleServers() 
-  {
+
+  @Override
+  public void verifySimpleDurableClientMultipleServers()  {
     // Verify the durable client is no longer on server1
     this.server1VM
         .invoke(new CacheSerializableRunnable("Verify durable client") {
@@ -98,13 +88,4 @@ public class DurableClientCrashDUnitTest extends 
DurableClientTestCase {
           }
         });
   }
-  
-  // AB: Following tests are not relevant for client crash case.
-  
-  @Test
-  public void testCqCloseExceptionDueToActiveConnection() throws Exception {}
-
-  @Test
-  public void testCloseCacheProxy() throws Exception {}
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e80bd5a2/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientNetDownDUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientNetDownDUnitTest.java
 
b/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientNetDownDUnitTest.java
index 277de4f..d6d71f5 100644
--- 
a/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientNetDownDUnitTest.java
+++ 
b/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientNetDownDUnitTest.java
@@ -17,71 +17,68 @@
 package com.gemstone.gemfire.internal.cache.tier.sockets;
 
 import org.junit.experimental.categories.Category;
-import org.junit.Test;
 
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
-
 /**
  * Class <code>DurableClientCrashDUnitTest</code> tests durable client
  * functionality when clients are disconnected from servers.
  * 
- * 
  * @since 5.2
  */
 @Category(DistributedTest.class)
 public class DurableClientNetDownDUnitTest extends DurableClientCrashDUnitTest 
{
 
-  public DurableClientNetDownDUnitTest() {
-    super();
-  }
-  
   @Override
   protected final void preTearDownDurableClientTestCase() throws Exception {
     //ensure that the test flag is no longer set in this vm
     this.durableClientVM.invoke(() -> CacheServerTestUtil.reconnectClient());
   }
 
-  public void setPrimaryRecoveryCheck() {}
-  
-  public void checkPrimaryRecovery() {}
-  
-  public void configureClientStop1() {}
-  
-  public void configureClientStop2() {}
-  
-  public void closeDurableClient()
-  {
+  @Override
+  public void setPrimaryRecoveryCheck() {
+  }
+
+  @Override
+  public void checkPrimaryRecovery() {
+  }
+
+  @Override
+  public void configureClientStop1() {
+  }
+
+  @Override
+  public void configureClientStop2() {
+  }
+
+  @Override
+  public void closeDurableClient() {
     this.durableClientVM.invoke(() -> CacheServerTestUtil.reconnectClient());
     this.durableClientVM.invoke(() -> CacheServerTestUtil.closeCache());
   }
-  
-  public void disconnectDurableClient()
-  {
+
+  @Override
+  public void disconnectDurableClient() {
     this.durableClientVM.invoke(() -> CacheServerTestUtil.disconnectClient());
   }
 
-  public void disconnectDurableClient(boolean keepAlive)
-  {
+  @Override
+  public void disconnectDurableClient(boolean keepAlive) {
     this.disconnectDurableClient();
   }
-  
-  public void restartDurableClient(Object[] args)
-  {
+
+  @Override
+  public void restartDurableClient(Object[] args) {
     this.durableClientVM.invoke(() -> CacheServerTestUtil.reconnectClient());  
   }
-  
-  public void verifyListenerUpdatesDisconnected(int numberOfEntries)
-  {
+
+  @Override
+  public void verifyListenerUpdatesDisconnected(int numberOfEntries) {
     this.verifyListenerUpdates(numberOfEntries);
   }
 
-  public void verifyListenerUpdates(int numEntries, int 
numEntriesBeforeDisconnect)
-  {
+  @Override
+  public void verifyListenerUpdates(int numEntries, int 
numEntriesBeforeDisconnect) {
     this.verifyListenerUpdatesEntries(numEntries, numEntriesBeforeDisconnect);
   }
   

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e80bd5a2/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientSimpleDUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientSimpleDUnitTest.java
 
b/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientSimpleDUnitTest.java
index e77b3ab..548ec9f 100644
--- 
a/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientSimpleDUnitTest.java
+++ 
b/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientSimpleDUnitTest.java
@@ -16,18 +16,12 @@
  */
 package com.gemstone.gemfire.internal.cache.tier.sockets;
 
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
 import static org.junit.Assert.*;
 
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
 import java.util.Iterator;
 
 import org.junit.Ignore;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.cache.CacheException;
@@ -54,21 +48,18 @@ import com.gemstone.gemfire.internal.cache.PoolFactoryImpl;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.test.dunit.Assert;
 import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.IgnoredException;
 import com.gemstone.gemfire.test.dunit.LogWriterUtils;
 import com.gemstone.gemfire.test.dunit.NetworkUtils;
 import com.gemstone.gemfire.test.dunit.VM;
 import com.gemstone.gemfire.test.dunit.Wait;
 import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 import com.gemstone.gemfire.test.junit.categories.FlakyTest;
 
 @Category(DistributedTest.class)
 public class DurableClientSimpleDUnitTest extends DurableClientTestCase {
 
-  public DurableClientSimpleDUnitTest() {
-    super();
-  }
   /**
    * Test that a durable client correctly receives updates.
    */
@@ -397,8 +388,9 @@ public class DurableClientSimpleDUnitTest extends 
DurableClientTestCase {
    * Test that starting a durable client on multiple servers (one live and one
    * not live) is processed correctly.
    */
-  @Ignore("Disabled for bug 52043")
-  public void DISABLED_testDurableClientMultipleServersOneLive() {
+  @Ignore("TODO: Disabled for bug 52043")
+  @Test
+  public void testDurableClientMultipleServersOneLive() {
     // Start server 1
     final int server1Port = ((Integer) this.server1VM.invoke(() -> 
CacheServerTestUtil.createCacheServer(regionName, new Boolean(true))))
         .intValue();
@@ -1095,10 +1087,12 @@ public class DurableClientSimpleDUnitTest extends 
DurableClientTestCase {
     // Stop the server
     this.server1VM.invoke(() -> CacheServerTestUtil.closeCache());
   }
-  
-  //This test method is disabled because it is failing
-  //periodically and causing cruise control failures
-  //See bug #47060
+
+  /**
+   * This test method is disabled because it is failing
+   * periodically and causing cruise control failures
+   * See bug #47060 (test seems to be enabled now!)
+   */
   @Test
   public void testReadyForEventsNotCalledImplicitlyWithCacheXML() {
     try {
@@ -1621,7 +1615,6 @@ public class DurableClientSimpleDUnitTest extends 
DurableClientTestCase {
     // Stop the server
     this.server1VM.invoke(() -> CacheServerTestUtil.closeCache());
   }
-  
 
   /**
    * Tests the ha queued events stat
@@ -1883,9 +1876,7 @@ public class DurableClientSimpleDUnitTest extends 
DurableClientTestCase {
     // Stop the server
     this.server1VM.invoke(() -> CacheServerTestUtil.closeCache());
   }
-  /**
-   * @throws Exception
-   */
+
   @Test
   public void testHAQueuedCqStatOnSecondary() throws Exception {
     String greaterThan5Query = "select * from /" + regionName + " p where p.ID 
> 5";
@@ -1972,8 +1963,7 @@ public class DurableClientSimpleDUnitTest extends 
DurableClientTestCase {
     // Stop the server
     this.server1VM.invoke(() -> CacheServerTestUtil.closeCache());
   }
-  
-  
+
   /**
    * Server 2 comes up, client connects and registers cqs, server 2 then 
disconnects
    * events are put into region
@@ -1983,8 +1973,6 @@ public class DurableClientSimpleDUnitTest extends 
DurableClientTestCase {
    * server 1 goes away
    * client comes back and receives all events
    * stats should still be correct
-   * 
-   * @throws Exception
    */
   @Test
   public void testHAQueuedCqStatForGII() throws Exception {
@@ -2075,7 +2063,6 @@ public class DurableClientSimpleDUnitTest extends 
DurableClientTestCase {
     // Stop the servers
     this.server2VM.invoke(() -> CacheServerTestUtil.closeCache());
   }
-  
 
   /**
    * Start both servers, but shut down secondary server before durable client 
has
@@ -2174,6 +2161,7 @@ public class DurableClientSimpleDUnitTest extends 
DurableClientTestCase {
     this.server1VM.invoke(() -> CacheServerTestUtil.closeCache());
     this.server2VM.invoke(() -> CacheServerTestUtil.closeCache());
   }
+
   /**
    * Server 2 comes up and goes down after client connects and registers cqs
    * events are put into region
@@ -2182,8 +2170,6 @@ public class DurableClientSimpleDUnitTest extends 
DurableClientTestCase {
    * check stats
    * client comes back and receives all events
    * stats should still be correct
-   * 
-   * @throws Exception
    */
   @Test
   public void testHAQueuedCqStatForGIINoFailover() throws Exception {
@@ -2281,7 +2267,6 @@ public class DurableClientSimpleDUnitTest extends 
DurableClientTestCase {
    * server 1 goes down
    * dc reconnects
    * server 2 behaves accordingly
-   * @throws Exception
    */
   @Test
   public void testHAQueuedCqStatForFailover() throws Exception {
@@ -2368,7 +2353,6 @@ public class DurableClientSimpleDUnitTest extends 
DurableClientTestCase {
     this.server2VM.invoke(() -> CacheServerTestUtil.closeCache());
   }
   
-  
   /**
    * Tests the ha queued cq stat
    */
@@ -2453,9 +2437,9 @@ public class DurableClientSimpleDUnitTest extends 
DurableClientTestCase {
     // Stop the server
     this.server1VM.invoke(() -> CacheServerTestUtil.closeCache());
   }
+
   /**
    * Test functionality to close the cq and drain all events from the ha queue 
from the server
-   * @throws Exception
    */
   @Test
   public void testCloseCqAndDrainEvents() throws Exception {
@@ -2626,7 +2610,6 @@ public class DurableClientSimpleDUnitTest extends 
DurableClientTestCase {
    * Test functionality to close the cq and drain all events from the ha queue 
from the server
    * This draining should remove all events due to no interest registered
    * Continues to publish afterwards to verify that stats are correct
-   * @throws Exception
    */
   @Test
   public void testCloseAllCqsAndDrainEventsNoInterestRegistered() throws 
Exception {
@@ -2733,11 +2716,9 @@ public class DurableClientSimpleDUnitTest extends 
DurableClientTestCase {
     this.server1VM.invoke(() -> CacheServerTestUtil.closeCache());
   }
   
-  
   /**
    * Test functionality to close the cq and drain all events from the ha queue 
from the server
    * Two durable clients, one will have a cq be closed, the other should be 
unaffected
-   * @throws Exception
    */
   @Test
   public void testCloseCqAndDrainEvents2Client() throws Exception {
@@ -2856,7 +2837,6 @@ public class DurableClientSimpleDUnitTest extends 
DurableClientTestCase {
   /**
    * Tests situation where a client is trying to reconnect while a cq is being 
drained.
    * The client should be rejected until no cqs are currently being drained
-   * @throws Exception
    */
   @Test
   public void testRejectClientWhenDrainingCq() throws Exception {
@@ -2980,7 +2960,6 @@ public class DurableClientSimpleDUnitTest extends 
DurableClientTestCase {
   /**
    * Tests scenario where close cq will throw an exception due to a client
    * being reactivated
-   * @throws Exception
    */
   @Category(FlakyTest.class) // GEODE-1060: random ports, async actions, time 
sensitive, eats exceptions (fixed 1)
   @Test
@@ -3082,7 +3061,6 @@ public class DurableClientSimpleDUnitTest extends 
DurableClientTestCase {
   
   /**
    * Tests situation where a client is trying to reconnect while a cq is being 
drained
-   * @throws Exception
    */
   @Test
   public void testCqCloseExceptionDueToActiveConnection() throws Exception {
@@ -3153,12 +3131,10 @@ public class DurableClientSimpleDUnitTest extends 
DurableClientTestCase {
     // Stop the server
     this.server1VM.invoke(() -> CacheServerTestUtil.closeCache());
   }
-  
-  
+
   /**
    * Test functionality to close the durable client 
    * and drain all events from the ha queue from the server
-   * @throws Exception
    */
   @Test
   public void testCloseCacheProxy() throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e80bd5a2/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientTestCase.java
----------------------------------------------------------------------
diff --git 
a/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientTestCase.java
 
b/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientTestCase.java
index a0c50ec..29ddf94 100755
--- 
a/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientTestCase.java
+++ 
b/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientTestCase.java
@@ -16,15 +16,8 @@
  */
 package com.gemstone.gemfire.internal.cache.tier.sockets;
 
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
 import static org.junit.Assert.*;
 
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
@@ -33,9 +26,10 @@ import java.util.Properties;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
-import org.junit.Ignore;
-
 import junit.framework.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.cache.CacheException;
 import com.gemstone.gemfire.cache.InterestResultPolicy;
@@ -58,44 +52,40 @@ import 
com.gemstone.gemfire.cache.query.internal.cq.CqService;
 import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.distributed.internal.ServerLocation;
+import com.gemstone.gemfire.internal.cache.CacheServerImpl;
 import com.gemstone.gemfire.internal.cache.ClientServerObserver;
 import com.gemstone.gemfire.internal.cache.ClientServerObserverAdapter;
 import com.gemstone.gemfire.internal.cache.ClientServerObserverHolder;
-import com.gemstone.gemfire.internal.cache.CacheServerImpl;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 import com.gemstone.gemfire.internal.cache.InternalCache;
 import com.gemstone.gemfire.internal.cache.PoolFactoryImpl;
 import com.gemstone.gemfire.internal.cache.ha.HARegionQueue;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.IgnoredException;
 import com.gemstone.gemfire.test.dunit.NetworkUtils;
 import com.gemstone.gemfire.test.dunit.VM;
 import com.gemstone.gemfire.test.dunit.Wait;
 import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
 /**
  * Class <code>DurableClientTestCase</code> tests durable client
  * functionality.
- * 
- * 
+ *
  * @since 5.2
  */ 
 @Category(DistributedTest.class)
 public class DurableClientTestCase extends JUnit4DistributedTestCase {
 
+  protected static volatile boolean isPrimaryRecovered = false;
+
   protected VM server1VM;
   protected VM server2VM;
   protected VM durableClientVM;
   protected VM publisherClientVM;
   protected String regionName;
   
-  protected static volatile boolean isPrimaryRecovered = false;
-
-  public DurableClientTestCase() {
-    super();
-  }
-
   @Override
   public final void postSetUp() throws Exception {
     Host host = Host.getHost(0);
@@ -1068,16 +1058,16 @@ public class DurableClientTestCase extends 
JUnit4DistributedTestCase {
     this.server1VM.invoke(() -> CacheServerTestUtil.closeCache());
   }
 
-  @Ignore("This test is failing inconsistently, see bug 51258")
-  public void DISABLED_testDurableNonHAFailover() throws InterruptedException
-  {
-      durableFailover(0);
-      durableFailoverAfterReconnect(0);   
+  @Ignore("TODO: This test is failing inconsistently, see bug 51258")
+  @Test
+  public void testDurableNonHAFailover() throws InterruptedException {
+    durableFailover(0);
+    durableFailoverAfterReconnect(0);
   }
 
-  @Ignore("This test is failing inconsistently, see bug 51258")
-  public void DISABLED_testDurableHAFailover() throws InterruptedException
-  {
+  @Ignore("TODO: This test is failing inconsistently, see bug 51258")
+  @Test
+  public void testDurableHAFailover() throws InterruptedException {
     //Clients see this when the servers disconnect
     IgnoredException.addIgnoredException("Could not find any server");
     durableFailover(1);


Reply via email to