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:18 UTC
[08/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/DurableResponseMatrixDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableResponseMatrixDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableResponseMatrixDUnitTest.java
index bbbdf80..8dd0e0c 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableResponseMatrixDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableResponseMatrixDUnitTest.java
@@ -24,9 +24,14 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.cache.ClientServerObserverAdapter;
import com.gemstone.gemfire.internal.cache.ClientServerObserverHolder;
+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.IgnoredException;
+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.internal.AvailablePort;
import com.gemstone.gemfire.cache.client.*;
import com.gemstone.gemfire.cache.client.internal.PoolImpl;
@@ -66,9 +71,9 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase
// start servers first
PORT1 = ((Integer)server1.invoke(DurableResponseMatrixDUnitTest.class,
"createServerCache"));
- createCacheClient(getServerHostName(server1.getHost()));
+ createCacheClient(NetworkSupport.getServerHostName(server1.getHost()));
//Disconnecting the client can cause this
- addExpectedException("Connection reset||Unexpected IOException");
+ IgnoredException.addIgnoredException("Connection reset||Unexpected IOException");
}
public void testRegisterInterestResponse_NonExistent_Invalid()
@@ -196,7 +201,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 120 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 120 * 1000, 200, true);
}
public void testNotification_NonExistent_Create() throws Exception
@@ -369,7 +374,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase
r.put(key, value);
}
catch (Exception e) {
- fail("test failed due to ", e);
+ Assert.fail("test failed due to ", e);
}
}
@@ -381,7 +386,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase
r.destroy(key);
}
catch (Exception e) {
- fail("test failed due to ", e);
+ Assert.fail("test failed due to ", e);
}
}
@@ -393,7 +398,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase
r.invalidate(key);
}
catch (Exception e) {
- fail("test failed due to ", e);
+ Assert.fail("test failed due to ", e);
}
}
@@ -406,7 +411,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase
r.invalidate(key);
}
catch (Exception e) {
- fail("test failed due to ", e);
+ Assert.fail("test failed due to ", e);
}
}
@@ -419,7 +424,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase
r.localInvalidate(key);
}
catch (Exception e) {
- fail("test failed due to ", e);
+ Assert.fail("test failed due to ", e);
}
}
@@ -434,7 +439,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase
assertNotNull(cache);
}
catch (Exception e) {
- fail("test failed due to ", e);
+ Assert.fail("test failed due to ", e);
}
}
@@ -467,7 +472,7 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase
}
catch (Exception e) {
- fail("test failed due to ", e);
+ Assert.fail("test failed due to ", e);
}
}
@@ -503,9 +508,9 @@ public class DurableResponseMatrixDUnitTest extends DistributedTestCase
return properties;
}
- 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/EventIDVerificationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/EventIDVerificationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/EventIDVerificationDUnitTest.java
index 6cb897e..8b09bc9 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/EventIDVerificationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/EventIDVerificationDUnitTest.java
@@ -42,8 +42,10 @@ import com.gemstone.gemfire.internal.cache.CacheObserverHolder;
import com.gemstone.gemfire.internal.cache.EntryEventImpl;
import com.gemstone.gemfire.internal.cache.EventID;
import com.gemstone.gemfire.internal.cache.RegionEventImpl;
+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;
/**
@@ -97,7 +99,7 @@ public class EventIDVerificationDUnitTest extends DistributedTestCase
//vm2.invoke(EventIDVerificationDUnitTest.class, "createClientCache", new
// Object[] { new Integer(PORT1),new Integer(PORT2)});
- createClientCache(getServerHostName(host), new Integer(PORT1), new Integer(PORT2));
+ createClientCache(NetworkSupport.getServerHostName(host), new Integer(PORT1), new Integer(PORT2));
CacheObserverHolder.setInstance(new CacheObserverAdapter());
}
@@ -388,7 +390,7 @@ public class EventIDVerificationDUnitTest extends DistributedTestCase
assertEquals(r.getEntry("key-1").getValue(), "key-1");
}
catch (Exception ex) {
- fail("failed while createEntries()", ex);
+ Assert.fail("failed while createEntries()", ex);
}
}
@@ -404,7 +406,7 @@ public class EventIDVerificationDUnitTest extends DistributedTestCase
}
catch (Exception ex) {
- fail("failed while r.put()", ex);
+ Assert.fail("failed while r.put()", ex);
}
}
@@ -416,7 +418,7 @@ public class EventIDVerificationDUnitTest extends DistributedTestCase
r.destroy("key-1");
}
catch (Exception ex) {
- fail("test failed due to exception in destroy ", ex);
+ Assert.fail("test failed due to exception in destroy ", ex);
}
}
@@ -429,7 +431,7 @@ public class EventIDVerificationDUnitTest extends DistributedTestCase
r.remove("key-1");
}
catch (Exception ex) {
- fail("test failed due to exception in remove ", ex);
+ Assert.fail("test failed due to exception in remove ", ex);
}
}
@@ -442,7 +444,7 @@ public class EventIDVerificationDUnitTest extends DistributedTestCase
r.destroyRegion();
}
catch (Exception ex) {
- fail("test failed due to exception in destroyRegion ", ex);
+ Assert.fail("test failed due to exception in destroyRegion ", ex);
}
}
@@ -454,7 +456,7 @@ public class EventIDVerificationDUnitTest extends DistributedTestCase
r.clear();
}
catch (Exception ex) {
- fail("test failed due to exception in clearRegion ", ex);
+ Assert.fail("test failed due to exception in clearRegion ", ex);
}
}
@@ -486,9 +488,9 @@ public class EventIDVerificationDUnitTest extends DistributedTestCase
assertEquals(eventId, ((RegionEventImpl)event).getEventId());
}
- 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/EventIDVerificationInP2PDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/EventIDVerificationInP2PDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/EventIDVerificationInP2PDUnitTest.java
index 4e8b82d..d809a3d 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/EventIDVerificationInP2PDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/EventIDVerificationInP2PDUnitTest.java
@@ -31,6 +31,7 @@ import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.cache.EventID;
import com.gemstone.gemfire.internal.cache.InternalCacheEvent;
+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.VM;
@@ -216,7 +217,7 @@ public class EventIDVerificationInP2PDUnitTest extends DistributedTestCase
assertEquals(r.getEntry("key-1").getValue(), "key-1");
}
catch (Exception ex) {
- fail("failed while createEntries()", ex);
+ Assert.fail("failed while createEntries()", ex);
}
}
@@ -232,7 +233,7 @@ public class EventIDVerificationInP2PDUnitTest extends DistributedTestCase
}
catch (Exception ex) {
- fail("failed while r.put()", ex);
+ Assert.fail("failed while r.put()", ex);
}
}
@@ -244,7 +245,7 @@ public class EventIDVerificationInP2PDUnitTest extends DistributedTestCase
r.destroy("key-1");
}
catch (Exception ex) {
- fail("test failed due to exception in destroy ", ex);
+ Assert.fail("test failed due to exception in destroy ", ex);
}
}
@@ -256,7 +257,7 @@ public class EventIDVerificationInP2PDUnitTest extends DistributedTestCase
r.destroyRegion();
}
catch (Exception ex) {
- fail("test failed due to exception in destroyRegion ", ex);
+ Assert.fail("test failed due to exception in destroyRegion ", ex);
}
}
@@ -268,7 +269,7 @@ public class EventIDVerificationInP2PDUnitTest extends DistributedTestCase
r.invalidateRegion();
}
catch (Exception ex) {
- fail("test failed due to exception in invalidateRegion ", ex);
+ Assert.fail("test failed due to exception in invalidateRegion ", ex);
}
}
@@ -317,9 +318,9 @@ public class EventIDVerificationInP2PDUnitTest extends DistributedTestCase
assertTrue(pass.booleanValue());
}
- public void tearDown2() throws Exception
+ public void tearDownBeforeDisconnect() throws Exception
{
- super.tearDown2();
+ super.tearDownBeforeDisconnect();
closeCache();
vm0.invoke(EventIDVerificationInP2PDUnitTest.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/ForceInvalidateEvictionDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateEvictionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateEvictionDUnitTest.java
index 3d89089..e13644f 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateEvictionDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateEvictionDUnitTest.java
@@ -43,9 +43,13 @@ import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.CachedDeserializable;
import com.gemstone.gemfire.internal.cache.LocalRegion;
import com.gemstone.gemfire.internal.cache.Token;
+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;
/**
* @author dsmith
@@ -258,7 +262,7 @@ public class ForceInvalidateEvictionDUnitTest extends CacheTestCase {
Region region = cache.getRegion(name);
final MyListener listener = (MyListener) region.getAttributes().getCacheListeners()[0];
if(invalidated) {
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
public String description() {
return "Didn't receive invalidate after 30 seconds";
@@ -284,7 +288,7 @@ public class ForceInvalidateEvictionDUnitTest extends CacheTestCase {
Cache cache = getCache();
final LocalRegion region = (LocalRegion) cache.getRegion(name);
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
public boolean done() {
Object value = null;
@@ -341,7 +345,7 @@ public class ForceInvalidateEvictionDUnitTest extends CacheTestCase {
Cache cache = getCache();
PoolFactory pf = PoolManager.createFactory();
- pf.addServer(getServerHostName(host), port);
+ pf.addServer(NetworkSupport.getServerHostName(host), port);
pf.setSubscriptionEnabled(true);
pf.create(name);
RegionFactory rf = new RegionFactory();
@@ -366,7 +370,7 @@ public class ForceInvalidateEvictionDUnitTest extends CacheTestCase {
try {
server.start();
} catch (IOException e) {
- fail("IO Exception", e);
+ Assert.fail("IO Exception", e);
}
}
});
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e2f18f97/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateOffHeapEvictionDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateOffHeapEvictionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateOffHeapEvictionDUnitTest.java
index 7a441c6..690dda5 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateOffHeapEvictionDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateOffHeapEvictionDUnitTest.java
@@ -20,6 +20,7 @@ import java.util.Properties;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.cache.OffHeapTestUtil;
+import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
/**
@@ -35,7 +36,7 @@ public class ForceInvalidateOffHeapEvictionDUnitTest extends
}
@Override
- public void tearDown2() throws Exception {
+ public void tearDownBeforeDisconnect() throws Exception {
SerializableRunnable checkOrphans = new SerializableRunnable() {
@Override
@@ -45,11 +46,11 @@ public class ForceInvalidateOffHeapEvictionDUnitTest extends
}
}
};
- invokeInEveryVM(checkOrphans);
+ Invoke.invokeInEveryVM(checkOrphans);
try {
checkOrphans.run();
} finally {
- super.tearDown2();
+ super.tearDownBeforeDisconnect();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e2f18f97/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HABug36738DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HABug36738DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HABug36738DUnitTest.java
index 395047a..ee48c93 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HABug36738DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HABug36738DUnitTest.java
@@ -40,6 +40,7 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.ClientUpdateMessage;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
/**
* This is the bugtest for bug no. 36738. When Object of class
@@ -85,9 +86,9 @@ public class HABug36738DUnitTest extends DistributedTestCase
}
- public void tearDown2() throws Exception
+ public void tearDownBeforeDisconnect() throws Exception
{
- super.tearDown2();
+ super.tearDownBeforeDisconnect();
server1.invoke(HABug36738DUnitTest.class, "closeCache");
server2.invoke(HABug36738DUnitTest.class, "closeCache");
@@ -96,7 +97,7 @@ public class HABug36738DUnitTest extends DistributedTestCase
public void testBug36768() throws Exception
{
createServer1();
- pause(10000);
+ Wait.pause(10000);
server1.invoke(HABug36738DUnitTest.class, "checkRegionQueueSize");
createServer2();
server1.invoke(HABug36738DUnitTest.class, "checkRegionQueueSize");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e2f18f97/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestPart1DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestPart1DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestPart1DUnitTest.java
index e82faae..3616f9b 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestPart1DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestPart1DUnitTest.java
@@ -16,6 +16,8 @@
*/
package com.gemstone.gemfire.internal.cache.tier.sockets;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.NetworkSupport;
import com.gemstone.gemfire.test.dunit.VM;
@SuppressWarnings("serial")
@@ -29,7 +31,7 @@ public class HAInterestPart1DUnitTest extends HAInterestTestCase {
* Tests whether interest is registered or not on both primary and secondaries
*/
public void testInterestRegistrationOnBothPrimaryAndSecondary() throws Exception {
- createClientPoolCache(this.getName(), getServerHostName(server1.getHost()));
+ createClientPoolCache(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
createEntriesK1andK2();
server1.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
server2.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
@@ -46,7 +48,7 @@ public class HAInterestPart1DUnitTest extends HAInterestTestCase {
* verify their responses
*/
public void testInterestRegistrationResponseOnBothPrimaryAndSecondary() throws Exception {
- createClientPoolCache(this.getName(), getServerHostName(server1.getHost()));
+ createClientPoolCache(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
createEntriesK1andK2();
server1.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
server2.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
@@ -60,7 +62,7 @@ public class HAInterestPart1DUnitTest extends HAInterestTestCase {
* interest map
*/
public void testRERegistrationWillNotCreateDuplicateKeysOnServerInterstMaps() throws Exception {
- createClientPoolCache(this.getName(), getServerHostName(server1.getHost()));
+ createClientPoolCache(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
createEntriesK1andK2();
server1.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
server2.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
@@ -79,7 +81,7 @@ public class HAInterestPart1DUnitTest extends HAInterestTestCase {
* registerInterest
*/
public void testPrimaryFailureInRegisterInterest() throws Exception {
- createClientPoolCache(this.getName(), getServerHostName(server1.getHost()));
+ createClientPoolCache(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
createEntriesK1andK2();
server1.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
server2.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
@@ -100,7 +102,7 @@ public class HAInterestPart1DUnitTest extends HAInterestTestCase {
* list
*/
public void testSecondaryFailureInRegisterInterest() throws Exception {
- createClientPoolCache(this.getName(), getServerHostName(server1.getHost()));
+ createClientPoolCache(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
createEntriesK1andK2();
server1.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
server2.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
@@ -122,7 +124,7 @@ public class HAInterestPart1DUnitTest extends HAInterestTestCase {
* registration on newly selected primary
*/
public void testBothPrimaryAndSecondaryFailureInRegisterInterest() throws Exception {
- createClientPoolCache(this.getName(), getServerHostName(server1.getHost()));
+ createClientPoolCache(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
createEntriesK1andK2();
server1.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
server2.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
@@ -146,7 +148,7 @@ public class HAInterestPart1DUnitTest extends HAInterestTestCase {
*
*/
public void testProbablePrimaryFailureInRegisterInterest() throws Exception {
- createClientPoolCache(this.getName(), getServerHostName(server1.getHost()));
+ createClientPoolCache(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
createEntriesK1andK2();
server1.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
server2.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
@@ -166,10 +168,10 @@ public class HAInterestPart1DUnitTest extends HAInterestTestCase {
* client ( create CCP) as welll as register IL
*/
public void testInterstRegistrationOnRecoveredEPbyDSM() throws Exception {
- addExpectedException("SocketException");
- addExpectedException("Unexpected IOException");
+ IgnoredException.addIgnoredException("SocketException");
+ IgnoredException.addIgnoredException("Unexpected IOException");
- createClientPoolCache(this.getName(), getServerHostName(server1.getHost()));
+ createClientPoolCache(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
createEntriesK1andK2();
registerK1AndK2();
server1.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e2f18f97/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestPart2DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestPart2DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestPart2DUnitTest.java
index 28bee9f..b955d38 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestPart2DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestPart2DUnitTest.java
@@ -19,8 +19,11 @@ package com.gemstone.gemfire.internal.cache.tier.sockets;
import com.gemstone.gemfire.cache.EntryDestroyedException;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.client.ServerConnectivityException;
-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.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
@SuppressWarnings({"rawtypes", "serial"})
public class HAInterestPart2DUnitTest extends HAInterestTestCase {
@@ -34,7 +37,7 @@ public class HAInterestPart2DUnitTest extends HAInterestTestCase {
* failover should pick new primary
*/
public void testPrimaryFailureInUNregisterInterest() throws Exception {
- createClientPoolCache(this.getName(), getServerHostName(server1.getHost()));
+ createClientPoolCache(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
createEntriesK1andK2();
server1.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
server2.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
@@ -60,7 +63,7 @@ public class HAInterestPart2DUnitTest extends HAInterestTestCase {
* Ep list
*/
public void testSecondaryFailureInUNRegisterInterest() throws Exception {
- createClientPoolCache(this.getName(), getServerHostName(server1.getHost()));
+ createClientPoolCache(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
createEntriesK1andK2();
server1.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
server2.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
@@ -82,7 +85,7 @@ public class HAInterestPart2DUnitTest extends HAInterestTestCase {
* detected live server as well
*/
public void testDSMDetectsServerLiveJustBeforeInterestRegistration() throws Exception {
- createClientPoolCache(this.getName(), getServerHostName(server1.getHost()));
+ createClientPoolCache(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
createEntriesK1andK2();
server1.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
server2.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
@@ -108,7 +111,7 @@ public class HAInterestPart2DUnitTest extends HAInterestTestCase {
* detected live server as well
*/
public void testDSMDetectsServerLiveJustAfterInterestRegistration() throws Exception {
- createClientPoolCache(this.getName(), getServerHostName(server1.getHost()));
+ createClientPoolCache(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
createEntriesK1andK2();
server1.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
@@ -140,11 +143,11 @@ public class HAInterestPart2DUnitTest extends HAInterestTestCase {
* is primary
*/
public void testRefreshEntriesFromPrimaryWhenDSMDetectsServerLive() throws Exception {
- addExpectedException(ServerConnectivityException.class.getName());
+ IgnoredException.addIgnoredException(ServerConnectivityException.class.getName());
PORT1 = ((Integer) server1.invoke(HAInterestTestCase.class, "createServerCache")).intValue();
server1.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
- createClientPoolCacheConnectionToSingleServer(this.getName(), getServerHostName(server1.getHost()));
+ createClientPoolCacheConnectionToSingleServer(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
registerK1AndK2();
verifyRefreshedEntriesFromServer();
@@ -200,7 +203,7 @@ public class HAInterestPart2DUnitTest extends HAInterestTestCase {
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
}
/**
@@ -222,7 +225,7 @@ public class HAInterestPart2DUnitTest extends HAInterestTestCase {
server2.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
server3.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
- createClientPoolCache(this.getName(), getServerHostName(server1.getHost()));
+ createClientPoolCache(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
VM backup1 = getBackupVM();
VM backup2 = getBackupVM(backup1);
@@ -247,7 +250,7 @@ public class HAInterestPart2DUnitTest extends HAInterestTestCase {
public void testBug35945() throws Exception {
PORT1 = ((Integer) server1.invoke(HAInterestTestCase.class, "createServerCache")).intValue();
server1.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
- createClientPoolCacheConnectionToSingleServer(this.getName(), getServerHostName(server1.getHost()));
+ createClientPoolCacheConnectionToSingleServer(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
registerK1AndK2();
verifyRefreshedEntriesFromServer();
@@ -303,7 +306,7 @@ public class HAInterestPart2DUnitTest extends HAInterestTestCase {
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
}
/**
@@ -311,13 +314,13 @@ public class HAInterestPart2DUnitTest extends HAInterestTestCase {
* new endpoint to register interest
*/
public void testInterestRecoveryFailure() throws Exception {
- addExpectedException("Server unreachable");
+ IgnoredException.addIgnoredException("Server unreachable");
PORT1 = ((Integer) server1.invoke(HAInterestTestCase.class, "createServerCache")).intValue();
server1.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
PORT2 = ((Integer) server2.invoke(HAInterestTestCase.class, "createServerCache")).intValue();
server2.invoke(HAInterestTestCase.class, "createEntriesK1andK2");
- createClientPoolCacheWithSmallRetryInterval(this.getName(), getServerHostName(server1.getHost()));
+ createClientPoolCacheWithSmallRetryInterval(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
registerK1AndK2();
verifyRefreshedEntriesFromServer();
VM backup = getBackupVM();
@@ -368,6 +371,6 @@ public class HAInterestPart2DUnitTest extends HAInterestTestCase {
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, 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/HAInterestTestCase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestTestCase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestTestCase.java
index a80b21c..690b6c0 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestTestCase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestTestCase.java
@@ -41,7 +41,11 @@ import com.gemstone.gemfire.internal.cache.LocalRegion;
import com.gemstone.gemfire.internal.cache.tier.InterestType;
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.Threads;
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.IntegrationTest;
import java.io.IOException;
@@ -108,11 +112,11 @@ public class HAInterestTestCase extends DistributedTestCase {
PORT2 = ((Integer) server2.invoke(HAInterestTestCase.class, "createServerCache")).intValue();
PORT3 = ((Integer) server3.invoke(HAInterestTestCase.class, "createServerCache")).intValue();
exceptionOccured = false;
- addExpectedException("java.net.ConnectException: Connection refused: connect");
+ IgnoredException.addIgnoredException("java.net.ConnectException: Connection refused: connect");
}
@Override
- public void tearDown2() throws Exception {
+ public void tearDownBeforeDisconnect() throws Exception {
// close the clients first
closeCache();
@@ -175,7 +179,7 @@ public class HAInterestTestCase extends DistributedTestCase {
return "waiting for primary";
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
int primaryPort = pool.getPrimaryPort();
assertTrue(primaryPort != -1);
@@ -256,7 +260,7 @@ public class HAInterestTestCase extends DistributedTestCase {
return "waiting for client_k1 refresh from server";
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
wc = new WaitCriterion() {
@Override
@@ -272,7 +276,7 @@ public class HAInterestTestCase extends DistributedTestCase {
return "waiting for client_k2 refresh from server";
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
}
public static void verifyDeadAndLiveServers(final int expectedDeadServers, final int expectedLiveServers) {
@@ -286,7 +290,7 @@ public class HAInterestTestCase extends DistributedTestCase {
return "waiting for pool.getConnectedServerCount() == expectedLiveServer";
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
}
public static void putK1andK2() {
@@ -309,7 +313,7 @@ public class HAInterestTestCase extends DistributedTestCase {
};
t.start();
try {
- DistributedTestCase.join(t, 30 * 1000, getLogWriter());
+ Threads.join(t, 30 * 1000);
} catch (Exception ignore) {
exceptionOccured = true;
}
@@ -422,7 +426,7 @@ public class HAInterestTestCase extends DistributedTestCase {
return "waiting for cache.getCacheServers().size() == 1";
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
CacheServerImpl bs = (CacheServerImpl) cache.getCacheServers().iterator().next();
assertNotNull(bs);
@@ -440,7 +444,7 @@ public class HAInterestTestCase extends DistributedTestCase {
return "waiting for ccn.getClientProxies().size() > 0";
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
wc = new WaitCriterion() {
Iterator iter_prox;
@@ -462,7 +466,7 @@ public class HAInterestTestCase extends DistributedTestCase {
return "waiting for CacheClientProxy _messageDispatcher to be alive";
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
}
public static void verifyDispatcherIsNotAlive() {
@@ -476,7 +480,7 @@ public class HAInterestTestCase extends DistributedTestCase {
return "cache.getCacheServers().size() == 1";
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
CacheServerImpl bs = (CacheServerImpl) cache.getCacheServers().iterator().next();
assertNotNull(bs);
@@ -494,7 +498,7 @@ public class HAInterestTestCase extends DistributedTestCase {
return "waiting for ccn.getClientProxies().size() > 0";
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
Iterator iter_prox = ccn.getClientProxies().iterator();
if (iter_prox.hasNext()) {
@@ -590,7 +594,7 @@ public class HAInterestTestCase extends DistributedTestCase {
return "connected server count never became 3";
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
// close primaryEP
getPrimaryVM().invoke(HAInterestTestCase.class, "stopServer");
@@ -620,7 +624,7 @@ public class HAInterestTestCase extends DistributedTestCase {
return "connected server count never became 3";
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
// close primaryEP
getPrimaryVM().invoke(HAInterestTestCase.class, "stopServer");
@@ -644,7 +648,7 @@ public class HAInterestTestCase extends DistributedTestCase {
return "connected server count never became 3";
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
// close primaryEP
VM backup = getBackupVM();
@@ -681,7 +685,7 @@ public class HAInterestTestCase extends DistributedTestCase {
return "Never got three connected servers";
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
// close secondary EP
VM result = getBackupVM();
@@ -717,7 +721,7 @@ public class HAInterestTestCase extends DistributedTestCase {
return "connected server count never became 3";
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
// close secondary EP
VM result = getBackupVM();
@@ -767,7 +771,7 @@ public class HAInterestTestCase extends DistributedTestCase {
return "waiting for cache.getCacheServers().size() == 1";
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
CacheServerImpl bs = (CacheServerImpl) cache.getCacheServers().iterator().next();
assertNotNull(bs);
@@ -785,7 +789,7 @@ public class HAInterestTestCase extends DistributedTestCase {
return "waiting for ccn.getClientProxies().size() > 0";
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
Iterator iter_prox = ccn.getClientProxies().iterator();
@@ -805,7 +809,7 @@ public class HAInterestTestCase extends DistributedTestCase {
return "waiting for keys of interest to include 2 keys";
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
Set keysMap = (Set) ccp.cils[RegisterInterestTracker.interestListIndex].getProfile(Region.SEPARATOR + REGION_NAME)
.getKeysOfInterestFor(ccp.getProxyID());
@@ -827,7 +831,7 @@ public class HAInterestTestCase extends DistributedTestCase {
return "waiting for cache.getCacheServers().size() == 1";
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
CacheServerImpl bs = (CacheServerImpl) cache.getCacheServers().iterator().next();
assertNotNull(bs);
@@ -845,7 +849,7 @@ public class HAInterestTestCase extends DistributedTestCase {
return "waiting for ccn.getClientProxies().size() > 0";
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
Iterator iter_prox = ccn.getClientProxies().iterator();
if (iter_prox.hasNext()) {
@@ -864,7 +868,7 @@ public class HAInterestTestCase extends DistributedTestCase {
return "waiting for keys of interest to not be null";
}
};
- DistributedTestCase.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
+ Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
Set keysMap = (Set) ccp.cils[RegisterInterestTracker.interestListIndex]
.getProfile(Region.SEPARATOR + REGION_NAME)
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e2f18f97/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java
index 54ef4c0..91d908a 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java
@@ -38,9 +38,14 @@ import com.gemstone.gemfire.distributed.internal.ServerLocation;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.ClientServerObserverAdapter;
import com.gemstone.gemfire.internal.cache.ClientServerObserverHolder;
+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.IgnoredException;
+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.internal.cache.CacheServerImpl;
/**
@@ -81,8 +86,8 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
server2 = host.getVM(1);
server3 = host.getVM(2);
- addExpectedException("java.io.IOException");
- addExpectedException("SocketException");
+ IgnoredException.addIgnoredException("java.io.IOException");
+ IgnoredException.addIgnoredException("SocketException");
// start servers first
PORT1 = ((Integer) server1.invoke(HAStartupAndFailoverDUnitTest.class, "createServerCache"));
@@ -98,7 +103,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
public void testPrimaryFailover() throws Exception
{
- createClientCache(this.getName(), getServerHostName(server1.getHost()));
+ createClientCache(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
// primary
server1.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
@@ -146,7 +151,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
public void testExceptionWhileMakingPrimary()throws Exception
{
- createClientCacheWithIncorrectPrimary(this.getName(), getServerHostName(server1.getHost()));
+ createClientCacheWithIncorrectPrimary(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
// failed primary due to incorect host name of the server
// new primary
@@ -175,7 +180,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
public void testTwoPrimaryFailedOneAfterTheAnother() throws Exception
{
- createClientCacheWithLargeRetryInterval(this.getName(), getServerHostName(server1.getHost()));
+ createClientCacheWithLargeRetryInterval(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
// primary
server1.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
@@ -202,7 +207,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
*/
public void testPrimaryShouldBeNullAndEPListShouldBeEmptyWhenAllServersAreDead() throws Exception
{
- createClientCache(this.getName(), getServerHostName(server1.getHost()));
+ createClientCache(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
verifyPrimaryShouldNotBeNullAndEPListShouldNotBeEmpty();
server1.invoke(HAStartupAndFailoverDUnitTest.class, "stopServer");
server2.invoke(HAStartupAndFailoverDUnitTest.class, "stopServer");
@@ -216,7 +221,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
*/
public void testCacheClientUpdatersInitiatesFailoverOnPrimaryFailure() throws Exception
{
- createClientCacheWithLargeRetryInterval(this.getName(), getServerHostName(server1.getHost()));
+ createClientCacheWithLargeRetryInterval(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
server1.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
server2.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
server3.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
@@ -234,7 +239,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
*/
public void testCacheClientUpdaterInitiatesFailoverOnSecondaryFailure() throws Exception
{
- createClientCacheWithLargeRetryInterval(this.getName(), getServerHostName(server1.getHost()));
+ createClientCacheWithLargeRetryInterval(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
server1.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
server2.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
server3.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
@@ -253,7 +258,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
public void testCacheClientUpdaterInitiatesFailoverOnBothPrimaryAndSecondaryFailure() throws Exception
{
- createClientCacheWithLargeRetryInterval(this.getName(), getServerHostName(server1.getHost()));
+ createClientCacheWithLargeRetryInterval(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
server1.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
server2.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
server3.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
@@ -271,7 +276,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
public void testCacheClientUpdaterInitiatesFailoverOnBothPrimaryAndSecondaryFailureWithServerMonitors() throws Exception
{
- createClientCache(this.getName(), getServerHostName(server1.getHost()));
+ createClientCache(this.getName(), NetworkSupport.getServerHostName(server1.getHost()));
server1.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
server2.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
server3.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
@@ -290,7 +295,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
// create a client with large retry interval for server monitors and no client updater thread
// so that only cache operation can detect a server failure and should initiate failover
createClientCacheWithLargeRetryIntervalAndWithoutCallbackConnection(this.getName()
- , getServerHostName(server1.getHost()));
+ , NetworkSupport.getServerHostName(server1.getHost()));
server2.invoke(HAStartupAndFailoverDUnitTest.class, "stopServer");
put();
verifyDeadAndLiveServers(1,2);
@@ -305,7 +310,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
r1.put("key-3", "server-value-3");
}
catch (Exception ex) {
- fail("failed while r.put()", ex);
+ Assert.fail("failed while r.put()", ex);
}
}
@@ -321,7 +326,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
// while (proxy.getDeadServers().size() != expectedDeadServers) { // wait until condition is met
// assertTrue("Waited over " + maxWaitTime + "for dead servers to become : " + expectedDeadServers ,
// //" This issue can occur on Solaris as DSM thread get stuck in connectForServer() call, and hence not recovering any newly started server. This may be beacuase of tcp_ip_abort_cinterval kernal level property on solaris which has 3 minutes as a default value ",
@@ -393,7 +398,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
assertNotNull(" Primary endpoint should not be null", pool.getPrimaryName());
assertTrue("Endpoint List should not be Empty as all server are live",pool.getConnectedServerCount() > 0);
}catch(Exception e){
- fail("failed while verifyPrimaryShouldNotBeNullAndEPListShouldNotBeEmpty()", e);
+ Assert.fail("failed while verifyPrimaryShouldNotBeNullAndEPListShouldNotBeEmpty()", e);
}
}
@@ -404,7 +409,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
} catch (NoSubscriptionServersAvailableException e) {
// pass
} catch(Exception e){
- fail("failed while verifyPrimaryShouldBeNullAndEPListShouldBeEmpty()", e);
+ Assert.fail("failed while verifyPrimaryShouldBeNullAndEPListShouldBeEmpty()", e);
}
}
@@ -462,7 +467,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
CacheServerImpl bs = (CacheServerImpl)cache.getCacheServers()
.iterator().next();
@@ -479,7 +484,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
Collection<CacheClientProxy> proxies = ccn.getClientProxies();
Iterator<CacheClientProxy> iter_prox = proxies.iterator();
@@ -495,7 +500,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
// assertTrue("Dispatcher on primary should be alive",
// proxy._messageDispatcher.isAlive());
@@ -522,7 +527,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
CacheServerImpl bs = (CacheServerImpl)c.getCacheServers().iterator()
.next();
@@ -539,7 +544,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
Iterator iter_prox = ccn.getClientProxies().iterator();
if (iter_prox.hasNext()) {
@@ -712,9 +717,9 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
}
- public void tearDown2() throws Exception
+ public void tearDownBeforeDisconnect() throws Exception
{
- super.tearDown2();
+ 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/InstantiatorPropagationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InstantiatorPropagationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InstantiatorPropagationDUnitTest.java
index 17ef1cc..27c3586 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InstantiatorPropagationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InstantiatorPropagationDUnitTest.java
@@ -45,9 +45,14 @@ import com.gemstone.gemfire.internal.cache.CacheServerImpl;
import com.gemstone.gemfire.internal.cache.ClientServerObserverAdapter;
import com.gemstone.gemfire.internal.cache.ClientServerObserverHolder;
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.Invoke;
+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;
public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
private static Cache cache = null;
@@ -144,8 +149,8 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
}
@Override
- public void tearDown2() throws Exception {
- super.tearDown2();
+ public void tearDownBeforeDisconnect() throws Exception {
+ super.tearDownBeforeDisconnect();
// close the clients first
closeCache();
client1.invoke(InstantiatorPropagationDUnitTest.class, "closeCache");
@@ -163,7 +168,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
}
public static void unregisterInstantiatorsInAllVMs() {
- invokeInEveryVM(DistributedTestCase.class, "unregisterInstantiatorsInThisVM");
+ Invoke.invokeInEveryVM(DistributedTestCase.class, "unregisterInstantiatorsInThisVM");
}
public static void verifyInstantiators(final int numOfInstantiators) {
@@ -180,7 +185,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
+ " instantiators=" + java.util.Arrays.toString(InternalInstantiator.getInstantiators());
}
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
}
public static void registerTestObject1() throws Exception {
@@ -192,7 +197,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
obj.init(0);
}
catch (Exception e) {
- fail("Test failed due to exception in TestObject1", e);
+ Assert.fail("Test failed due to exception in TestObject1", e);
}
}
@@ -204,7 +209,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
obj.init(0);
}
catch (Exception e) {
- fail("Test failed due to exception in TestObject2", e);
+ Assert.fail("Test failed due to exception in TestObject2", e);
}
}
@@ -216,7 +221,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
obj.init(0);
}
catch (Exception e) {
- fail("Test failed due to exception in TestObject3", e);
+ Assert.fail("Test failed due to exception in TestObject3", e);
}
}
@@ -228,7 +233,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
obj.init(0);
}
catch (Exception e) {
- fail("Test failed due to exception in TestObject4", e);
+ Assert.fail("Test failed due to exception in TestObject4", e);
}
}
@@ -240,7 +245,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
obj.init(0);
}
catch (Exception e) {
- fail("Test failed due to exception in TestObject5", e);
+ Assert.fail("Test failed due to exception in TestObject5", e);
}
}
@@ -252,7 +257,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
obj.init(0);
}
catch (Exception e) {
- fail("Test failed due to exception in TestObject6", e);
+ Assert.fail("Test failed due to exception in TestObject6", e);
}
}
@@ -264,7 +269,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
obj.init(0);
}
catch (Exception e) {
- fail("Test failed due to exception in TestObject7", e);
+ Assert.fail("Test failed due to exception in TestObject7", e);
}
}
@@ -276,7 +281,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
obj.init(0);
}
catch (Exception e) {
- fail("Test failed due to exception in TestObject8", e);
+ Assert.fail("Test failed due to exception in TestObject8", e);
}
}
@@ -288,7 +293,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
obj.init(0);
}
catch (Exception e) {
- fail("Test failed due to exception in TestObject9", e);
+ Assert.fail("Test failed due to exception in TestObject9", e);
}
}
@@ -300,7 +305,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
obj.init(0);
}
catch (Exception e) {
- fail("Test failed due to exception in TestObject10", e);
+ Assert.fail("Test failed due to exception in TestObject10", e);
}
}
@@ -312,7 +317,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
obj.init(0);
}
catch (Exception e) {
- fail("Test failed due to exception in TestObject11", e);
+ Assert.fail("Test failed due to exception in TestObject11", e);
}
}
@@ -324,7 +329,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
obj.init(0);
}
catch (Exception e) {
- fail("Test failed due to exception in TestObject11", e);
+ Assert.fail("Test failed due to exception in TestObject11", e);
}
}
@@ -336,7 +341,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
obj.init(0);
}
catch (Exception e) {
- fail("Test failed due to exception in TestObject13", e);
+ Assert.fail("Test failed due to exception in TestObject13", e);
}
}
@@ -348,7 +353,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
obj.init(0);
}
catch (Exception e) {
- fail("Test failed due to exception in TestObject14", e);
+ Assert.fail("Test failed due to exception in TestObject14", e);
}
}
@@ -360,7 +365,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
obj.init(0);
}
catch (Exception e) {
- fail("Test failed due to exception in TestObject15", e);
+ Assert.fail("Test failed due to exception in TestObject15", e);
}
}
@@ -372,7 +377,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
obj.init(0);
}
catch (Exception e) {
- fail("Test failed due to exception in TestObject16", e);
+ Assert.fail("Test failed due to exception in TestObject16", e);
}
}
@@ -384,7 +389,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
obj.init(0);
}
catch (Exception e) {
- fail("Test failed due to exception in TestObject17", e);
+ Assert.fail("Test failed due to exception in TestObject17", e);
}
}
@@ -396,7 +401,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
obj.init(0);
}
catch (Exception e) {
- fail("Test failed due to exception in TestObject18", e);
+ Assert.fail("Test failed due to exception in TestObject18", e);
}
}
@@ -408,7 +413,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
obj.init(0);
}
catch (Exception e) {
- fail("Test failed due to exception in TestObject19", e);
+ Assert.fail("Test failed due to exception in TestObject19", e);
}
}
@@ -420,7 +425,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
obj.init(0);
}
catch (Exception e) {
- fail("Test failed due to exception in TestObject20", e);
+ Assert.fail("Test failed due to exception in TestObject20", e);
}
}
@@ -463,7 +468,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
unregisterInstantiatorsInAllVMs();
- pause(3000);
+ Wait.pause(3000);
server1.invoke(InstantiatorPropagationDUnitTest.class,
"registerTestObject1");
@@ -475,11 +480,11 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
client1
.invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { getServerHostName(server1.getHost()),
+ new Object[] { NetworkSupport.getServerHostName(server1.getHost()),
new Integer(PORT1) });
// // wait for client2 to come online
- pause(3000);
+ Wait.pause(3000);
//
client1.invoke(InstantiatorPropagationDUnitTest.class,
"verifyInstantiators", new Object[] { new Integer(2) });
@@ -512,7 +517,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
}
});
//
- pause(3000);
+ Wait.pause(3000);
// Run getAll
client1.invoke(new CacheSerializableRunnable("Get entry from client") {
public void run2() throws CacheException {
@@ -536,26 +541,26 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
PORT1 = initServerCache(server1);
PORT2 = initServerCache(server2);
- pause(3000);
+ Wait.pause(3000);
client1
.invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { getServerHostName(server1.getHost()),
+ new Object[] { NetworkSupport.getServerHostName(server1.getHost()),
new Integer(PORT1) });
client2
.invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { getServerHostName(server1.getHost()),
+ new Object[] { NetworkSupport.getServerHostName(server1.getHost()),
new Integer(PORT2) });
unregisterInstantiatorsInAllVMs();
// wait for client2 to come online
- pause(2000);
+ Wait.pause(2000);
client1.invoke(InstantiatorPropagationDUnitTest.class,
"registerTestObject3");
- pause(4000);
+ Wait.pause(4000);
client1.invoke(InstantiatorPropagationDUnitTest.class,
"verifyInstantiators", new Object[] { new Integer(1) });
@@ -584,21 +589,21 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
client1
.invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { getServerHostName(server1.getHost()),
+ new Object[] { NetworkSupport.getServerHostName(server1.getHost()),
new Integer(PORT1) });
client2
.invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { getServerHostName(server1.getHost()),
+ new Object[] { NetworkSupport.getServerHostName(server1.getHost()),
new Integer(PORT2) });
unregisterInstantiatorsInAllVMs();
// wait for client2 to come online
- pause(2000);
+ Wait.pause(2000);
client1.invoke(InstantiatorPropagationDUnitTest.class,
"registerTestObject4");
- pause(4000);
+ Wait.pause(4000);
server1.invoke(InstantiatorPropagationDUnitTest.class, "stopServer");
@@ -639,25 +644,25 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
client1
.invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { getServerHostName(server1.getHost()),
+ new Object[] { NetworkSupport.getServerHostName(server1.getHost()),
new Integer(PORT1) });
client2
.invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { getServerHostName(server1.getHost()),
+ new Object[] { NetworkSupport.getServerHostName(server1.getHost()),
new Integer(PORT2) });
unregisterInstantiatorsInAllVMs();
// wait for client2 to come online
- pause(2000);
+ Wait.pause(2000);
client1.invoke(InstantiatorPropagationDUnitTest.class,
"registerTestObject10");
- pause(4000);
+ Wait.pause(4000);
server1.invoke(InstantiatorPropagationDUnitTest.class,
"registerTestObject11");
- pause(4000);
+ Wait.pause(4000);
server2.invoke(InstantiatorPropagationDUnitTest.class,
"verifyInstantiators", new Object[] { new Integer(2) });
@@ -683,11 +688,11 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
PORT2 = initServerCache(server2);
client1
.invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { getServerHostName(server1.getHost()),
+ new Object[] { NetworkSupport.getServerHostName(server1.getHost()),
new Integer(PORT1) });
client2
.invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { getServerHostName(server1.getHost()),
+ new Object[] { NetworkSupport.getServerHostName(server1.getHost()),
new Integer(PORT2) });
unregisterInstantiatorsInAllVMs();
@@ -751,21 +756,21 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
client1
.invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { getServerHostName(server1.getHost()),
+ new Object[] { NetworkSupport.getServerHostName(server1.getHost()),
new Integer(PORT1) });
client2
.invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { getServerHostName(server1.getHost()),
+ new Object[] { NetworkSupport.getServerHostName(server1.getHost()),
new Integer(PORT1) });
- createClientCache(getServerHostName(server2.getHost()), new Integer(PORT2));
+ createClientCache(NetworkSupport.getServerHostName(server2.getHost()), new Integer(PORT2));
unregisterInstantiatorsInAllVMs();
// wait for client2 to come online
- pause(2000);
+ Wait.pause(2000);
client1.invoke(InstantiatorPropagationDUnitTest.class,
"registerTestObject12");
- pause(4000);
+ Wait.pause(4000);
client1.invoke(InstantiatorPropagationDUnitTest.class,
"verifyInstantiators", new Object[] { new Integer(1) });
@@ -810,20 +815,20 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
PORT1 = initServerCache(server1, 1);
PORT2 = initServerCache(server2, 2);
- createClientCache_EventId(getServerHostName(server1.getHost()), new Integer(PORT1));
+ createClientCache_EventId(NetworkSupport.getServerHostName(server1.getHost()), new Integer(PORT1));
unregisterInstantiatorsInAllVMs();
client2.invoke(InstantiatorPropagationDUnitTest.class,
"createClientCache_EventId", new Object[] {
- getServerHostName(server1.getHost()), new Integer(PORT2) });
+ NetworkSupport.getServerHostName(server1.getHost()), new Integer(PORT2) });
setClientServerObserver1();
client2.invoke(InstantiatorPropagationDUnitTest.class,
"setClientServerObserver2");
registerTestObject19();
- pause(10000);
+ Wait.pause(10000);
Boolean pass = (Boolean)client2.invoke(
InstantiatorPropagationDUnitTest.class, "verifyResult");
@@ -841,17 +846,17 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
unregisterInstantiatorsInAllVMs();
- pause(3000);
+ Wait.pause(3000);
- createClientCache(getServerHostName(server1.getHost()),
+ createClientCache(NetworkSupport.getServerHostName(server1.getHost()),
new Integer(PORT1));
client2
.invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] {getServerHostName(server2.getHost()),
+ new Object[] {NetworkSupport.getServerHostName(server2.getHost()),
new Integer(PORT2)});
- pause(3000);
+ Wait.pause(3000);
unregisterInstantiatorsInAllVMs();
assertTestObject20NotLoaded();
@@ -860,7 +865,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
client2.invoke(InstantiatorPropagationDUnitTest.class, "assertTestObject20NotLoaded");
registerTestObject20();
- pause(5000);
+ Wait.pause(5000);
assertTestObject20Loaded();
server1.invoke(InstantiatorPropagationDUnitTest.class, "assertTestObject20Loaded");
//server2.invoke(InstantiatorPropagationDUnitTest.class, "assertTestObject20Loaded"); // classes are not initialized after loading in p2p path
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e2f18f97/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListDUnitTest.java
index 8bc4e42..7d12988 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListDUnitTest.java
@@ -47,10 +47,15 @@ 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.CacheServerImpl;
+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.Invoke;
+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;
import com.gemstone.gemfire.cache.client.*;
import com.gemstone.gemfire.cache.NoSubscriptionServersAvailableException;
@@ -131,7 +136,7 @@ public class InterestListDUnitTest extends DistributedTestCase
public void setUp() throws Exception {
super.setUp();
disconnectAllFromDS();
- pause(10000);
+ Wait.pause(10000);
final Host host = Host.getHost(0);
vm0 = host.getVM(0);
vm1 = host.getVM(1);
@@ -161,9 +166,9 @@ public class InterestListDUnitTest extends DistributedTestCase
{
vm1.invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- getServerHostName(vm0.getHost()), new Integer(PORT1)});
+ NetworkSupport.getServerHostName(vm0.getHost()), new Integer(PORT1)});
vm2.invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- getServerHostName(vm0.getHost()), new Integer(PORT1)});
+ NetworkSupport.getServerHostName(vm0.getHost()), new Integer(PORT1)});
vm1.invoke(InterestListDUnitTest.class, "createEntriesK1andK2");
vm2.invoke(InterestListDUnitTest.class, "createEntriesK1andK2");
@@ -174,11 +179,11 @@ public class InterestListDUnitTest extends DistributedTestCase
new Object[] { key2 });
vm1.invoke(InterestListDUnitTest.class, "put", new Object[] { "vm1" });
- pause(10000);
+ Wait.pause(10000);
vm2.invoke(InterestListDUnitTest.class, "validateEntriesK1andK2",
new Object[] { "vm2" });
vm2.invoke(InterestListDUnitTest.class, "put", new Object[] { "vm2" });
- pause(10000);
+ Wait.pause(10000);
vm1.invoke(InterestListDUnitTest.class, "validateEntriesK1andK2",
new Object[] { "vm1" });
@@ -188,11 +193,11 @@ public class InterestListDUnitTest extends DistributedTestCase
new Object[] { key2 });
vm1.invoke(InterestListDUnitTest.class, "putAgain", new Object[] { "vm1" });
- pause(10000);
+ Wait.pause(10000);
vm2.invoke(InterestListDUnitTest.class, "validateEntriesAgain",
new Object[] { "vm2" });
vm2.invoke(InterestListDUnitTest.class, "putAgain", new Object[] { "vm2" });
- pause(10000);
+ Wait.pause(10000);
vm1.invoke(InterestListDUnitTest.class, "validateEntriesAgain",
new Object[] { "vm1" });
}
@@ -226,9 +231,9 @@ public class InterestListDUnitTest extends DistributedTestCase
// Initialization
vm1.invoke(InterestListDUnitTest.class, "createClientCache",
- new Object[] { getServerHostName(Host.getHost(0)), new Integer(PORT1)});
+ new Object[] { NetworkSupport.getServerHostName(Host.getHost(0)), new Integer(PORT1)});
vm2.invoke(InterestListDUnitTest.class, "createClientCache",
- new Object[] { getServerHostName(Host.getHost(0)), new Integer(PORT1)});
+ new Object[] { NetworkSupport.getServerHostName(Host.getHost(0)), new Integer(PORT1)});
vm1.invoke(InterestListDUnitTest.class, "createEntriesK1andK2");
vm2.invoke(InterestListDUnitTest.class, "createEntriesK1andK2");
@@ -236,7 +241,7 @@ public class InterestListDUnitTest extends DistributedTestCase
// STEP 1
vm2.invoke(InterestListDUnitTest.class, "putSingleEntry",
new Object[] { key2, "vm2" });
- pause(2000);
+ Wait.pause(2000);
vm1.invoke(InterestListDUnitTest.class, "validateSingleEntry",
new Object[] {key2, key2_originalValue});
@@ -254,7 +259,7 @@ public class InterestListDUnitTest extends DistributedTestCase
// STEP 3
vm1.invoke(InterestListDUnitTest.class, "putSingleEntry",
new Object[] { key1, "vm1" });
- pause(2000);
+ Wait.pause(2000);
vm2.invoke(InterestListDUnitTest.class, "validateSingleEntry",
new Object[] {key1, key1_originalValue}); // still unchanged
vm2.invoke(InterestListDUnitTest.class, "registerKey",
@@ -269,7 +274,7 @@ public class InterestListDUnitTest extends DistributedTestCase
new Object[] { key1 });
vm1.invoke(InterestListDUnitTest.class, "putSingleEntry",
new Object[] { key1, key1_originalValue });
- pause(2000);
+ Wait.pause(2000);
vm2.invoke(InterestListDUnitTest.class, "validateSingleEntry",
new Object[] {key1, "vm1"}); // update lost
}
@@ -284,9 +289,9 @@ public class InterestListDUnitTest extends DistributedTestCase
{
vm1.invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- getServerHostName(vm0.getHost()), new Integer(PORT1)});
+ NetworkSupport.getServerHostName(vm0.getHost()), new Integer(PORT1)});
vm2.invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- getServerHostName(vm0.getHost()), new Integer(PORT1)});
+ NetworkSupport.getServerHostName(vm0.getHost()), new Integer(PORT1)});
vm1.invoke(InterestListDUnitTest.class, "createEntriesK1andK2");
vm2.invoke(InterestListDUnitTest.class, "createEntriesK1andK2");
@@ -294,7 +299,7 @@ public class InterestListDUnitTest extends DistributedTestCase
vm2.invoke(InterestListDUnitTest.class, "registerALL_KEYS");
vm1.invoke(InterestListDUnitTest.class, "put_ALL_KEYS");
- pause(10000);
+ Wait.pause(10000);
vm2.invoke(InterestListDUnitTest.class, "validate_ALL_KEYS");
}
@@ -311,17 +316,17 @@ public class InterestListDUnitTest extends DistributedTestCase
{
// directly put on server
vm0.invoke(InterestListDUnitTest.class, "multiple_put");
- pause(1000);
+ Wait.pause(1000);
// create clients to connect to that server
vm1.invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- getServerHostName(vm0.getHost()), new Integer(PORT1)});
+ NetworkSupport.getServerHostName(vm0.getHost()), new Integer(PORT1)});
vm2.invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- getServerHostName(vm0.getHost()), new Integer(PORT1)});
+ NetworkSupport.getServerHostName(vm0.getHost()), new Integer(PORT1)});
// register interest
vm1.invoke(InterestListDUnitTest.class, "registerKeys");
vm2.invoke(InterestListDUnitTest.class, "registerKeysAgain");
- pause(10000);
+ Wait.pause(10000);
// verify the values for registered keys
vm1.invoke(InterestListDUnitTest.class,
"validateRegionEntriesFromInterestListInVm1");
@@ -352,10 +357,10 @@ public class InterestListDUnitTest extends DistributedTestCase
DistributedMember c1 = (DistributedMember)vm1
.invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- getServerHostName(vm0.getHost()), PORT1});
+ NetworkSupport.getServerHostName(vm0.getHost()), PORT1});
DistributedMember c2 = (DistributedMember)vm2
.invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- getServerHostName(vm0.getHost()), PORT1});
+ NetworkSupport.getServerHostName(vm0.getHost()), PORT1});
vm1.invoke(InterestListDUnitTest.class, "createEntriesK1andK2");
vm2.invoke(InterestListDUnitTest.class, "createEntriesK1andK2");
@@ -413,7 +418,7 @@ public class InterestListDUnitTest extends DistributedTestCase
server = addCacheServer();
port2 = server.getPort();
} catch (Exception ex) {
- fail("Cache creation threw an exception", ex);
+ Assert.fail("Cache creation threw an exception", ex);
}
addRegisterInterestListener();
@@ -422,10 +427,10 @@ public class InterestListDUnitTest extends DistributedTestCase
// servers are set up, now do the clients
DistributedMember c1 = (DistributedMember)vm1
.invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- getServerHostName(vm0.getHost()), PORT1, port2});
+ NetworkSupport.getServerHostName(vm0.getHost()), PORT1, port2});
DistributedMember c2 = (DistributedMember)vm2
.invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- getServerHostName(vm0.getHost()), PORT1, port2});
+ NetworkSupport.getServerHostName(vm0.getHost()), PORT1, port2});
vm1.invoke(InterestListDUnitTest.class, "createEntriesK1andK2");
vm2.invoke(InterestListDUnitTest.class, "createEntriesK1andK2");
@@ -490,7 +495,7 @@ public class InterestListDUnitTest extends DistributedTestCase
// Register interest in key1.
vm1.invoke(InterestListDUnitTest.class, "createClientCache",
- new Object[] { getServerHostName(vm0.getHost()), new Integer(PORT1) });
+ new Object[] { NetworkSupport.getServerHostName(vm0.getHost()), new Integer(PORT1) });
vm1.invoke(InterestListDUnitTest.class, "registerKey",
new Object[] { key1 });
@@ -529,7 +534,7 @@ public class InterestListDUnitTest extends DistributedTestCase
// Create client cache
vm1.invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- getServerHostName(vm0.getHost()), port1, port2});
+ NetworkSupport.getServerHostName(vm0.getHost()), port1, port2});
// Register interest in all keys
vm1.invoke(InterestListDUnitTest.class, "registerALL_KEYS");
@@ -657,7 +662,7 @@ public class InterestListDUnitTest extends DistributedTestCase
return "waiting for queues to drain for " + fproxy.getProxyID();
}
};
- DistributedTestCase.waitForCriterion(ev, 5 * 10 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 5 * 10 * 1000, 200, true);
}
}
@@ -703,7 +708,7 @@ public class InterestListDUnitTest extends DistributedTestCase
return "waiting for " + fCacheListener.getExpectedCreates() + " create events";
}
};
- DistributedTestCase.waitForCriterion(ev, 5 * 10 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 5 * 10 * 1000, 200, true);
}
private static void confirmNoCacheListenerUpdates() throws Exception {
@@ -742,7 +747,7 @@ public class InterestListDUnitTest extends DistributedTestCase
assertEquals(r.getEntry(key2).getValue(), key2_originalValue);
}
catch (Exception ex) {
- fail("failed while createEntries()", ex);
+ Assert.fail("failed while createEntries()", ex);
}
}
@@ -759,7 +764,7 @@ public class InterestListDUnitTest extends DistributedTestCase
registerKeyOnly(key);
}
catch (Exception ex) {
- fail("failed while registering key(" + key + ")", ex);
+ Assert.fail("failed while registering key(" + key + ")", ex);
}
}
@@ -777,7 +782,7 @@ public class InterestListDUnitTest extends DistributedTestCase
InterestResultPolicy.KEYS_VALUES, false);
}
} catch (Exception ex) {
- fail("failed while registering key(" + key + ")", ex);
+ Assert.fail("failed while registering key(" + key + ")", ex);
}
}
@@ -801,7 +806,7 @@ public class InterestListDUnitTest extends DistributedTestCase
r.registerInterest("ALL_KEYS");
}
catch (Exception ex) {
- fail("failed while registering ALL_KEYS", ex);
+ Assert.fail("failed while registering ALL_KEYS", ex);
}
}
@@ -817,7 +822,7 @@ public class InterestListDUnitTest extends DistributedTestCase
assertEquals(r.getEntry(key2).getValue(), "vm1-key-2");
}
catch (Exception ex) {
- fail("failed while put_ALL_KEY()", ex);
+ Assert.fail("failed while put_ALL_KEY()", ex);
}
}
@@ -830,7 +835,7 @@ public class InterestListDUnitTest extends DistributedTestCase
assertEquals(r.getEntry(key2).getValue(), "vm1-key-2");
}
catch (Exception ex) {
- fail("failed while validate_ALL_KEY", ex);
+ Assert.fail("failed while validate_ALL_KEY", ex);
}
}
@@ -845,7 +850,7 @@ public class InterestListDUnitTest extends DistributedTestCase
r.registerInterest(list);
}
catch (Exception ex) {
- fail("failed while registering keys" + list + "", ex);
+ Assert.fail("failed while registering keys" + list + "", ex);
}
}
@@ -860,7 +865,7 @@ public class InterestListDUnitTest extends DistributedTestCase
r.registerInterest(list);
}
catch (Exception ex) {
- fail("failed while registering keys" + list + "", ex);
+ Assert.fail("failed while registering keys" + list + "", ex);
}
}
@@ -877,7 +882,7 @@ public class InterestListDUnitTest extends DistributedTestCase
unregisterKeyOnly(key);
}
catch (Exception ex) {
- fail("failed while un-registering key(" + key + ")", ex);
+ Assert.fail("failed while un-registering key(" + key + ")", ex);
}
}
@@ -895,7 +900,7 @@ public class InterestListDUnitTest extends DistributedTestCase
}
}
catch (Exception ex) {
- fail("failed while un-registering key(" + key + ") for client " + clientId, ex);
+ Assert.fail("failed while un-registering key(" + key + ") for client " + clientId, ex);
}
}
@@ -934,7 +939,7 @@ public class InterestListDUnitTest extends DistributedTestCase
assertEquals(r.getEntry(key).getValue(), value);
}
catch (Exception ex) {
- fail("failed while r.put()", ex);
+ Assert.fail("failed while r.put()", ex);
}
}
@@ -960,7 +965,7 @@ public class InterestListDUnitTest extends DistributedTestCase
}
catch (Exception ex) {
- fail("failed while r.put()", ex);
+ Assert.fail("failed while r.put()", ex);
}
}
@@ -977,7 +982,7 @@ public class InterestListDUnitTest extends DistributedTestCase
}
catch (Exception ex) {
- fail("failed while r.put()", ex);
+ Assert.fail("failed while r.put()", ex);
}
}
@@ -1003,7 +1008,7 @@ public class InterestListDUnitTest extends DistributedTestCase
}
catch (Exception ex) {
- fail("failed while r.putAgain()", ex);
+ Assert.fail("failed while r.putAgain()", ex);
}
}
@@ -1036,7 +1041,7 @@ public class InterestListDUnitTest extends DistributedTestCase
return "waiting for client to apply events from server";
}
};
- DistributedTestCase.waitForCriterion(ev, 5 * 10 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 5 * 10 * 1000, 200, true);
}
public static void validateSingleEntry(Object key, String value) {
@@ -1045,7 +1050,7 @@ public class InterestListDUnitTest extends DistributedTestCase
assertEquals(value, r.getEntry(key).getValue());
}
catch (Exception ex) {
- fail("failed while validateSingleEntry()", ex);
+ Assert.fail("failed while validateSingleEntry()", ex);
}
}
@@ -1067,11 +1072,11 @@ public class InterestListDUnitTest extends DistributedTestCase
}
}
catch (Exception ex) {
- fail("failed while r.put()", ex);
+ Assert.fail("failed while r.put()", ex);
}
}
- public void tearDown2() throws Exception
+ public void tearDownBeforeDisconnect() throws Exception
{
// close the clients first
vm1.invoke(InterestListDUnitTest.class, "closeCache");
@@ -1079,7 +1084,7 @@ public class InterestListDUnitTest extends DistributedTestCase
// then close the servers
vm0.invoke(InterestListDUnitTest.class, "closeCache");
cache = null;
- invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } });
+ Invoke.invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } });
}
public static void closeCache()