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/01/26 01:49:19 UTC
[09/27] incubator-geode git commit: GEODE 773 rough draft
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e2f18f97/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java
index 8d3b9ab..2be9993 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java
@@ -41,11 +41,15 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.CacheServerImpl;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.NetworkSupport;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
import java.util.Iterator;
import java.util.Properties;
@@ -142,7 +146,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
public void testConcurrentOperationsWithDRandPR() throws Exception {
int port1 = initServerCache(true); // vm0
int port2 = initServerCache2(true); // vm1
- String serverName = getServerHostName(Host.getHost(0));
+ String serverName = NetworkSupport.getServerHostName(Host.getHost(0));
host.getVM(2).invoke(this.getClass(), "createClientCacheV", new Object[]{serverName, port1});
host.getVM(3).invoke(this.getClass(), "createClientCacheV", new Object[]{serverName, port2});
getLogWriter().info("Testing concurrent map operations from a client with a distributed region");
@@ -156,7 +160,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
public void testConcurrentOperationsWithDRandPRandEmptyClient() throws Exception {
int port1 = initServerCache(true); // vm0
int port2 = initServerCache2(true); // vm1
- String serverName = getServerHostName(Host.getHost(0));
+ String serverName = NetworkSupport.getServerHostName(Host.getHost(0));
host.getVM(2).invoke(this.getClass(), "createEmptyClientCache", new Object[]{serverName, port1});
host.getVM(3).invoke(this.getClass(), "createClientCacheV", new Object[]{serverName, port2});
getLogWriter().info("Testing concurrent map operations from a client with a distributed region");
@@ -374,7 +378,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
{
// start server first
PORT1 = initServerCache(true);
- createClientCache(getServerHostName(Host.getHost(0)), PORT1);
+ createClientCache(NetworkSupport.getServerHostName(Host.getHost(0)), PORT1);
populateCache();
registerInterest();
server1.invoke(ClientServerMiscDUnitTest.class, "put");
@@ -407,11 +411,11 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
{
// start server first
PORT1 = initServerCache(true);
- createClientCache(getServerHostName(Host.getHost(0)), PORT1);
+ createClientCache(NetworkSupport.getServerHostName(Host.getHost(0)), PORT1);
populateCache();
registerInterestInBothTheRegions();
closeRegion1();
- pause(6000);
+ Wait.pause(6000);
server1.invoke(ClientServerMiscDUnitTest.class,
"verifyInterestListOnServer");
server1.invoke(ClientServerMiscDUnitTest.class, "put");
@@ -430,7 +434,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
{
// start server first
PORT1 = initServerCache(true);
- pool = (PoolImpl)createClientCache(getServerHostName(Host.getHost(0)),PORT1);
+ pool = (PoolImpl)createClientCache(NetworkSupport.getServerHostName(Host.getHost(0)),PORT1);
populateCache();
registerInterestInBothTheRegions();
closeBothRegions();
@@ -457,7 +461,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
public void testCCPDestroyOnLastDestroyRegion() throws Exception
{
PORT1 = initServerCache(true);
- PoolImpl pool = (PoolImpl)createClientCache(getServerHostName(Host.getHost(0)),PORT1);
+ PoolImpl pool = (PoolImpl)createClientCache(NetworkSupport.getServerHostName(Host.getHost(0)),PORT1);
destroyRegion1();
// pause(5000);
server1.invoke(ClientServerMiscDUnitTest.class,
@@ -494,7 +498,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
{
// start server first
PORT1 = initServerCache(false);
- createClientCache(getServerHostName(Host.getHost(0)), PORT1);
+ createClientCache(NetworkSupport.getServerHostName(Host.getHost(0)), PORT1);
registerInterestForInvalidatesInBothTheRegions();
populateCache();
server1.invoke(ClientServerMiscDUnitTest.class, "put");
@@ -515,7 +519,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
{
// start server first
PORT1 = initServerCache(false);
- createClientCache(getServerHostName(Host.getHost(0)), PORT1);
+ createClientCache(NetworkSupport.getServerHostName(Host.getHost(0)), PORT1);
registerInterestForInvalidatesInBothTheRegions();
Region region = static_cache.getRegion(REGION_NAME1);
populateCache();
@@ -561,7 +565,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, "");
new ClientServerMiscDUnitTest("temp").createCache(props);
- String host = getServerHostName(server1.getHost());
+ String host = NetworkSupport.getServerHostName(server1.getHost());
PoolImpl p = (PoolImpl)PoolManager.createFactory()
.addServer(host, PORT1)
.setSubscriptionEnabled(true)
@@ -601,7 +605,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
// assertEquals(region1.getEntry(k1).getValue(), k1);
wc = new WaitCriterion() {
@@ -614,7 +618,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
wc = new WaitCriterion() {
String excuse;
@@ -626,7 +630,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
// assertEquals(region1.getEntry(k2).getValue(), k2);
// assertEquals(region2.getEntry(k1).getValue(), k1);
@@ -640,7 +644,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
// assertEquals(region2.getEntry(k2).getValue(), k2);
}
@@ -664,7 +668,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
ds.disconnect();
ds = getSystem(props);
PORT1 = initServerCache(true);
- String host = getServerHostName(server1.getHost());
+ String host = NetworkSupport.getServerHostName(server1.getHost());
Pool p = PoolManager.createFactory()
.addServer(host, PORT1)
.setSubscriptionEnabled(true)
@@ -686,7 +690,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
assertNotNull(region2);
//region1.registerInterest(CacheClientProxy.ALL_KEYS);
region2.registerInterest("ALL_KEYS");
- pause(6000);
+ Wait.pause(6000);
server1.invoke(ClientServerMiscDUnitTest.class,
"verifyInterestListOnServer");
@@ -707,7 +711,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
public void testBug35380() throws Exception
{
//work around GEODE-477
- addExpectedException("Connection reset");
+ IgnoredException.addIgnoredException("Connection reset");
Properties props = new Properties();
props.setProperty("mcast-port", "0");
props.setProperty("locators", "");
@@ -715,7 +719,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
assertNotNull(ds);
PORT1 = initServerCache(true);
- String host = getServerHostName(server1.getHost());
+ String host = NetworkSupport.getServerHostName(server1.getHost());
Pool p = PoolManager.createFactory()
.addServer(host, PORT1)
.setSubscriptionEnabled(true)
@@ -849,7 +853,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
return p;
}
@@ -900,7 +904,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
}
catch (CacheWriterException e) {
e.printStackTrace();
- fail("Test failed due to CacheWriterException during registerInterest", e);
+ Assert.fail("Test failed due to CacheWriterException during registerInterest", e);
}
}
@@ -917,7 +921,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
}
catch (CacheWriterException e) {
e.printStackTrace();
- fail(
+ Assert.fail(
"Test failed due to CacheWriterException during registerInterestnBothRegions",
e);
}
@@ -936,7 +940,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
}
catch (CacheWriterException e) {
e.printStackTrace();
- fail(
+ Assert.fail(
"Test failed due to CacheWriterException during registerInterestnBothRegions",
e);
}
@@ -952,7 +956,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
}
catch (Exception e) {
e.printStackTrace();
- fail("Test failed due to Exception during closeRegion1", e);
+ Assert.fail("Test failed due to Exception during closeRegion1", e);
}
}
@@ -972,7 +976,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
}
catch (Exception e) {
e.printStackTrace();
- fail("Test failed due to Exception during closeBothRegions", e);
+ Assert.fail("Test failed due to Exception during closeBothRegions", e);
}
}
@@ -986,7 +990,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
}
catch (Exception e) {
e.printStackTrace();
- fail("Test failed due to Exception during closeBothRegions", e);
+ Assert.fail("Test failed due to Exception during closeBothRegions", e);
}
}
@@ -1000,7 +1004,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
}
catch (Exception e) {
e.printStackTrace();
- fail("Test failed due to Exception during closeBothRegions", e);
+ Assert.fail("Test failed due to Exception during closeBothRegions", e);
}
}
@@ -1012,7 +1016,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
r2.destroyRegion();
} catch (Exception e) {
// e.printStackTrace();
- fail("Test failed due to Exception during closeBothRegions", e);
+ Assert.fail("Test failed due to Exception during closeBothRegions", e);
}
}
@@ -1068,7 +1072,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 40 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 40 * 1000, 1000, true);
}
catch (Exception ex) {
ex.printStackTrace();
@@ -1113,7 +1117,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 40 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 40 * 1000, 1000, true);
}
catch (Exception ex) {
ex.printStackTrace();
@@ -1145,7 +1149,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
assertEquals(r2.getEntry(k2).getValue(), k2);
}
catch (Exception ex) {
- fail("failed while createEntries()", ex);
+ Assert.fail("failed while createEntries()", ex);
}
}
@@ -1170,7 +1174,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
assertEquals(r2.getEntry(k2).getValue(), server_k2);
}
catch (Exception ex) {
- fail("failed while put()", ex);
+ Assert.fail("failed while put()", ex);
}
}
@@ -1193,7 +1197,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
// assertEquals(k1, r1.getEntry(k1).getValue());
wc = new WaitCriterion() {
@@ -1206,7 +1210,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
// assertEquals(k2, r1.getEntry(k2).getValue());
wc = new WaitCriterion() {
@@ -1219,7 +1223,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
// assertEquals(server_k1, r2.getEntry(k1).getValue());
wc = new WaitCriterion() {
@@ -1232,12 +1236,12 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
// assertEquals(server_k2, r2.getEntry(k2).getValue());
}
catch (Exception ex) {
- fail("failed while verifyUpdates()", ex);
+ Assert.fail("failed while verifyUpdates()", ex);
}
}
@@ -1260,7 +1264,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 90 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 90 * 1000, 1000, true);
// assertNull(r1.getEntry(k1).getValue());
wc = new WaitCriterion() {
@@ -1273,7 +1277,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 90 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 90 * 1000, 1000, true);
// assertNull(r1.getEntry(k2).getValue());
wc = new WaitCriterion() {
@@ -1286,7 +1290,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 90 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 90 * 1000, 1000, true);
// assertNull(r2.getEntry(k1).getValue());
@@ -1300,7 +1304,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 90 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 90 * 1000, 1000, true);
// assertNull(r2.getEntry(k2).getValue());
wc = new WaitCriterion() {
@@ -1313,10 +1317,10 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 90 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 90 * 1000, 1000, true);
}
catch (Exception ex) {
- fail("failed while verifyInvalidatesOnBothRegions()", ex);
+ Assert.fail("failed while verifyInvalidatesOnBothRegions()", ex);
}
}
@@ -1336,7 +1340,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
// assertEquals(server_k1, r2.getEntry(k1).getValue());
wc = new WaitCriterion() {
@@ -1349,18 +1353,18 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
// assertEquals(server_k2, r2.getEntry(k2).getValue());
}
catch (Exception ex) {
- fail("failed while verifyUpdatesOnRegion2()", ex);
+ Assert.fail("failed while verifyUpdatesOnRegion2()", ex);
}
}
- public void tearDown2() throws Exception
+ public void tearDownBeforeDisconnect() throws Exception
{
- super.tearDown2();
+ super.tearDownBeforeDisconnect();
// close the clients first
closeCache();
// then close the servers
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e2f18f97/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ConflationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ConflationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ConflationDUnitTest.java
index fe5d03f..01f0b9b 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ConflationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ConflationDUnitTest.java
@@ -40,9 +40,13 @@ import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.HARegion;
import com.gemstone.gemfire.internal.cache.ha.HAHelper;
import com.gemstone.gemfire.internal.cache.ha.HARegionQueue;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.NetworkSupport;
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.cache.client.*;
import com.gemstone.gemfire.cache.client.internal.PoolImpl;
@@ -136,9 +140,9 @@ public class ConflationDUnitTest extends DistributedTestCase
{
try {
vm0.invoke(ConflationDUnitTest.class, "setIsSlowStart");
- createClientCache1UniqueWriter ( getServerHostName(Host.getHost(0)), new Integer(PORT));
+ createClientCache1UniqueWriter ( NetworkSupport.getServerHostName(Host.getHost(0)), new Integer(PORT));
vm2.invoke(ConflationDUnitTest.class, "createClientCache2UniqueWriter",
- new Object[] { getServerHostName(Host.getHost(0)), new Integer(PORT)});
+ new Object[] { NetworkSupport.getServerHostName(Host.getHost(0)), new Integer(PORT)});
vm2.invoke(ConflationDUnitTest.class, "setClientServerObserverForBeforeInterestRecovery");
vm2.invoke(ConflationDUnitTest.class, "setAllCountersZero");
vm2.invoke(ConflationDUnitTest.class, "assertAllCountersZero");
@@ -155,7 +159,7 @@ public class ConflationDUnitTest extends DistributedTestCase
vm2.invoke(ConflationDUnitTest.class, "assertCounterSizes");
}
catch( Exception e ) {
- fail("Test failed due to exception", e);
+ Assert.fail("Test failed due to exception", e);
}
}
@@ -167,9 +171,9 @@ public class ConflationDUnitTest extends DistributedTestCase
{
try {
vm0.invoke(ConflationDUnitTest.class, "setIsSlowStart");
- createClientCache1CommonWriter( getServerHostName(Host.getHost(0)), new Integer(PORT));
+ createClientCache1CommonWriter( NetworkSupport.getServerHostName(Host.getHost(0)), new Integer(PORT));
vm2.invoke(ConflationDUnitTest.class, "createClientCache2CommonWriter",
- new Object[] { getServerHostName(Host.getHost(0)), new Integer(PORT)});
+ new Object[] { NetworkSupport.getServerHostName(Host.getHost(0)), new Integer(PORT)});
vm2.invoke(ConflationDUnitTest.class, "setClientServerObserverForBeforeInterestRecovery");
vm2.invoke(ConflationDUnitTest.class, "setAllCountersZero");
vm2.invoke(ConflationDUnitTest.class, "assertAllCountersZero");
@@ -186,7 +190,7 @@ public class ConflationDUnitTest extends DistributedTestCase
vm2.invoke(ConflationDUnitTest.class, "assertCounterSizes");
}
catch( Exception e ) {
- fail("Test failed due to exception", e);
+ Assert.fail("Test failed due to exception", e);
}
}
@@ -199,10 +203,10 @@ public class ConflationDUnitTest extends DistributedTestCase
{
try {
vm0.invoke(ConflationDUnitTest.class, "setIsSlowStart");
- createClientCache1CommonWriterTest3(getServerHostName(Host.getHost(0)), new Integer(PORT));
+ createClientCache1CommonWriterTest3(NetworkSupport.getServerHostName(Host.getHost(0)), new Integer(PORT));
vm2.invoke(ConflationDUnitTest.class,
"createClientCache2CommonWriterTest3", new Object[] {
- getServerHostName(Host.getHost(0)), new Integer(PORT) });
+ NetworkSupport.getServerHostName(Host.getHost(0)), new Integer(PORT) });
vm2.invoke(ConflationDUnitTest.class, "setClientServerObserverForBeforeInterestRecovery");
vm2.invoke(ConflationDUnitTest.class, "setAllCountersZero");
vm2.invoke(ConflationDUnitTest.class, "assertAllCountersZero");
@@ -221,7 +225,7 @@ public class ConflationDUnitTest extends DistributedTestCase
vm0.invoke(ConflationDUnitTest.class, "assertConflationStatus");
}
catch (Exception e) {
- fail("Test failed due to exception", e);
+ Assert.fail("Test failed due to exception", e);
}
}
/**
@@ -518,7 +522,7 @@ public class ConflationDUnitTest extends DistributedTestCase
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
ev = new WaitCriterion() {
public boolean done() {
@@ -529,7 +533,7 @@ public class ConflationDUnitTest extends DistributedTestCase
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
ev = new WaitCriterion() {
public boolean done() {
@@ -540,7 +544,7 @@ public class ConflationDUnitTest extends DistributedTestCase
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
}
@@ -559,7 +563,7 @@ public class ConflationDUnitTest extends DistributedTestCase
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
// assertEquals("creates", 2, counterCreate);
ev = new WaitCriterion() {
@@ -571,7 +575,7 @@ public class ConflationDUnitTest extends DistributedTestCase
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
// assertEquals("destroys", 2, counterDestroy);
// assertTrue("updates", 20000 >= counterUpdate);
@@ -584,7 +588,7 @@ public class ConflationDUnitTest extends DistributedTestCase
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
}
public static void waitForMarker()
@@ -729,7 +733,7 @@ public class ConflationDUnitTest extends DistributedTestCase
}
catch (Exception ex) {
ex.printStackTrace();
- fail("failed while region.create()", ex);
+ Assert.fail("failed while region.create()", ex);
}
}
@@ -751,7 +755,7 @@ public class ConflationDUnitTest extends DistributedTestCase
}
catch (Exception ex) {
ex.printStackTrace();
- fail("failed while region.put()", ex);
+ Assert.fail("failed while region.put()", ex);
}
}
@@ -765,7 +769,7 @@ public class ConflationDUnitTest extends DistributedTestCase
}
catch (Exception ex) {
ex.printStackTrace();
- fail("failed while region.create() marker", ex);
+ Assert.fail("failed while region.create() marker", ex);
}
}
@@ -788,7 +792,7 @@ public class ConflationDUnitTest extends DistributedTestCase
}
catch (Exception ex) {
ex.printStackTrace();
- fail("failed while region.put()", ex);
+ Assert.fail("failed while region.put()", ex);
}
}
@@ -835,7 +839,7 @@ public class ConflationDUnitTest extends DistributedTestCase
}
catch (Exception ex) {
ex.printStackTrace();
- fail("failed while region.get()", ex);
+ Assert.fail("failed while region.get()", ex);
}
}
@@ -903,7 +907,7 @@ public class ConflationDUnitTest extends DistributedTestCase
/**
* close the cache in tearDown
*/
- public void tearDown2() throws Exception
+ public void tearDownBeforeDisconnect() throws Exception
{
// close client
closeCache();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e2f18f97/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ConnectionProxyJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ConnectionProxyJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ConnectionProxyJUnitTest.java
index ae73ed4..4ef6e2f 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ConnectionProxyJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ConnectionProxyJUnitTest.java
@@ -54,8 +54,8 @@ import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.EntryEventImpl;
import com.gemstone.gemfire.internal.cache.EventID;
import com.gemstone.gemfire.internal.cache.ha.ThreadIdentifier;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
/**
@@ -260,7 +260,7 @@ public class ConnectionProxyJUnitTest
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 90 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 90 * 1000, 200, true);
}
finally {
if (server != null) {
@@ -321,7 +321,7 @@ public class ConnectionProxyJUnitTest
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 90 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 90 * 1000, 200, true);
}
finally {
if (server != null) {
@@ -462,7 +462,7 @@ public class ConnectionProxyJUnitTest
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 20 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 20 * 1000, 200, true);
}
catch (Exception ex) {
ex.printStackTrace();
@@ -838,7 +838,7 @@ public class ConnectionProxyJUnitTest
return "ack flag never became " + expectedAckSend;
}
};
- DistributedTestCase.waitForCriterion(wc, timeToWait, 1000, true);
+ Wait.waitForCriterion(wc, timeToWait, 1000, true);
}
private void verifyExpiry(long timeToWait)
@@ -851,7 +851,7 @@ public class ConnectionProxyJUnitTest
return "Entry never expired";
}
};
- DistributedTestCase.waitForCriterion(wc, timeToWait * 2, 200, true);
+ Wait.waitForCriterion(wc, timeToWait * 2, 200, true);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e2f18f97/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DataSerializerPropogationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DataSerializerPropogationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DataSerializerPropogationDUnitTest.java
index 85bed81..5902571 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DataSerializerPropogationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DataSerializerPropogationDUnitTest.java
@@ -47,9 +47,15 @@ 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.EventID;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.NetworkSupport;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.StoppableWaitCriterion;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
@@ -149,7 +155,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
}
@Override
- public void tearDown2() throws Exception {
+ public void tearDownBeforeDisconnect() throws Exception {
try {
// close the clients first
client1.invoke(DataSerializerPropogationDUnitTest.class, "closeCache");
@@ -159,7 +165,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
server1.invoke(DataSerializerPropogationDUnitTest.class, "closeCache");
server2.invoke(DataSerializerPropogationDUnitTest.class, "closeCache");
- super.tearDown2();
+ super.tearDownBeforeDisconnect();
client1 = null;
client2 = null;
@@ -182,7 +188,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
verifyDataSerializers(numOfDataSerializers, false);
}
public static void verifyDataSerializers(final int numOfDataSerializers, final boolean allowNonLocal) {
- WaitCriterion wc = new WaitCriterion2() {
+ WaitCriterion wc = new StoppableWaitCriterion() {
String excuse;
private DataSerializer[] getSerializers() {
@@ -206,7 +212,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
return getSerializers().length > numOfDataSerializers;
}
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
}
public static final ThreadLocal<Boolean> allowNonLocalTL = new ThreadLocal<Boolean>();
@@ -217,7 +223,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
InternalDataSerializer.register(DSObject1.class, true);
}
catch (Exception e) {
- fail("Test failed due to exception in DSObject1", e);
+ Assert.fail("Test failed due to exception in DSObject1", e);
}
}
@@ -227,7 +233,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
InternalDataSerializer.register(DSObject2.class, true);
}
catch (Exception e) {
- fail("Test failed due to exception in DSObject2", e);
+ Assert.fail("Test failed due to exception in DSObject2", e);
}
}
@@ -237,7 +243,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
InternalDataSerializer.register(DSObject3.class, true);
}
catch (Exception e) {
- fail("Test failed due to exception in DSObject2", e);
+ Assert.fail("Test failed due to exception in DSObject2", e);
}
}
@@ -247,7 +253,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
InternalDataSerializer.register(DSObject4.class, true);
}
catch (Exception e) {
- fail("Test failed due to exception in DSObject4", e);
+ Assert.fail("Test failed due to exception in DSObject4", e);
}
}
@@ -257,7 +263,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
InternalDataSerializer.register(DSObject5.class, true);
}
catch (Exception e) {
- fail("Test failed due to exception in DSObject5", e);
+ Assert.fail("Test failed due to exception in DSObject5", e);
}
}
@@ -267,7 +273,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
InternalDataSerializer.register(DSObject6.class, true);
}
catch (Exception e) {
- fail("Test failed due to exception in DSObject6", e);
+ Assert.fail("Test failed due to exception in DSObject6", e);
}
}
@@ -277,7 +283,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
InternalDataSerializer.register(DSObject7.class, true);
}
catch (Exception e) {
- fail("Test failed due to exception in DSObject7", e);
+ Assert.fail("Test failed due to exception in DSObject7", e);
}
}
@@ -287,7 +293,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
InternalDataSerializer.register(DSObject8.class, true);
}
catch (Exception e) {
- fail("Test failed due to exception in DSObject8", e);
+ Assert.fail("Test failed due to exception in DSObject8", e);
}
}
@@ -297,7 +303,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
InternalDataSerializer.register(DSObject9.class, true);
}
catch (Exception e) {
- fail("Test failed due to exception in DSObject9", e);
+ Assert.fail("Test failed due to exception in DSObject9", e);
}
}
@@ -307,7 +313,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
InternalDataSerializer.register(DSObject10.class, true);
}
catch (Exception e) {
- fail("Test failed due to exception in DSObject10", e);
+ Assert.fail("Test failed due to exception in DSObject10", e);
}
}
@@ -317,7 +323,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
InternalDataSerializer.register(DSObject11.class, true);
}
catch (Exception e) {
- fail("Test failed due to exception in DSObject11", e);
+ Assert.fail("Test failed due to exception in DSObject11", e);
}
}
@@ -327,7 +333,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
InternalDataSerializer.register(DSObject12.class, true);
}
catch (Exception e) {
- fail("Test failed due to exception in DSObject12", e);
+ Assert.fail("Test failed due to exception in DSObject12", e);
}
}
@@ -337,7 +343,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
InternalDataSerializer.register(DSObject13.class, true);
}
catch (Exception e) {
- fail("Test failed due to exception in DSObject13", e);
+ Assert.fail("Test failed due to exception in DSObject13", e);
}
}
@@ -347,7 +353,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
InternalDataSerializer._register(new DSObjectLocalOnly(79), true);
}
catch (Exception e) {
- fail("Test failed due to exception in DSObjectLocalOnly", e);
+ Assert.fail("Test failed due to exception in DSObjectLocalOnly", e);
}
}
@@ -355,7 +361,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
try {
InternalDataSerializer.register(TestDataSerializer.class, true);
} catch (Exception e) {
- fail("Test failed due to exception in TestDataSerializer", e);
+ Assert.fail("Test failed due to exception in TestDataSerializer", e);
}
}
@@ -396,7 +402,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
public void testServerUpFirstClientLater() throws Exception {
PORT1 = initServerCache(server1);
- pause(3000);
+ Wait.pause(3000);
server1.invoke(DataSerializerPropogationDUnitTest.class,
"registerDSObject1");
@@ -408,10 +414,10 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
client1.invoke(DataSerializerPropogationDUnitTest.class,
"createClientCache", new Object[] {
- getServerHostName(server1.getHost()), new Integer(PORT1) });
+ NetworkSupport.getServerHostName(server1.getHost()), new Integer(PORT1) });
// wait for client2 to come online
- pause(3000);
+ Wait.pause(3000);
client1.invoke(DataSerializerPropogationDUnitTest.class,
"verifyDataSerializers", new Object[] { new Integer(2) });
@@ -447,7 +453,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
}
});
- pause(3000);
+ Wait.pause(3000);
// Run getAll
client1.invoke(new CacheSerializableRunnable("Get entry from client") {
@Override
@@ -466,17 +472,17 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
client1.invoke(DataSerializerPropogationDUnitTest.class,
"createClientCache", new Object[] {
- getServerHostName(server1.getHost()), new Integer(PORT1) });
+ NetworkSupport.getServerHostName(server1.getHost()), new Integer(PORT1) });
client2.invoke(DataSerializerPropogationDUnitTest.class,
"createClientCache", new Object[] {
- getServerHostName(server2.getHost()), new Integer(PORT2) });
+ NetworkSupport.getServerHostName(server2.getHost()), new Integer(PORT2) });
// wait for client2 to come online
- pause(2000);
+ Wait.pause(2000);
client1.invoke(DataSerializerPropogationDUnitTest.class,
"registerDSObject3");
- pause(4000);
+ Wait.pause(4000);
client1.invoke(DataSerializerPropogationDUnitTest.class,
"verifyDataSerializers", new Object[] { new Integer(1) });
@@ -498,18 +504,18 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
client1.invoke(DataSerializerPropogationDUnitTest.class,
"createClientCache", new Object[] {
- getServerHostName(server1.getHost()), new Integer(PORT1) });
+ NetworkSupport.getServerHostName(server1.getHost()), new Integer(PORT1) });
client2.invoke(DataSerializerPropogationDUnitTest.class,
"createClientCache", new Object[] {
- getServerHostName(server2.getHost()), new Integer(PORT2) });
+ NetworkSupport.getServerHostName(server2.getHost()), new Integer(PORT2) });
// wait for client2 to come online
- pause(2000);
+ Wait.pause(2000);
server1.invoke(DataSerializerPropogationDUnitTest.class,
"registerDSObjectLocalOnly", new Object[] { });
- pause(4000);
+ Wait.pause(4000);
server1.invoke(DataSerializerPropogationDUnitTest.class,
"verifyDataSerializers", new Object[] { new Integer(1) });
@@ -530,13 +536,13 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
client1.invoke(DataSerializerPropogationDUnitTest.class,
"createClientCache", new Object[] {
- getServerHostName(server1.getHost()), new Integer(PORT1) });
+ NetworkSupport.getServerHostName(server1.getHost()), new Integer(PORT1) });
client2.invoke(DataSerializerPropogationDUnitTest.class,
"createClientCache", new Object[] {
- getServerHostName(server2.getHost()), new Integer(PORT2) });
+ NetworkSupport.getServerHostName(server2.getHost()), new Integer(PORT2) });
// wait for client2 to come online
- pause(2000);
+ Wait.pause(2000);
client1.invoke(DataSerializerPropogationDUnitTest.class,
"registerDSObject4");
@@ -553,7 +559,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
"verifyDataSerializers", new Object[] { Integer.valueOf(1) });
// can get server connectivity exception
- final ExpectedException expectedEx = addExpectedException(
+ final IgnoredException expectedEx = IgnoredException.addIgnoredException(
"Server unreachable", client1);
// stop the cache server
@@ -587,20 +593,20 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
client1.invoke(DataSerializerPropogationDUnitTest.class,
"createClientCache", new Object[] {
- getServerHostName(server1.getHost()), new Integer(PORT1) });
+ NetworkSupport.getServerHostName(server1.getHost()), new Integer(PORT1) });
client2.invoke(DataSerializerPropogationDUnitTest.class,
"createClientCache", new Object[] {
- getServerHostName(server2.getHost()), new Integer(PORT2) });
+ NetworkSupport.getServerHostName(server2.getHost()), new Integer(PORT2) });
// wait for client2 to come online
- pause(2000);
+ Wait.pause(2000);
client1.invoke(DataSerializerPropogationDUnitTest.class,
"registerDSObject10");
server1.invoke(DataSerializerPropogationDUnitTest.class,
"registerDSObject11");
- pause(4000);
+ Wait.pause(4000);
server2.invoke(DataSerializerPropogationDUnitTest.class,
"verifyDataSerializers", new Object[] { new Integer(2) });
@@ -620,10 +626,10 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
PORT2 = initServerCache(server2);
client1.invoke(DataSerializerPropogationDUnitTest.class,
"createClientCache", new Object[] {
- getServerHostName(server1.getHost()), new Integer(PORT1) });
+ NetworkSupport.getServerHostName(server1.getHost()), new Integer(PORT1) });
client2.invoke(DataSerializerPropogationDUnitTest.class,
"createClientCache", new Object[] {
- getServerHostName(server2.getHost()), new Integer(PORT2) });
+ NetworkSupport.getServerHostName(server2.getHost()), new Integer(PORT2) });
client1.invoke(DataSerializerPropogationDUnitTest.class,
"registerDSObject7");
@@ -644,7 +650,7 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
instanceCountWithOnePut) });
// can get server connectivity exception
- final ExpectedException expectedEx = addExpectedException(
+ final IgnoredException expectedEx = IgnoredException.addIgnoredException(
"Server unreachable", client1);
server1.invoke(DataSerializerPropogationDUnitTest.class, "stopServer");
@@ -690,18 +696,18 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
client1.invoke(DataSerializerPropogationDUnitTest.class,
"createClientCache", new Object[] {
- getServerHostName(server1.getHost()), new Integer(PORT1) });
+ NetworkSupport.getServerHostName(server1.getHost()), new Integer(PORT1) });
client2.invoke(DataSerializerPropogationDUnitTest.class,
"createClientCache", new Object[] {
- getServerHostName(server1.getHost()), new Integer(PORT1) });
- createClientCache(getServerHostName(server2.getHost()), new Integer(PORT2));
+ NetworkSupport.getServerHostName(server1.getHost()), new Integer(PORT1) });
+ createClientCache(NetworkSupport.getServerHostName(server2.getHost()), new Integer(PORT2));
// wait for client2 to come online
- pause(2000);
+ Wait.pause(2000);
client1.invoke(DataSerializerPropogationDUnitTest.class,
"registerDSObject12");
- pause(4000);
+ Wait.pause(4000);
client1.invoke(DataSerializerPropogationDUnitTest.class,
"verifyDataSerializers", new Object[] { new Integer(1) });
@@ -728,19 +734,19 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
PORT1 = initServerCache(server1, 1);
PORT2 = initServerCache(server2, 2);
- createClientCache(getServerHostName(server1.getHost()),
+ createClientCache(NetworkSupport.getServerHostName(server1.getHost()),
new Integer(PORT1));
client2.invoke(DataSerializerPropogationDUnitTest.class,
"createClientCache", new Object[] {
- getServerHostName(server2.getHost()), new Integer(PORT2) });
+ NetworkSupport.getServerHostName(server2.getHost()), new Integer(PORT2) });
setClientServerObserver1();
client2
.invoke(DataSerializerPropogationDUnitTest.class, "setClientServerObserver2");
registerDSObject13();
- pause(10000);
+ Wait.pause(10000);
Boolean pass = (Boolean)client2.invoke(
DataSerializerPropogationDUnitTest.class, "verifyResult");
@@ -756,17 +762,17 @@ public class DataSerializerPropogationDUnitTest extends DistributedTestCase {
client1.invoke(DataSerializerPropogationDUnitTest.class,
"createClientCache", new Object[] {
- getServerHostName(server1.getHost()), new Integer(PORT1) });
+ NetworkSupport.getServerHostName(server1.getHost()), new Integer(PORT1) });
client2.invoke(DataSerializerPropogationDUnitTest.class,
"createClientCache", new Object[] {
- getServerHostName(server1.getHost()), new Integer(PORT2) });
+ NetworkSupport.getServerHostName(server1.getHost()), new Integer(PORT2) });
// wait for client2 to come online
- pause(2000);
+ Wait.pause(2000);
client1.invoke(DataSerializerPropogationDUnitTest.class,
"registerTestDataSerializer");
- pause(4000);
+ Wait.pause(4000);
client1.invoke(DataSerializerPropogationDUnitTest.class,
"verifyDataSerializers", new Object[] { new Integer(1) });
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e2f18f97/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DestroyEntryPropagationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DestroyEntryPropagationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DestroyEntryPropagationDUnitTest.java
index 55bd889..bbf5927 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DestroyEntryPropagationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DestroyEntryPropagationDUnitTest.java
@@ -38,9 +38,13 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.EntryEventImpl;
import com.gemstone.gemfire.internal.cache.EventID;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.NetworkSupport;
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.cache30.CacheSerializableRunnable;
import com.gemstone.gemfire.cache30.CertifiableTestCacheListener;
import com.gemstone.gemfire.cache.client.*;
@@ -100,9 +104,9 @@ public class DestroyEntryPropagationDUnitTest extends DistributedTestCase
PORT2 = ((Integer)vm1.invoke(DestroyEntryPropagationDUnitTest.class, "createServerCache" )).intValue();
vm2.invoke(DestroyEntryPropagationDUnitTest.class, "createClientCache",
- new Object[] { getServerHostName(Host.getHost(0)), new Integer(PORT1),new Integer(PORT2)});
+ new Object[] { NetworkSupport.getServerHostName(Host.getHost(0)), new Integer(PORT1),new Integer(PORT2)});
vm3.invoke(DestroyEntryPropagationDUnitTest.class, "createClientCache",
- new Object[] { getServerHostName(Host.getHost(0)), new Integer(PORT1),new Integer(PORT2)});
+ new Object[] { NetworkSupport.getServerHostName(Host.getHost(0)), new Integer(PORT1),new Integer(PORT2)});
}
@@ -221,7 +225,7 @@ public class DestroyEntryPropagationDUnitTest extends DistributedTestCase
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, maxWaitTime, 200, true);
+ Wait.waitForCriterion(ev, maxWaitTime, 200, true);
}
});
@@ -245,7 +249,7 @@ public class DestroyEntryPropagationDUnitTest extends DistributedTestCase
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, maxWaitTime, 200, true);
+ Wait.waitForCriterion(ev, maxWaitTime, 200, true);
}
});
@@ -342,7 +346,7 @@ public class DestroyEntryPropagationDUnitTest extends DistributedTestCase
assertEquals(r1.getEntry("key2").getValue(), "key-2");
}
catch (Exception ex) {
- fail("failed while createEntries()", ex);
+ Assert.fail("failed while createEntries()", ex);
}
}
@@ -359,7 +363,7 @@ public class DestroyEntryPropagationDUnitTest extends DistributedTestCase
r.destroy("key2");
}
catch (Exception ex) {
- fail("failed while destroyEntry()", ex);
+ Assert.fail("failed while destroyEntry()", ex);
}
}
@@ -372,7 +376,7 @@ public class DestroyEntryPropagationDUnitTest extends DistributedTestCase
assertNotNull(r.getEntry("key2"));
}
catch (Exception ex) {
- fail("failed while verifyDestroyEntry in C1", ex);
+ Assert.fail("failed while verifyDestroyEntry in C1", ex);
}
}
@@ -386,7 +390,7 @@ public class DestroyEntryPropagationDUnitTest extends DistributedTestCase
assertNull(r.getEntry("key2"));
}
catch (Exception ex) {
- fail("failed while verifyDestroyEntry in C1", ex);
+ Assert.fail("failed while verifyDestroyEntry in C1", ex);
}
}
@@ -400,7 +404,7 @@ public class DestroyEntryPropagationDUnitTest extends DistributedTestCase
assertNotNull(r.getEntry("key2"));
}
catch (Exception ex) {
- fail("failed while verifyDestroyEntry for key1", ex);
+ Assert.fail("failed while verifyDestroyEntry for key1", ex);
}
}
@@ -414,7 +418,7 @@ public class DestroyEntryPropagationDUnitTest extends DistributedTestCase
return "waiting for destroy event for " + key;
}
};
- DistributedTestCase.waitForCriterion(ev, 10 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 10 * 1000, 200, true);
ccl.destroys.remove(key);
}
@@ -487,7 +491,7 @@ public class DestroyEntryPropagationDUnitTest extends DistributedTestCase
}
catch (Exception ex) {
- fail("failed while registering interest", ex);
+ Assert.fail("failed while registering interest", ex);
}
}
@@ -499,7 +503,7 @@ public class DestroyEntryPropagationDUnitTest extends DistributedTestCase
}
}
- public void tearDown2() throws Exception
+ public void tearDownBeforeDisconnect() throws Exception
{
//close client
vm2.invoke(DestroyEntryPropagationDUnitTest.class, "closeCache");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e2f18f97/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientBug39997DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientBug39997DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientBug39997DUnitTest.java
index d40563b..94fe536 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientBug39997DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientBug39997DUnitTest.java
@@ -30,9 +30,13 @@ import com.gemstone.gemfire.cache.client.internal.PoolImpl;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.NetworkSupport;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
public class DurableClientBug39997DUnitTest extends CacheTestCase {
@@ -47,7 +51,7 @@ public class DurableClientBug39997DUnitTest extends CacheTestCase {
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
- final String hostName = getServerHostName(host);
+ final String hostName = NetworkSupport.getServerHostName(host);
final int port = AvailablePortHelper.getRandomAvailableTCPPort();
vm0.invoke(new SerializableRunnable("create cache") {
public void run() {
@@ -84,7 +88,7 @@ public class DurableClientBug39997DUnitTest extends CacheTestCase {
try {
server.start();
} catch (IOException e) {
- fail("couldn't start server", e);
+ Assert.fail("couldn't start server", e);
}
}
});
@@ -93,7 +97,7 @@ public class DurableClientBug39997DUnitTest extends CacheTestCase {
public void run() {
Cache cache = getCache();
final Region region = cache.getRegion("region");
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
public String description() {
return "Wait for register interest to succeed";
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e2f18f97/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientQueueSizeDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientQueueSizeDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientQueueSizeDUnitTest.java
index 3e23ab5..c5128b4 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientQueueSizeDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientQueueSizeDUnitTest.java
@@ -34,8 +34,10 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.test.dunit.DUnitEnv;
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.VM;
/**
@@ -85,11 +87,11 @@ public class DurableClientQueueSizeDUnitTest extends DistributedTestCase {
"createCacheServer", new Object[] { });
port1 = (Integer) vm1.invoke(DurableClientQueueSizeDUnitTest.class,
"createCacheServer", new Object[] { });
- addExpectedException("java.net.SocketException");
- addExpectedException("Unexpected IOException");
+ IgnoredException.addIgnoredException("java.net.SocketException");
+ IgnoredException.addIgnoredException("Unexpected IOException");
}
- public void tearDown2() throws Exception {
+ public void tearDownBeforeDisconnect() throws Exception {
closeCache();
vm2.invoke(DurableClientQueueSizeDUnitTest.class, "closeCache");
@@ -275,7 +277,7 @@ public class DurableClientQueueSizeDUnitTest extends DistributedTestCase {
public static Integer createCacheServer(Integer serverPort)
throws Exception {
Properties props = new Properties();
- props.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ props.setProperty("locators", "localhost["+DUnitEnv.getDUnitLocatorPort()+"]");
// props.setProperty("log-level", "fine");
// props.setProperty("log-file", "server_" + OSProcess.getId() + ".log");
// props.setProperty("statistic-archive-file", "server_" + OSProcess.getId()
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e2f18f97/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientReconnectAutoDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientReconnectAutoDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientReconnectAutoDUnitTest.java
index 5e015ea..b5aa65a 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientReconnectAutoDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientReconnectAutoDUnitTest.java
@@ -18,8 +18,10 @@ package com.gemstone.gemfire.internal.cache.tier.sockets;
import com.gemstone.gemfire.cache.client.PoolFactory;
import com.gemstone.gemfire.cache.client.PoolManager;
+import com.gemstone.gemfire.test.dunit.DUnitEnv;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.NetworkSupport;
/**
* @author dsmith
@@ -50,7 +52,7 @@ public class DurableClientReconnectAutoDUnitTest extends
protected PoolFactory getPoolFactory() {
Host host = Host.getHost(0);
PoolFactory factory = PoolManager.createFactory()
- .addLocator(getServerHostName(host), getDUnitLocatorPort());
+ .addLocator(NetworkSupport.getServerHostName(host), DUnitEnv.getDUnitLocatorPort());
return factory;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e2f18f97/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientReconnectDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientReconnectDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientReconnectDUnitTest.java
index 309f44a..9f596ee 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientReconnectDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientReconnectDUnitTest.java
@@ -43,9 +43,14 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.ServerLocation;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.CacheServerImpl;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.NetworkSupport;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
@@ -104,10 +109,10 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
PORT2 = ((Integer) server2.invoke(DurableClientReconnectDUnitTest.class, "createServerCache"));
PORT3 = ((Integer) server3.invoke(DurableClientReconnectDUnitTest.class, "createServerCache"));
PORT4 = ((Integer) server4.invoke(DurableClientReconnectDUnitTest.class, "createServerCache"));
- SERVER1 = getServerHostName(host)+PORT1;
- SERVER2 = getServerHostName(host)+PORT2;
- SERVER3 = getServerHostName(host)+PORT3;
- SERVER4 = getServerHostName(host)+PORT4;
+ SERVER1 = NetworkSupport.getServerHostName(host)+PORT1;
+ SERVER2 = NetworkSupport.getServerHostName(host)+PORT2;
+ SERVER3 = NetworkSupport.getServerHostName(host)+PORT3;
+ SERVER4 = NetworkSupport.getServerHostName(host)+PORT4;
//CacheServerTestUtil.disableShufflingOfEndpoints();
System.setProperty("gemfire.bridge.disableShufflingOfEndpoints", "false");
@@ -115,7 +120,7 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
}
public void testDurableReconnectSingleServer() throws Exception
{
- createCacheClientAndConnectToSingleServer(getServerHostName(Host.getHost(0)), 0);
+ createCacheClientAndConnectToSingleServer(NetworkSupport.getServerHostName(Host.getHost(0)), 0);
List redundantServers = pool.getRedundantNames();
String primaryName = pool.getPrimaryName();
assertTrue(redundantServers.isEmpty());
@@ -123,9 +128,9 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
//Wait for server to cleanup client resources
//temporary fix for bug 38345.
- pause(2000);
+ Wait.pause(2000);
- createCacheClientAndConnectToSingleServer(getServerHostName(Host.getHost(0)), 0);
+ createCacheClientAndConnectToSingleServer(NetworkSupport.getServerHostName(Host.getHost(0)), 0);
List redundantServers2 = pool.getRedundantNames();
String primaryName2 = pool.getPrimaryName();
assertTrue(redundantServers2.isEmpty());
@@ -133,13 +138,13 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
}
public void testDurableReconnectSingleServerWithZeroConnPerServer() throws Exception
{
- createCacheClientAndConnectToSingleServerWithZeroConnPerServer(getServerHostName(Host.getHost(0)), 0);
+ createCacheClientAndConnectToSingleServerWithZeroConnPerServer(NetworkSupport.getServerHostName(Host.getHost(0)), 0);
List redundantServers = pool.getRedundantNames();
String primaryName = pool.getPrimaryName();
assertTrue(redundantServers.isEmpty());
closeCache(true);
- createCacheClientAndConnectToSingleServerWithZeroConnPerServer(getServerHostName(Host.getHost(0)), 0);
+ createCacheClientAndConnectToSingleServerWithZeroConnPerServer(NetworkSupport.getServerHostName(Host.getHost(0)), 0);
List redundantServers2 = pool.getRedundantNames();
String primaryName2 = pool.getPrimaryName();
assertTrue(redundantServers2.isEmpty());
@@ -155,7 +160,7 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
//Wait for server to cleanup client resources
//temporary fix for bug 38345.
- pause(2000);
+ Wait.pause(2000);
createCacheClient(0);
List redundantServers2 = pool.getRedundantNames();
@@ -182,7 +187,7 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
//Wait for server to cleanup client resources
//temporary fix for bug 38345.
- pause(2000);
+ Wait.pause(2000);
createCacheClient();
@@ -211,7 +216,7 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
//Wait for server to cleanup client resources
//temporary fix for bug 38345.
- pause(2000);
+ Wait.pause(2000);
createCacheClient();
@@ -333,7 +338,7 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
String rServer2 = (String)serverArray[1];
// can see sporadic socket closed exceptions
- final ExpectedException expectedEx = addExpectedException(
+ final IgnoredException expectedEx = IgnoredException.addIgnoredException(
SocketException.class.getName());
instance.closeServer(rServer1);
@@ -386,7 +391,7 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
//Wait for server to cleanup client resources
//temporary fix for bug 38345.
- pause(2000);
+ Wait.pause(2000);
getLogWriter().info("TEST - Creating the durable client with one fewer servers");
//We recreate the durable client, but this
@@ -398,10 +403,10 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
getLogWriter().info("TEST - Durable client created again, now with servers " + redundantServers2);
Host host = Host.getHost(0);
//Make sure we create client to server connections to all of the servers
- pool.acquireConnection(new ServerLocation(getServerHostName(host), PORT1.intValue()));
- pool.acquireConnection(new ServerLocation(getServerHostName(host), PORT2.intValue()));
- pool.acquireConnection(new ServerLocation(getServerHostName(host), PORT3.intValue()));
- pool.acquireConnection(new ServerLocation(getServerHostName(host), PORT4.intValue()));
+ pool.acquireConnection(new ServerLocation(NetworkSupport.getServerHostName(host), PORT1.intValue()));
+ pool.acquireConnection(new ServerLocation(NetworkSupport.getServerHostName(host), PORT2.intValue()));
+ pool.acquireConnection(new ServerLocation(NetworkSupport.getServerHostName(host), PORT3.intValue()));
+ pool.acquireConnection(new ServerLocation(NetworkSupport.getServerHostName(host), PORT4.intValue()));
getLogWriter().info("TEST - All pool connections are now aquired");
@@ -411,7 +416,7 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
//Wait for server to cleanup client resources
//temporary fix for bug 38345.
- pause(2000);
+ Wait.pause(2000);
getLogWriter().info("TEST - creating durable client for the third time");
//Now we should connect to all of the servers we were originally connected to
@@ -428,7 +433,7 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
assertEquals(redundantServers, redundantServersAfterReconnect);
//Now we wait to make sure the durable client expiration task isn't fired.
- pause(25000);
+ Wait.pause(25000);
getLogWriter().info("TEST - Finished waiting for durable client expiration task");
@@ -450,7 +455,7 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
assertTrue(redundantServersAfterReconnect.contains(endpointName));
}
}catch (Exception e){
- fail("test failed due to" , e);
+ Assert.fail("test failed due to" , e);
}
}
@@ -458,7 +463,7 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
try{
checkNumberOfClientProxies(0);
}catch (Exception e){
- fail("test failed due to" , e);
+ Assert.fail("test failed due to" , e);
}
}
@@ -536,7 +541,7 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
assertEquals("DurableClientReconnectDUnitTest_client", proxy.getDurableId());
// assertEquals(60, proxy.getDurableTimeout());
}catch (Exception e){
- fail("test failed due to" , e);
+ Assert.fail("test failed due to" , e);
}
}
@@ -563,7 +568,7 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 15 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 15 * 1000, 200, true);
}
protected static int getNumberOfClientProxies() {
@@ -585,7 +590,7 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
cache = CacheFactory.create(ds);
assertNotNull(cache);
} catch(Exception e){
- fail("test failed due to " , e );
+ Assert.fail("test failed due to " , e );
}
}
@@ -597,10 +602,10 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
protected PoolFactory getPoolFactory() {
Host host = Host.getHost(0);
PoolFactory factory = PoolManager.createFactory()
- .addServer(getServerHostName(host), PORT1.intValue())
- .addServer(getServerHostName(host), PORT2.intValue())
- .addServer(getServerHostName(host), PORT3.intValue())
- .addServer(getServerHostName(host), PORT4.intValue());
+ .addServer(NetworkSupport.getServerHostName(host), PORT1.intValue())
+ .addServer(NetworkSupport.getServerHostName(host), PORT2.intValue())
+ .addServer(NetworkSupport.getServerHostName(host), PORT3.intValue())
+ .addServer(NetworkSupport.getServerHostName(host), PORT4.intValue());
return factory;
}
@@ -641,7 +646,7 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
cache.readyForEvents();
}catch(Exception e){
- fail("test failed due to " , e );
+ Assert.fail("test failed due to " , e );
}
}
@@ -676,7 +681,7 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
cache.readyForEvents();
}catch(Exception e){
- fail("test failed due to " , e );
+ Assert.fail("test failed due to " , e );
}
}
@@ -711,7 +716,7 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
cache.readyForEvents();
}catch(Exception e){
- fail("test failed due to " , e );
+ Assert.fail("test failed due to " , e );
}
}
@@ -726,8 +731,8 @@ public class DurableClientReconnectDUnitTest extends DistributedTestCase
}
@Override
- public void tearDown2() throws Exception {
- super.tearDown2();
+ public void tearDownBeforeDisconnect() throws Exception {
+ super.tearDownBeforeDisconnect();
// close the clients first
closeCache();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e2f18f97/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientStatsDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientStatsDUnitTest.java
index 08eaa9d..b1d4dd4 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientStatsDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientStatsDUnitTest.java
@@ -30,9 +30,12 @@ import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.CacheServerImpl;
import com.gemstone.gemfire.cache.client.*;
import com.gemstone.gemfire.internal.cache.PoolFactoryImpl;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.NetworkSupport;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
/**
*
@@ -77,7 +80,7 @@ public class DurableClientStatsDUnitTest extends DistributedTestCase {
}
@Override
- public void tearDown2() throws Exception {
+ public void tearDownBeforeDisconnect() throws Exception {
// Stop server 1
this.server1VM.invoke(CacheServerTestUtil.class, "closeCache");
CacheServerTestUtil.resetDisableShufflingOfEndpointsFlag();
@@ -99,23 +102,23 @@ public class DurableClientStatsDUnitTest extends DistributedTestCase {
startAndCloseNonDurableClientCache(durableClientTimeout);
startAndCloseNonDurableClientCache(1); //////// -> Reconnection1
- pause(1400); //////// -> Queue Dropped1
+ Wait.pause(1400); //////// -> Queue Dropped1
startAndCloseNonDurableClientCache(1);
- pause(1400); //////// -> Queue Dropped2
+ Wait.pause(1400); //////// -> Queue Dropped2
startRegisterAndCloseNonDurableClientCache( durableClientTimeout);
- pause(500);
+ Wait.pause(500);
this.server1VM.invoke(DurableClientStatsDUnitTest.class, "putValue",
new Object[] { K1, "Value1" }); //////// -> Enqueue Message1
- pause(500);
+ Wait.pause(500);
startAndCloseNonDurableClientCache(1); //////// -> Reconnection2
- pause(1400); //////// -> Queue Dropped3
+ Wait.pause(1400); //////// -> Queue Dropped3
startAndCloseNonDurableClientCache(1);
- pause(1400); //////// -> Queue Dropped4
+ Wait.pause(1400); //////// -> Queue Dropped4
startRegisterAndCloseNonDurableClientCache( durableClientTimeout);
- pause(500);
+ Wait.pause(500);
this.server1VM.invoke(DurableClientStatsDUnitTest.class, "putValue",
new Object[] { K1, "NewValue1" }); //////// -> Enqueue Message2
@@ -143,23 +146,23 @@ public class DurableClientStatsDUnitTest extends DistributedTestCase {
startAndCloseDurableClientCache(durableClientTimeout);
startAndCloseDurableClientCache(1); //////// -> Reconnection1
- pause(1400); //////// -> Queue Dropped1
+ Wait.pause(1400); //////// -> Queue Dropped1
startAndCloseDurableClientCache(1);
- pause(1400); //////// -> Queue Dropped2
+ Wait.pause(1400); //////// -> Queue Dropped2
startRegisterAndCloseDurableClientCache( durableClientTimeout);
- pause(500);
+ Wait.pause(500);
this.server1VM.invoke(DurableClientStatsDUnitTest.class, "putValue",
new Object[] { K1, "Value1" }); //////// -> Enqueue Message1
- pause(500);
+ Wait.pause(500);
startAndCloseDurableClientCache(1); //////// -> Reconnection2
- pause(1400); //////// -> Queue Dropped3
+ Wait.pause(1400); //////// -> Queue Dropped3
startAndCloseDurableClientCache(1);
- pause(1400); //////// -> Queue Dropped4
+ Wait.pause(1400); //////// -> Queue Dropped4
startRegisterAndCloseDurableClientCache( durableClientTimeout);
- pause(500);
+ Wait.pause(500);
this.server1VM.invoke(DurableClientStatsDUnitTest.class, "putValue",
new Object[] { K1, "NewValue1" }); //////// -> Enqueue Message2
@@ -178,7 +181,7 @@ public class DurableClientStatsDUnitTest extends DistributedTestCase {
this.durableClientVM.invoke(CacheServerTestUtil.class, "createCacheClient",
new Object[] {
- getClientPool(getServerHostName(durableClientVM.getHost()), PORT1, true, 0),
+ getClientPool(NetworkSupport.getServerHostName(durableClientVM.getHost()), PORT1, true, 0),
regionName,
getDurableClientDistributedSystemProperties(durableClientId,
durableClientTimeout), Boolean.TRUE });
@@ -203,7 +206,7 @@ public class DurableClientStatsDUnitTest extends DistributedTestCase {
this.durableClientVM.invoke(CacheServerTestUtil.class, "createCacheClient",
new Object[] {
- getClientPool(getServerHostName(durableClientVM.getHost()), PORT1, true, 0),
+ getClientPool(NetworkSupport.getServerHostName(durableClientVM.getHost()), PORT1, true, 0),
regionName,
getNonDurableClientDistributedSystemProperties(durableClientId,
durableClientTimeout), Boolean.TRUE });
@@ -228,7 +231,7 @@ public class DurableClientStatsDUnitTest extends DistributedTestCase {
this.durableClientVM.invoke(CacheServerTestUtil.class, "createCacheClient",
new Object[] {
- getClientPool(getServerHostName(durableClientVM.getHost()), PORT1, true, 0),
+ getClientPool(NetworkSupport.getServerHostName(durableClientVM.getHost()), PORT1, true, 0),
regionName,
getDurableClientDistributedSystemProperties(durableClientId,
durableClientTimeout), Boolean.TRUE });
@@ -252,7 +255,7 @@ public class DurableClientStatsDUnitTest extends DistributedTestCase {
this.durableClientVM.invoke(CacheServerTestUtil.class, "createCacheClient",
new Object[] {
- getClientPool(getServerHostName(durableClientVM.getHost()), PORT1, true, 0),
+ getClientPool(NetworkSupport.getServerHostName(durableClientVM.getHost()), PORT1, true, 0),
regionName,
getNonDurableClientDistributedSystemProperties(durableClientId,
durableClientTimeout), Boolean.TRUE });
@@ -336,7 +339,7 @@ public class DurableClientStatsDUnitTest extends DistributedTestCase {
region.registerInterest(key, InterestResultPolicy.NONE, isDurable);
}
catch (Exception ex) {
- fail("failed while registering interest in registerKey function", ex);
+ Assert.fail("failed while registering interest in registerKey function", ex);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e2f18f97/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableRegistrationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableRegistrationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableRegistrationDUnitTest.java
index f2ef6d1..ca501a6 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableRegistrationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableRegistrationDUnitTest.java
@@ -39,9 +39,13 @@ import com.gemstone.gemfire.internal.cache.LocalRegion;
import com.gemstone.gemfire.cache.client.*;
import com.gemstone.gemfire.cache.query.data.Portfolio;
import com.gemstone.gemfire.internal.cache.PoolFactoryImpl;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.NetworkSupport;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
*
@@ -124,7 +128,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
// seconds
this.durableClientVM.invoke(CacheServerTestUtil.class, "createCacheClient",
new Object[] {
- getClientPool(getServerHostName(durableClientVM.getHost()), PORT1, PORT2, true, 0),
+ getClientPool(NetworkSupport.getServerHostName(durableClientVM.getHost()), PORT1, PORT2, true, 0),
regionName,
getClientDistributedSystemProperties(durableClientId,
durableClientTimeout), Boolean.TRUE });
@@ -162,7 +166,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
this.server2VM.invoke(DurableRegistrationDUnitTest.class, "putValue",
new Object[] { K4, "Value4" });
- pause(1000);
+ Wait.pause(1000);
// Step 5: Verify Updates on the Client
assertEquals("Value1", this.server2VM.invoke(
@@ -197,7 +201,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
// Step 8: Re-start the Client
this.durableClientVM
.invoke(CacheServerTestUtil.class, "createCacheClient",
- new Object[] { getClientPool(getServerHostName(durableClientVM.getHost()), PORT1, PORT2, true, 0),
+ new Object[] { getClientPool(NetworkSupport.getServerHostName(durableClientVM.getHost()), PORT1, PORT2, true, 0),
regionName,
getClientDistributedSystemProperties(durableClientId),
Boolean.TRUE });
@@ -210,7 +214,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
}
});
- pause(5000);
+ Wait.pause(5000);
assertNull(this.durableClientVM.invoke(DurableRegistrationDUnitTest.class,
"getValue", new Object[] { K1 }));
@@ -220,7 +224,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
this.durableClientVM.invoke(DurableRegistrationDUnitTest.class,
"registerKey", new Object[] { K1, new Boolean(false) });
- pause(5000);
+ Wait.pause(5000);
assertNull(this.durableClientVM.invoke(DurableRegistrationDUnitTest.class,
"getValue", new Object[] { K1 }));
assertNull(this.durableClientVM.invoke(DurableRegistrationDUnitTest.class,
@@ -235,7 +239,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
this.server2VM.invoke(DurableRegistrationDUnitTest.class, "putValue",
new Object[] { K4, "PingPong_updated_4" });
- pause(5000);
+ Wait.pause(5000);
// Step 9: Verify Updates on the Client
assertEquals("PingPong_updated_1", this.durableClientVM.invoke(
@@ -276,7 +280,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
final int durableClientTimeout = 600;
this.durableClientVM.invoke(CacheServerTestUtil.class, "createCacheClient",
new Object[] {
- getClientPool(getServerHostName(durableClientVM.getHost()), PORT1, PORT2, true, 0),
+ getClientPool(NetworkSupport.getServerHostName(durableClientVM.getHost()), PORT1, PORT2, true, 0),
regionName,
getClientDistributedSystemProperties(durableClientId,
durableClientTimeout) });
@@ -314,7 +318,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
this.server2VM.invoke(DurableRegistrationDUnitTest.class, "putValue",
new Object[] { K4, "Value4" });
- pause(1000);
+ Wait.pause(1000);
// Step 5: Verify Updates on the Client
assertEquals("Value1", this.server2VM.invoke(
@@ -349,7 +353,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
// Step 8: Re-start the Client
this.durableClientVM
.invoke(CacheServerTestUtil.class, "createCacheClient",
- new Object[] { getClientPool(getServerHostName(durableClientVM.getHost()), PORT1, PORT2, true, 0),
+ new Object[] { getClientPool(NetworkSupport.getServerHostName(durableClientVM.getHost()), PORT1, PORT2, true, 0),
regionName,
getClientDistributedSystemProperties(durableClientId),
Boolean.TRUE });
@@ -381,7 +385,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
this.durableClientVM.invoke(DurableRegistrationDUnitTest.class,
"unregisterKey", new Object[] { K3 });
- pause(5000);
+ Wait.pause(5000);
// Step 12: Modify values on the server for all the Keys
this.server2VM.invoke(DurableRegistrationDUnitTest.class, "putValue",
@@ -393,7 +397,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
this.server2VM.invoke(DurableRegistrationDUnitTest.class, "putValue",
new Object[] { K4, "PingPong_updated_4" });
- pause(5000);
+ Wait.pause(5000);
// Step 13: Check the values for the ones not unregistered and the
// Unregistered Keys' Values should be null
@@ -467,7 +471,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
final int durableClientTimeout = 600;
this.durableClientVM.invoke(CacheServerTestUtil.class, "createCacheClient",
new Object[] {
- getClientPool(getServerHostName(durableClientVM.getHost()), PORT1, PORT2, true, 1),
+ getClientPool(NetworkSupport.getServerHostName(durableClientVM.getHost()), PORT1, PORT2, true, 1),
regionName,
getClientDistributedSystemProperties(durableClientId,
durableClientTimeout) });
@@ -496,7 +500,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
"createCacheServer", new Object[] { regionName, new Boolean(true),
PORT2 });
- pause(3000);
+ Wait.pause(3000);
// Check server2 got all the interests registered by the durable client.
server2VM.invoke(new CacheSerializableRunnable("Verify Interests.") {
@@ -510,7 +514,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
for (int i=0; i < 60; i++) {
Iterator ps = ccn.getClientProxies().iterator();
if (!ps.hasNext()) {
- pause(1000);
+ Wait.pause(1000);
continue;
} else {
p = (CacheClientProxy)ps.next();
@@ -567,7 +571,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
final int durableClientTimeout = 600;
this.durableClientVM.invoke(CacheServerTestUtil.class, "createCacheClient",
new Object[] {
- getClientPool(getServerHostName(durableClientVM.getHost()), PORT1, PORT2, true, 1),
+ getClientPool(NetworkSupport.getServerHostName(durableClientVM.getHost()), PORT1, PORT2, true, 1),
regionName,
getClientDistributedSystemProperties(durableClientId,
durableClientTimeout) });
@@ -594,12 +598,12 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
this.durableClientVM.invoke(DurableRegistrationDUnitTest.class,
"closeCache");
- pause(2000);
+ Wait.pause(2000);
//Re-start the Client
this.durableClientVM
.invoke(CacheServerTestUtil.class, "createCacheClient",
- new Object[] { getClientPool(getServerHostName(durableClientVM.getHost()), PORT1, PORT2, true, 1),
+ new Object[] { getClientPool(NetworkSupport.getServerHostName(durableClientVM.getHost()), PORT1, PORT2, true, 1),
regionName,
getClientDistributedSystemProperties(durableClientId),
Boolean.TRUE });
@@ -617,7 +621,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
"createCacheServer", new Object[] { regionName, new Boolean(true),
PORT2 });
- pause(3000);
+ Wait.pause(3000);
// Check server2 got all the interests registered by the durable client.
server2VM.invoke(new CacheSerializableRunnable("Verify Interests.") {
@@ -631,7 +635,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
for (int i=0; i < 60; i++) {
Iterator ps = ccn.getClientProxies().iterator();
if (!ps.hasNext()) {
- pause(1000);
+ Wait.pause(1000);
continue;
} else {
p = (CacheClientProxy)ps.next();
@@ -703,7 +707,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
}
catch (Exception ex) {
- fail("failed while registering interest in registerKey function", ex);
+ Assert.fail("failed while registering interest in registerKey function", ex);
}
}
@@ -736,7 +740,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
region.registerInterest(key, InterestResultPolicy.NONE, isDurable);
}
catch (Exception ex) {
- fail("failed while registering interest in registerKey function", ex);
+ Assert.fail("failed while registering interest in registerKey function", ex);
}
}
@@ -752,7 +756,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
region.unregisterInterest(key);
}
catch (Exception ex) {
- fail("failed while registering interest in registerKey function", ex);
+ Assert.fail("failed while registering interest in registerKey function", ex);
}
}
@@ -801,7 +805,7 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 15 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 15 * 1000, 200, true);
}
protected static int getNumberOfClientProxies() {
@@ -858,9 +862,9 @@ public class DurableRegistrationDUnitTest extends DistributedTestCase {
this.regionName = regionName;
}
- public void tearDown2() throws Exception
+ public void tearDownBeforeDisconnect() throws Exception
{
- super.tearDown2();
+ super.tearDownBeforeDisconnect();
CacheServerTestUtil.resetDisableShufflingOfEndpointsFlag();
}
}