You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ds...@apache.org on 2016/02/11 01:39:00 UTC
[26/61] [abbrv] [partial] incubator-geode git commit: GEODE-773:
Extract static methods from DistributedTestCase
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/locks/TXLockServiceDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/locks/TXLockServiceDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/locks/TXLockServiceDUnitTest.java
index 6d60816..01e7eca 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/locks/TXLockServiceDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/locks/TXLockServiceDUnitTest.java
@@ -37,7 +37,10 @@ import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedM
import com.gemstone.gemfire.internal.cache.TXRegionLockRequestImpl;
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.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
/**
* This class tests distributed ownership via the DistributedLockService api.
@@ -85,11 +88,12 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
com.gemstone.gemfire.internal.OSProcess.printStacks(0);
}
- public void tearDown2() throws Exception {
+ @Override
+ protected final void preTearDown() throws Exception {
// invokeInEveryVM(TXLockServiceDUnitTest.class,
// "remoteDumpAllDLockServices");
- invokeInEveryVM(TXLockServiceDUnitTest.class,
+ Invoke.invokeInEveryVM(TXLockServiceDUnitTest.class,
"destroyServices");
destroyServices();
@@ -102,9 +106,6 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
testTXRecoverGrantor_replyCode_PASS = false;
testTXRecoverGrantor_heldLocks_PASS = false;
-
- // Disconnects from GemFire if using shared memory
- super.tearDown2();
}
// -------------------------------------------------------------------------
@@ -123,7 +124,7 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
}
public void disable_testTXRecoverGrantorMessageProcessor() throws Exception {
- getLogWriter().info("[testTXOriginatorRecoveryProcessor]");
+ LogWriterUtils.getLogWriter().info("[testTXOriginatorRecoveryProcessor]");
TXLockService.createDTLS();
checkDLockRecoverGrantorMessageProcessor();
@@ -173,7 +174,7 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
dtls.release(txLockId);
// check results to verify no locks were provided in reply
- DistributedTestCase.join(thread, 30 * 1000, getLogWriter());
+ ThreadUtils.join(thread, 30 * 1000);
assertEquals("testTXRecoverGrantor_replyCode_PASS is false", true,
testTXRecoverGrantor_replyCode_PASS);
assertEquals("testTXRecoverGrantor_heldLocks_PASS is false", true,
@@ -182,7 +183,7 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
protected static volatile TXLockId testTXLock_TXLockId;
public void testTXLock() {
- getLogWriter().info("[testTXLock]");
+ LogWriterUtils.getLogWriter().info("[testTXLock]");
final int grantorVM = 0;
final int clientA = 1;
final int clientB = 2;
@@ -200,7 +201,7 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
));
// create grantor
- getLogWriter().info("[testTXLock] create grantor");
+ LogWriterUtils.getLogWriter().info("[testTXLock] create grantor");
Host.getHost(0).getVM(grantorVM).invoke(new SerializableRunnable() {
public void run() {
@@ -210,7 +211,7 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
sleep(20);
// create client and request txLock
- getLogWriter().info("[testTXLock] create clientA and request txLock");
+ LogWriterUtils.getLogWriter().info("[testTXLock] create clientA and request txLock");
Host.getHost(0).getVM(clientA).invoke(new SerializableRunnable() {
public void run() {
@@ -228,7 +229,7 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
});
// create nuther client and request overlapping txLock... verify fails
- getLogWriter().info("[testTXLock] create clientB and fail txLock");
+ LogWriterUtils.getLogWriter().info("[testTXLock] create clientB and fail txLock");
Host.getHost(0).getVM(clientB).invoke(new SerializableRunnable() {
public void run() {
@@ -258,7 +259,7 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
*/
// release txLock
- getLogWriter().info("[testTXLock] clientA releases txLock");
+ LogWriterUtils.getLogWriter().info("[testTXLock] clientA releases txLock");
Host.getHost(0).getVM(clientA).invoke(
new SerializableRunnable("[testTXLock] clientA releases txLock") {
@@ -270,7 +271,7 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
sleep(20);
// try nuther client again and verify success
- getLogWriter().info("[testTXLock] clientB requests txLock");
+ LogWriterUtils.getLogWriter().info("[testTXLock] clientB requests txLock");
Host.getHost(0).getVM(clientB).invoke(
new SerializableRunnable("[testTXLock] clientB requests txLock") {
@@ -282,7 +283,7 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
});
// release txLock
- getLogWriter().info("[testTXLock] clientB releases txLock");
+ LogWriterUtils.getLogWriter().info("[testTXLock] clientB releases txLock");
Host.getHost(0).getVM(clientB).invoke(
new SerializableRunnable("[testTXLock] clientB releases txLock") {
@@ -295,7 +296,7 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
protected static volatile TXLockId testTXOriginatorRecoveryProcessor_TXLockId;
public void testTXOriginatorRecoveryProcessor() {
- getLogWriter().info("[testTXOriginatorRecoveryProcessor]");
+ LogWriterUtils.getLogWriter().info("[testTXOriginatorRecoveryProcessor]");
final int originatorVM = 0;
final int grantorVM = 1;
final int particpantA = 2;
@@ -321,7 +322,7 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
}
// create grantor
- getLogWriter().info("[testTXOriginatorRecoveryProcessor] grantorVM becomes grantor");
+ LogWriterUtils.getLogWriter().info("[testTXOriginatorRecoveryProcessor] grantorVM becomes grantor");
Host.getHost(0).getVM(grantorVM).invoke(new SerializableRunnable() {
public void run() {
@@ -338,7 +339,7 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
Boolean.TRUE, isGrantor);
// have a originatorVM get a txLock with three participants including grantor
- getLogWriter().info("[testTXOriginatorRecoveryProcessor] originatorVM requests txLock");
+ LogWriterUtils.getLogWriter().info("[testTXOriginatorRecoveryProcessor] originatorVM requests txLock");
Host.getHost(0).getVM(originatorVM).invoke(new SerializableRunnable() {
public void run() {
@@ -422,14 +423,14 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
}
public void testDTLSIsDistributed() {
- getLogWriter().info("[testDTLSIsDistributed]");
+ LogWriterUtils.getLogWriter().info("[testDTLSIsDistributed]");
// have all vms lock and hold the same LTLS lock simultaneously
final Host host = Host.getHost(0);
int vmCount = host.getVMCount();
for (int vm = 0; vm < vmCount; vm++) {
final int finalvm = vm;
- getLogWriter().info("[testDTLSIsDistributed] testing vm " + finalvm);
+ LogWriterUtils.getLogWriter().info("[testDTLSIsDistributed] testing vm " + finalvm);
Host.getHost(0).getVM(finalvm).invoke(new SerializableRunnable() {
public void run() {
@@ -442,21 +443,21 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
TXLockServiceDUnitTest.class, "isDistributed_DTLS", new Object[] {});
assertEquals("isDistributed should be true for DTLS",
Boolean.TRUE, isDistributed);
- getLogWriter().info("[testDTLSIsDistributed] isDistributed=" + isDistributed);
+ LogWriterUtils.getLogWriter().info("[testDTLSIsDistributed] isDistributed=" + isDistributed);
// lock a key...
Boolean gotLock = (Boolean)host.getVM(finalvm).invoke(
TXLockServiceDUnitTest.class, "lock_DTLS", new Object[] {"KEY"});
assertEquals("gotLock is false after calling lock_DTLS",
Boolean.TRUE, gotLock);
- getLogWriter().info("[testDTLSIsDistributed] gotLock=" + gotLock);
+ LogWriterUtils.getLogWriter().info("[testDTLSIsDistributed] gotLock=" + gotLock);
// unlock it...
Boolean unlock = (Boolean)host.getVM(finalvm).invoke(
TXLockServiceDUnitTest.class, "unlock_DTLS", new Object[] {"KEY"});
assertEquals("unlock is false after calling unlock_DTLS",
Boolean.TRUE, unlock);
- getLogWriter().info("[testDTLSIsDistributed] unlock=" + unlock);
+ LogWriterUtils.getLogWriter().info("[testDTLSIsDistributed] unlock=" + unlock);
}
}
@@ -667,14 +668,14 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
Host host = Host.getHost(0);
int vmCount = host.getVMCount();
for (int i=0; i<vmCount; i++) {
- getLogWriter().info("Invoking " + methodName + "on VM#" + i);
+ LogWriterUtils.getLogWriter().info("Invoking " + methodName + "on VM#" + i);
host.getVM(i).invoke(this.getClass(), methodName, args);
}
}
public Properties getDistributedSystemProperties() {
Properties props = super.getDistributedSystemProperties();
- props.setProperty("log-level", getDUnitLogLevel());
+ props.setProperty("log-level", LogWriterUtils.getDUnitLogLevel());
return props;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug39356DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug39356DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug39356DUnitTest.java
index 13adb98..0371df7 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug39356DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug39356DUnitTest.java
@@ -44,6 +44,7 @@ import com.gemstone.gemfire.test.dunit.Host;
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;
/**
@@ -110,7 +111,7 @@ public class Bug39356DUnitTest extends CacheTestCase {
SerializableRunnable verifyBuckets = new SerializableRunnable("Verify buckets") {
public void run() {
- LogWriter log = getLogWriter();
+ LogWriter log = com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter();
Cache cache = getCache();
PartitionedRegion r = (PartitionedRegion) cache.getRegion(REGION_NAME);
for(int i = 0; i < r.getAttributes().getPartitionAttributes().getTotalNumBuckets(); i++) {
@@ -120,7 +121,7 @@ public class Bug39356DUnitTest extends CacheTestCase {
owners = r.getBucketOwnersForValidation(i);
} catch (ForceReattemptException e) {
log.info(Bug39356DUnitTest.class + " verify buckets Caught a ForceReattemptException");
- pause(1000);
+ Wait.pause(1000);
}
}
if(owners.isEmpty()) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug43684DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug43684DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug43684DUnitTest.java
index 8410030..eca9bca 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug43684DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug43684DUnitTest.java
@@ -36,7 +36,9 @@ import com.gemstone.gemfire.internal.cache.LocalRegion;
import com.gemstone.gemfire.internal.cache.RegionEntry;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
import com.gemstone.gemfire.test.dunit.VM;
/**
@@ -76,10 +78,11 @@ public class Bug43684DUnitTest extends DistributedTestCase {
server2 = host.getVM(1);
server3 = host.getVM(2);
client1 = host.getVM(3);
- addExpectedException("Connection refused: connect");
+ IgnoredException.addIgnoredException("Connection refused: connect");
}
- public void tearDown2() throws Exception {
+ @Override
+ protected final void preTearDown() throws Exception {
closeCache();
client1.invoke(Bug43684DUnitTest.class, "closeCache");
server1.invoke(Bug43684DUnitTest.class, "closeCache");
@@ -235,7 +238,7 @@ public class Bug43684DUnitTest extends DistributedTestCase {
public static Integer createServerCache(Boolean isReplicated, Boolean isPrimaryEmpty) throws Exception {
DistributedTestCase.disconnectFromDS();
Properties props = new Properties();
- props.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ props.setProperty("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
// props.setProperty("log-file", "server_" + OSProcess.getId() + ".log");
// props.setProperty("log-level", "fine");
props.setProperty("statistic-archive-file", "server_" + OSProcess.getId()
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug47388DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug47388DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug47388DUnitTest.java
index 3512385..1a02b90 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug47388DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug47388DUnitTest.java
@@ -44,6 +44,8 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientProxy;
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;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
* The test creates two datastores with a partitioned region, and also running a
@@ -101,7 +103,8 @@ public class Bug47388DUnitTest extends DistributedTestCase {
}
- public void tearDown2() throws Exception {
+ @Override
+ protected final void preTearDown() throws Exception {
closeCache();
vm2.invoke(Bug47388DUnitTest.class, "closeCache");
@@ -244,7 +247,7 @@ public class Bug47388DUnitTest extends DistributedTestCase {
}
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 500, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 500, true);
}
public static void waitForLastKeyDestroyed() throws Exception {
@@ -261,7 +264,7 @@ public class Bug47388DUnitTest extends DistributedTestCase {
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 500, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 500, true);
}
public void bug51931_testQRMOfExpiredEventsProcessedSuccessfully() throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug51400DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug51400DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug51400DUnitTest.java
index 9234db4..5b08a3e 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug51400DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug51400DUnitTest.java
@@ -37,7 +37,9 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientProxy;
import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientProxyStats;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
import com.gemstone.gemfire.test.dunit.VM;
/**
@@ -73,7 +75,8 @@ public class Bug51400DUnitTest extends DistributedTestCase {
}
- public void tearDown2() throws Exception {
+ @Override
+ protected final void preTearDown() throws Exception {
closeCache();
client0.invoke(Bug51400DUnitTest.class, "closeCache");
@@ -92,7 +95,7 @@ public class Bug51400DUnitTest extends DistributedTestCase {
public static Integer createServerCache(Integer mcastPort,
Integer maxMessageCount) throws Exception {
Properties props = new Properties();
- props.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ props.setProperty("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
// props.setProperty("log-file", "server_" + OSProcess.getId() + ".log");
// props.setProperty("log-level", "fine");
// props.setProperty("statistic-archive-file", "server_" + OSProcess.getId()
@@ -175,7 +178,7 @@ public class Bug51400DUnitTest extends DistributedTestCase {
"createServerCache", new Object[] { maxQSize });
client1.invoke(Bug51400DUnitTest.class, "createClientCache",
- new Object[] { getServerHostName(Host.getHost(0)), new Integer[]{port1}, ackInterval});
+ new Object[] { NetworkUtils.getServerHostName(Host.getHost(0)), new Integer[]{port1}, ackInterval});
// Do puts from server as well as from client on the same key.
AsyncInvocation ai1 = server0.invokeAsync(Bug51400DUnitTest.class,
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ElidedPutAllDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ElidedPutAllDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ElidedPutAllDUnitTest.java
index 681d0d9..26103c9 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ElidedPutAllDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ElidedPutAllDUnitTest.java
@@ -35,6 +35,7 @@ import com.gemstone.gemfire.internal.cache.RegionEntry;
import com.gemstone.gemfire.internal.cache.tier.sockets.VersionedObjectList;
import com.gemstone.gemfire.internal.cache.versions.ConcurrentCacheModificationException;
import com.gemstone.gemfire.internal.cache.versions.VersionTag;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
@@ -98,14 +99,14 @@ public class ElidedPutAllDUnitTest extends CacheTestCase {
try {
region.postPutAllSend(dpao, successfulPuts);
} catch (ConcurrentCacheModificationException e) {
- fail("Should not have received an exception for an elided operation", e);
+ Assert.fail("Should not have received an exception for an elided operation", e);
} finally {
event.release();
dpao.getBaseEvent().release();
dpao.freeOffHeapResources();
}
} catch (Exception e) {
- fail("caught unexpected exception", e);
+ Assert.fail("caught unexpected exception", e);
}
}
});
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionResolverDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionResolverDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionResolverDUnitTest.java
index e35b014..1ba824e 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionResolverDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionResolverDUnitTest.java
@@ -77,11 +77,12 @@ public class PartitionResolverDUnitTest extends CacheTestCase {
datastore1 = host.getVM(1);
datastore2 = host.getVM(2);
}
+
@Override
- public void tearDown2() throws Exception {
- super.tearDown2();
+ protected final void postTearDownCacheTestCase() throws Exception {
CountingResolver.resetResolverCount();
}
+
void createRegion(boolean isAccessor, int redundantCopies) {
AttributesFactory af = new AttributesFactory();
af.setScope(Scope.DISTRIBUTED_ACK);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionLoaderWriterDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionLoaderWriterDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionLoaderWriterDUnitTest.java
index 2678621..e06e49a 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionLoaderWriterDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionLoaderWriterDUnitTest.java
@@ -32,6 +32,7 @@ import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.VM;
@@ -159,7 +160,7 @@ public class PartitionedRegionLoaderWriterDUnitTest extends CacheTestCase {
cache.createRegion(PartitionedRegionName, attrs);
}
catch (Exception e) {
- fail("Not Expected : " , e);
+ Assert.fail("Not Expected : " , e);
}
}
@@ -200,7 +201,7 @@ public class PartitionedRegionLoaderWriterDUnitTest extends CacheTestCase {
assertNotNull(cache);
}
catch (Exception e) {
- fail("Failed while creating the cache", e);
+ Assert.fail("Failed while creating the cache", e);
}
}
@@ -224,9 +225,4 @@ public class PartitionedRegionLoaderWriterDUnitTest extends CacheTestCase {
public CacheWriter2() {
}
}
-
- @Override
- public void tearDown2() throws Exception {
- super.tearDown2();
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionMetaDataCleanupDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionMetaDataCleanupDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionMetaDataCleanupDUnitTest.java
index 825774d..99b4ba2 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionMetaDataCleanupDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionMetaDataCleanupDUnitTest.java
@@ -21,10 +21,13 @@ import com.gemstone.gemfire.cache.RegionFactory;
import com.gemstone.gemfire.cache.RegionShortcut;
import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.RMIException;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
/**
* @author dsmith
@@ -43,7 +46,7 @@ public class PartitionedRegionMetaDataCleanupDUnitTest extends CacheTestCase {
createPR(vm0, "region1", 5);
createPR(vm1, "region2", 10);
//This should fail
- ExpectedException ex = addExpectedException( "IllegalStateException", vm1);
+ IgnoredException ex = IgnoredException.addIgnoredException( "IllegalStateException", vm1);
try {
createPR(vm1, "region1", 10);
fail("Should have received an exception");
@@ -63,7 +66,7 @@ public class PartitionedRegionMetaDataCleanupDUnitTest extends CacheTestCase {
createPR(vm0, "region1", 5);
createPR(vm1, "region2", 10);
//This should fail
- ExpectedException ex = addExpectedException( "IllegalStateException", vm1);
+ IgnoredException ex = IgnoredException.addIgnoredException( "IllegalStateException", vm1);
try {
createPR(vm1, "region1", 10);
fail("Should have received an exception");
@@ -83,7 +86,7 @@ public class PartitionedRegionMetaDataCleanupDUnitTest extends CacheTestCase {
createPR(vm0, "region1", 5);
createPR(vm1, "region2", 10);
//This should fail
- ExpectedException ex = addExpectedException("IllegalStateException", vm1);
+ IgnoredException ex = IgnoredException.addIgnoredException("IllegalStateException", vm1);
try {
createPR(vm1, "region1", 10);
fail("Should have received an exception");
@@ -93,7 +96,7 @@ public class PartitionedRegionMetaDataCleanupDUnitTest extends CacheTestCase {
ex.remove();
}
- ex = addExpectedException("DistributedSystemDisconnectedException", vm0);
+ ex = IgnoredException.addIgnoredException("DistributedSystemDisconnectedException", vm0);
try {
fakeCrash(vm0);
} finally {
@@ -161,7 +164,7 @@ public class PartitionedRegionMetaDataCleanupDUnitTest extends CacheTestCase {
.setEntryTimeToLive(new ExpirationAttributes(expirationTime));
//We may log an exception if the create fails. Ignore thse.
- ExpectedException ex = addExpectedException("IllegalStateException");
+ IgnoredException ex = IgnoredException.addIgnoredException("IllegalStateException");
try {
int i= 0;
//Loop until a successful create
@@ -174,11 +177,11 @@ public class PartitionedRegionMetaDataCleanupDUnitTest extends CacheTestCase {
} catch(IllegalStateException expected) {
//give up if we can't create the region in 20 tries
if(i == 20) {
- fail("Metadata was never cleaned up in 20 tries", expected);
+ Assert.fail("Metadata was never cleaned up in 20 tries", expected);
}
//wait a bit before the next attempt.
- pause(500);
+ Wait.pause(500);
}
}
} finally {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistPRKRFDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistPRKRFDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistPRKRFDUnitTest.java
index c0a0149..d74a94b 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistPRKRFDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistPRKRFDUnitTest.java
@@ -28,9 +28,11 @@ import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
import com.gemstone.gemfire.internal.cache.DiskStoreImpl;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
/**
* Tests the basic use cases for PR persistence.
@@ -73,7 +75,7 @@ public class PersistPRKRFDUnitTest extends PersistentPartitionedRegionTestBase {
AsyncInvocation async1 = vm0.invokeAsync(new CacheSerializableRunnable(title+"async create") {
public void run2() throws CacheException {
Region region = getRootRegion(PR_REGION_NAME);
- ExpectedException expect = addExpectedException("CacheClosedException");
+ IgnoredException expect = IgnoredException.addIgnoredException("CacheClosedException");
try {
region.put(10, "b");
fail("Expect CacheClosedException here");
@@ -92,14 +94,14 @@ public class PersistPRKRFDUnitTest extends PersistentPartitionedRegionTestBase {
vm0.invoke(new CacheSerializableRunnable(title+"close disk store") {
public void run2() throws CacheException {
GemFireCacheImpl gfc = (GemFireCacheImpl)getCache();
- pause(500);
+ Wait.pause(500);
gfc.closeDiskStores();
synchronized(lockObject) {
lockObject.notify();
}
}
});
- DistributedTestCase.join(async1, MAX_WAIT, getLogWriter());
+ ThreadUtils.join(async1, MAX_WAIT);
closeCache(vm0);
// update
@@ -116,7 +118,7 @@ public class PersistPRKRFDUnitTest extends PersistentPartitionedRegionTestBase {
async1 = vm0.invokeAsync(new CacheSerializableRunnable(title+"async update") {
public void run2() throws CacheException {
Region region = getRootRegion(PR_REGION_NAME);
- ExpectedException expect = addExpectedException("CacheClosedException");
+ IgnoredException expect = IgnoredException.addIgnoredException("CacheClosedException");
try {
region.put(1, "b");
fail("Expect CacheClosedException here");
@@ -135,14 +137,14 @@ public class PersistPRKRFDUnitTest extends PersistentPartitionedRegionTestBase {
vm0.invoke(new CacheSerializableRunnable(title+"close disk store") {
public void run2() throws CacheException {
GemFireCacheImpl gfc = (GemFireCacheImpl)getCache();
- pause(500);
+ Wait.pause(500);
gfc.closeDiskStores();
synchronized(lockObject) {
lockObject.notify();
}
}
});
- DistributedTestCase.join(async1, MAX_WAIT, getLogWriter());
+ ThreadUtils.join(async1, MAX_WAIT);
closeCache(vm0);
// destroy
@@ -159,7 +161,7 @@ public class PersistPRKRFDUnitTest extends PersistentPartitionedRegionTestBase {
async1 = vm0.invokeAsync(new CacheSerializableRunnable(title+"async destroy") {
public void run2() throws CacheException {
Region region = getRootRegion(PR_REGION_NAME);
- ExpectedException expect = addExpectedException("CacheClosedException");
+ IgnoredException expect = IgnoredException.addIgnoredException("CacheClosedException");
try {
region.destroy(2, "b");
fail("Expect CacheClosedException here");
@@ -178,14 +180,14 @@ public class PersistPRKRFDUnitTest extends PersistentPartitionedRegionTestBase {
vm0.invoke(new CacheSerializableRunnable(title+"close disk store") {
public void run2() throws CacheException {
GemFireCacheImpl gfc = (GemFireCacheImpl)getCache();
- pause(500);
+ Wait.pause(500);
gfc.closeDiskStores();
synchronized(lockObject) {
lockObject.notify();
}
}
});
- DistributedTestCase.join(async1, MAX_WAIT, getLogWriter());
+ ThreadUtils.join(async1, MAX_WAIT);
checkData(vm0, 0, 10, "a");
checkData(vm0, 10, 11, null);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentColocatedPartitionedRegionDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentColocatedPartitionedRegionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentColocatedPartitionedRegionDUnitTest.java
index cacdc61..901d2d6 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentColocatedPartitionedRegionDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentColocatedPartitionedRegionDUnitTest.java
@@ -43,11 +43,15 @@ import com.gemstone.gemfire.internal.cache.InitialImageOperation.RequestImageMes
import com.gemstone.gemfire.internal.cache.PartitionedRegion;
import com.gemstone.gemfire.internal.cache.control.InternalResourceManager;
import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.ResourceObserver;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
import com.gemstone.gemfire.test.dunit.Host;
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;
/**
* @author dsmith
@@ -67,9 +71,8 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends
}
@Override
- public void tearDown2() throws Exception {
+ protected final void preTearDownCacheTestCase() throws Exception {
FileUtil.delete(getBackupDir());
- super.tearDown2();
}
public void testColocatedPRAttributes() {
@@ -107,7 +110,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends
af.setPartitionAttributes(paf.create());
//Try to colocate a persistent PR with the non persistent PR. This should fail.
- ExpectedException exp = addExpectedException("IllegalStateException");
+ IgnoredException exp = IgnoredException.addIgnoredException("IllegalStateException");
try {
cache.createRegion("colocated", af.create());
fail("should not have been able to create a persistent region colocated with a non persistent region");
@@ -290,7 +293,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends
vm1.invoke(createChildPR);
vm2.invoke(createChildPR);
- pause(4000);
+ Wait.pause(4000);
assertEquals(vm0Buckets, getBucketList(vm0, PR_REGION_NAME));
assertEquals(vm0Buckets, getBucketList(vm0, "region2"));
@@ -351,7 +354,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends
try {
recoveryDone.await(MAX_WAIT, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
- fail("interrupted", e);
+ Assert.fail("interrupted", e);
}
}
};
@@ -498,7 +501,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends
fail("timed out");
}
} catch (InterruptedException e) {
- fail("interrupted", e);
+ Assert.fail("interrupted", e);
}
}
};
@@ -556,7 +559,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends
fail("timed out");
}
} catch (InterruptedException e) {
- fail("interrupted", e);
+ Assert.fail("interrupted", e);
}
}
};
@@ -602,7 +605,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends
createData(vm0, 0, NUM_BUCKETS, "b");
createData(vm0, 0, NUM_BUCKETS, "b", "region2");
- ExpectedException expected = addExpectedException("PartitionOfflineException");
+ IgnoredException expected = IgnoredException.addIgnoredException("PartitionOfflineException");
try {
//Close the remaining members.
@@ -630,7 +633,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends
//by starting it last.
AsyncInvocation async0 = vm0.invokeAsync(createPRs);
AsyncInvocation async1 = vm1.invokeAsync(createPRs);
- pause(2000);
+ Wait.pause(2000);
AsyncInvocation async2 = vm2.invokeAsync(createPRs);
async0.getResult(MAX_WAIT);
async1.getResult(MAX_WAIT);
@@ -714,7 +717,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends
fail("timed out");
}
} catch (InterruptedException e) {
- fail("interrupted", e);
+ Assert.fail("interrupted", e);
}
}
};
@@ -779,7 +782,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends
fail("timed out");
}
} catch (InterruptedException e) {
- fail("interrupted", e);
+ Assert.fail("interrupted", e);
}
}
};
@@ -804,8 +807,8 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends
* @throws Throwable
*/
public void replaceOfflineMemberAndRestartCreateColocatedPRLate(SerializableRunnable createParentPR, SerializableRunnable createChildPR) throws Throwable {
- addExpectedException("PartitionOfflineException");
- addExpectedException("RegionDestroyedException");
+ IgnoredException.addIgnoredException("PartitionOfflineException");
+ IgnoredException.addIgnoredException("RegionDestroyedException");
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
@@ -860,14 +863,14 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends
//by starting it last.
AsyncInvocation async2 = vm2.invokeAsync(createParentPR);
AsyncInvocation async1 = vm1.invokeAsync(createParentPR);
- pause(2000);
+ Wait.pause(2000);
AsyncInvocation async0 = vm0.invokeAsync(createParentPR);
async0.getResult(MAX_WAIT);
async1.getResult(MAX_WAIT);
async2.getResult(MAX_WAIT);
//Wait for async tasks
- pause(2000);
+ Wait.pause(2000);
//Recreate the child region.
async2 = vm2.invokeAsync(createChildPR);
@@ -975,7 +978,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends
}
});
- ExpectedException ex = addExpectedException("PartitionOfflineException", vm1);
+ IgnoredException ex = IgnoredException.addIgnoredException("PartitionOfflineException", vm1);
try {
//Do a rebalance to create buckets in vm1. THis will cause vm0 to disconnect
@@ -995,7 +998,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends
vm0.invoke(new SerializableCallable() {
public Object call() throws Exception {
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
public boolean done() {
InternalDistributedSystem ds = system;
return ds == null || !ds.isConnected();
@@ -1292,7 +1295,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends
try {
observer.waitForCreate();
} catch (InterruptedException e) {
- fail("interrupted", e);
+ Assert.fail("interrupted", e);
}
}
};
@@ -1415,7 +1418,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends
closeCache();
//Restart colocated with "region2"
- ExpectedException ex = addExpectedException("DiskAccessException|IllegalStateException");
+ IgnoredException ex = IgnoredException.addIgnoredException("DiskAccessException|IllegalStateException");
try {
createColocatedPRs("region2");
fail("Should have received an illegal state exception");
@@ -1437,7 +1440,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends
//Restart uncolocated. We don't allow changing
//from uncolocated to colocated.
- ex = addExpectedException("DiskAccessException|IllegalStateException");
+ ex = IgnoredException.addIgnoredException("DiskAccessException|IllegalStateException");
try {
createColocatedPRs(null);
fail("Should have received an illegal state exception");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionDUnitTest.java
index 794d418..abf546d 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionDUnitTest.java
@@ -74,13 +74,19 @@ import com.gemstone.gemfire.internal.cache.InitialImageOperation.RequestImageMes
import com.gemstone.gemfire.internal.cache.control.InternalResourceManager;
import com.gemstone.gemfire.internal.cache.partitioned.ManageBucketMessage.ManageBucketReplyMessage;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.RMIException;
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;
/**
* Tests the basic use cases for PR persistence.
@@ -143,8 +149,8 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
createPR(vm0, 0, 0, 5);
createData(vm0, 0, 5, "a");
closeCache(vm0);
- ExpectedException expect = addExpectedException("IllegalStateException", vm0);
- expect = addExpectedException("DiskAccessException", vm0);
+ IgnoredException expect = IgnoredException.addIgnoredException("IllegalStateException", vm0);
+ expect = IgnoredException.addIgnoredException("DiskAccessException", vm0);
try {
createPR(vm0, 0, 0, 2);
fail("Expect to get java.lang.IllegalStateException, but it did not");
@@ -254,8 +260,8 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
}
});
- ExpectedException expected1 = addExpectedException("Fatal error from asynch");
- ExpectedException expected2 = addExpectedException("ToDataException");
+ IgnoredException expected1 = IgnoredException.addIgnoredException("Fatal error from asynch");
+ IgnoredException expected2 = IgnoredException.addIgnoredException("ToDataException");
try {
int redundancy=1;
createPR(vm0, redundancy, -1, 113, false);
@@ -422,7 +428,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
createData(vm0, numBuckets, 113, "b");
checkData(vm0, numBuckets, 113, "b");
- ExpectedException ex = addExpectedException(RevokedPersistentDataException.class.getName(), vm1);
+ IgnoredException ex = IgnoredException.addIgnoredException(RevokedPersistentDataException.class.getName(), vm1);
try {
createPR(vm1, 1);
fail("Should have recieved a SplitDistributedSystemException");
@@ -437,7 +443,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
}
public void testRevokeBeforeStartup() throws Throwable {
- addExpectedException("RevokeFailedException");
+ IgnoredException.addIgnoredException("RevokeFailedException");
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
@@ -491,7 +497,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
createData(vm0, numBuckets, 113, "b");
checkData(vm0, numBuckets, 113, "b");
- ExpectedException ex = addExpectedException(RevokedPersistentDataException.class.getName(), vm1);
+ IgnoredException ex = IgnoredException.addIgnoredException(RevokedPersistentDataException.class.getName(), vm1);
try {
createPR(vm1, 1);
fail("Should have recieved a SplitDistributedSystemException");
@@ -537,7 +543,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
final int aVM1Bucket = vm1Buckets.iterator().next();
closeCache(vm1);
- ExpectedException ex = addExpectedException("PartitionOfflineException");
+ IgnoredException ex = IgnoredException.addIgnoredException("PartitionOfflineException");
try {
checkReadWriteOperationsWithOfflineMember(vm0, aVM0Bucket, aVM1Bucket);
//Make sure that a newly created member is informed about the offline member
@@ -574,7 +580,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
}
}
- ExpectedException expect = addExpectedException("PartitionOfflineException", vm0);
+ IgnoredException expect = IgnoredException.addIgnoredException("PartitionOfflineException", vm0);
//Try a function execution
vm0.invoke(new SerializableRunnable("Test ways to read") {
public void run() {
@@ -803,7 +809,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
//This should work, because this bucket is still available.
checkData(vm0, aVM0Bucket, aVM0Bucket + 1, "a");
- ExpectedException expect = addExpectedException("PartitionOfflineException", vm0);
+ IgnoredException expect = IgnoredException.addIgnoredException("PartitionOfflineException", vm0);
try {
checkData(vm0, aVM1Bucket, aVM1Bucket + 1, "a");
fail("Should not have been able to read from missing buckets!");
@@ -836,7 +842,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
createData(vm2, aVM1Bucket, aVM1Bucket + 1, "a");
checkData(vm2, aVM1Bucket, aVM1Bucket + 1, "a");
- ExpectedException ex = addExpectedException(RevokedPersistentDataException.class.getName(), vm1);
+ IgnoredException ex = IgnoredException.addIgnoredException(RevokedPersistentDataException.class.getName(), vm1);
try {
createPR(vm1, 0);
fail("Should have recieved a RevokedPersistentDataException");
@@ -884,7 +890,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
Set<Integer> vm2Buckets = getBucketList(vm2);
assertEquals(vm1Buckets, vm2Buckets);
- ExpectedException ex = addExpectedException(RevokedPersistentDataException.class.getName(), vm1);
+ IgnoredException ex = IgnoredException.addIgnoredException(RevokedPersistentDataException.class.getName(), vm1);
try {
createPR(vm1, 1);
fail("Should have recieved a SplitDistributedSystemException");
@@ -952,7 +958,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
//VM2 should pick up the slack
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
public boolean done() {
Set<Integer> vm2Buckets = getBucketList(vm2);
@@ -1336,11 +1342,11 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
public void testRegisterInterestNoDataStores() {
//Closing the client may log a warning on the server
- addExpectedException("Connection reset");
- addExpectedException("SocketTimeoutException");
- addExpectedException("ServerConnectivityException");
- addExpectedException("Socket Closed");
- addExpectedException("Unexpected IOException");
+ IgnoredException.addIgnoredException("Connection reset");
+ IgnoredException.addIgnoredException("SocketTimeoutException");
+ IgnoredException.addIgnoredException("ServerConnectivityException");
+ IgnoredException.addIgnoredException("Socket Closed");
+ IgnoredException.addIgnoredException("Unexpected IOException");
final Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
@@ -1381,7 +1387,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
Cache cache = getCache();
PoolFactory pf = PoolManager.createFactory();
- pf.addServer(getServerHostName(host), serverPort);
+ pf.addServer(NetworkUtils.getServerHostName(host), serverPort);
pf.setSubscriptionEnabled(true);
pf.create("pool");
AttributesFactory af = new AttributesFactory();
@@ -1444,7 +1450,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
DistributedTestCase.disconnectFromDS();
await().atMost(30, SECONDS).until(() -> {return (cache == null || cache.isClosed());});
- getLogWriter().info("Cache is confirmed closed");
+ LogWriterUtils.getLogWriter().info("Cache is confirmed closed");
}
}
});
@@ -1655,7 +1661,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
}
});
- getLogWriter().info("Creating region in VM0");
+ LogWriterUtils.getLogWriter().info("Creating region in VM0");
createPR(vm0, 1, 0, 1);
//Make sure we create a bucket
@@ -1663,9 +1669,9 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
//This should recover redundancy, which should cause vm0 to disconnect
- ExpectedException ex = addExpectedException("PartitionOfflineException");
+ IgnoredException ex = IgnoredException.addIgnoredException("PartitionOfflineException");
try {
- getLogWriter().info("Creating region in VM1");
+ LogWriterUtils.getLogWriter().info("Creating region in VM1");
createPR(vm1, 1, 0, 1);
//Make sure get a partition offline exception
@@ -1746,7 +1752,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
try {
recoveryObserver.recoveryDone.await();
} catch (InterruptedException e) {
- fail("Interrupted", e);
+ Assert.fail("Interrupted", e);
}
InternalResourceManager.setResourceObserver(null);
}
@@ -1821,7 +1827,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
* to make sure that later we can recover redundancy.
*/
public void testCrashDuringBucketGII() {
- addExpectedException("PartitionOfflineException");
+ IgnoredException.addIgnoredException("PartitionOfflineException");
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
@@ -1875,7 +1881,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
* @throws InterruptedException
*/
public void testCrashDuringBucketGII2() throws InterruptedException {
- addExpectedException("PartitionOfflineException");
+ IgnoredException.addIgnoredException("PartitionOfflineException");
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
final VM vm1 = host.getVM(1);
@@ -1933,7 +1939,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 30 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 30 * 1000, 200, true);
assertEquals(Collections.singleton(0), getBucketList(vm1));
}
@@ -1956,7 +1962,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
createData(vm1, 1, 2, "a");
//this should throw a conflicting data exception.
- ExpectedException expect = addExpectedException("ConflictingPersistentDataException", vm0);
+ IgnoredException expect = IgnoredException.addIgnoredException("ConflictingPersistentDataException", vm0);
try {
createPR(vm0, 0);
fail("should have seen a conflicting data exception");
@@ -1974,7 +1980,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
//view from vm0 because vm0 was in conflict!
//In fact, this is a bit of a problem, because now vm1 is dependent
//on vm vm0.
- expect = addExpectedException("PartitionOfflineException", vm1);
+ expect = IgnoredException.addIgnoredException("PartitionOfflineException", vm1);
try {
createData(vm1, 0, 1, "a");
fail("Should have seen a PartitionOfflineException for bucket 0");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionTestBase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionTestBase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionTestBase.java
index 267136a..3b89271 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionTestBase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionTestBase.java
@@ -56,10 +56,15 @@ import com.gemstone.gemfire.internal.cache.control.InternalResourceManager;
import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.ResourceObserver;
import com.gemstone.gemfire.internal.cache.persistence.PersistenceAdvisor;
import com.gemstone.gemfire.internal.cache.persistence.PersistentMemberID;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
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;
/**
* @author dsmith
@@ -84,7 +89,7 @@ public abstract class PersistentPartitionedRegionTestBase extends CacheTestCase
public void setUp() throws Exception {
super.setUp();
disconnectAllFromDS();
- invokeInEveryVM(PersistentPartitionedRegionTestBase.class,"setRegionName", new Object[]{getUniqueName()});
+ Invoke.invokeInEveryVM(PersistentPartitionedRegionTestBase.class,"setRegionName", new Object[]{getUniqueName()});
setRegionName(getUniqueName());
}
@@ -154,7 +159,7 @@ public abstract class PersistentPartitionedRegionTestBase extends CacheTestCase
try {
rf.start().getResults();
} catch (Exception e) {
- fail("interupted", e);
+ Assert.fail("interupted", e);
}
}
});
@@ -198,7 +203,7 @@ public abstract class PersistentPartitionedRegionTestBase extends CacheTestCase
protected void createData(VM vm, final int startKey, final int endKey,
final String value) {
- getLogWriter().info("createData invoked. PR_REGION_NAME is " + PR_REGION_NAME);
+ LogWriterUtils.getLogWriter().info("createData invoked. PR_REGION_NAME is " + PR_REGION_NAME);
createData(vm, startKey, endKey,value, PR_REGION_NAME);
}
@@ -208,7 +213,7 @@ public abstract class PersistentPartitionedRegionTestBase extends CacheTestCase
public void run() {
Cache cache = getCache();
- getLogWriter().info("creating data in " + regionName);
+ LogWriterUtils.getLogWriter().info("creating data in " + regionName);
Region region = cache.getRegion(regionName);
for(int i =startKey; i < endKey; i++) {
@@ -367,7 +372,7 @@ public abstract class PersistentPartitionedRegionTestBase extends CacheTestCase
try {
recoveryDone.await(MAX_WAIT, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
- fail("interrupted", e);
+ Assert.fail("interrupted", e);
}
}
};
@@ -410,7 +415,7 @@ public abstract class PersistentPartitionedRegionTestBase extends CacheTestCase
try {
recoveryDone.await();
} catch (InterruptedException e) {
- fail("Interrupted", e);
+ Assert.fail("Interrupted", e);
}
}
}
@@ -474,7 +479,7 @@ public abstract class PersistentPartitionedRegionTestBase extends CacheTestCase
public Object call() throws Exception {
Cache cache = getCache();
final PartitionedRegion region = (PartitionedRegion) cache.getRegion(regionName);
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
public boolean done() {
return expectedBuckets.equals(getActualBuckets());
@@ -553,7 +558,7 @@ public abstract class PersistentPartitionedRegionTestBase extends CacheTestCase
}
}
};
- waitForCriterion(wc, MAX_WAIT, 500, true);
+ Wait.waitForCriterion(wc, MAX_WAIT, 500, true);
} finally {
adminDS.disconnect();
}
@@ -685,7 +690,7 @@ public abstract class PersistentPartitionedRegionTestBase extends CacheTestCase
Cache cache = getCache();
PartitionedRegion region = (PartitionedRegion) cache.getRegion(regionName);
final PartitionedRegionDataStore dataStore = region.getDataStore();
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
public boolean done() {
Set<Integer> vm2Buckets = dataStore.getAllLocalBucketIds();
@@ -707,7 +712,7 @@ public abstract class PersistentPartitionedRegionTestBase extends CacheTestCase
public void run() {
Cache cache = getCache();
final Region region = cache.getRegion(regionName);
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
public boolean done() {
PartitionRegionInfo info = PartitionRegionHelper.getPartitionRegionInfo(region);
@@ -785,7 +790,7 @@ public abstract class PersistentPartitionedRegionTestBase extends CacheTestCase
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line;
while((line = br.readLine()) != null) {
- getLogWriter().fine("OUTPUT:" + line);
+ LogWriterUtils.getLogWriter().fine("OUTPUT:" + line);
//TODO validate output
};
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionWithTransactionDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionWithTransactionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionWithTransactionDUnitTest.java
index e92d6b1..90118d1 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionWithTransactionDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionWithTransactionDUnitTest.java
@@ -23,6 +23,8 @@ import com.gemstone.gemfire.internal.cache.DiskStoreImpl;
import com.gemstone.gemfire.internal.cache.TXManagerImpl;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
@@ -40,24 +42,19 @@ public class PersistentPartitionedRegionWithTransactionDUnitTest extends Persist
}
@Override
- public void tearDown2() throws Exception {
- super.tearDown2();
- invokeInEveryVM(new SerializableRunnable() {
-
+ protected final void postTearDownCacheTestCase() throws Exception {
+ Invoke.invokeInEveryVM(new SerializableRunnable() {
public void run() {
TXManagerImpl.ALLOW_PERSISTENT_TRANSACTIONS = false;
System.setProperty(DiskStoreImpl.RECOVER_VALUES_SYNC_PROPERTY_NAME, "false");
}
});
-
}
-
-
@Override
public void setUp() throws Exception {
super.setUp();
- invokeInEveryVM(new SerializableRunnable() {
+ Invoke.invokeInEveryVM(new SerializableRunnable() {
public void run() {
TXManagerImpl.ALLOW_PERSISTENT_TRANSACTIONS = true;
@@ -134,12 +131,12 @@ public class PersistentPartitionedRegionWithTransactionDUnitTest extends Persist
@Override
protected void createData(VM vm, final int startKey, final int endKey, final String value,
final String regionName) {
- getLogWriter().info("creating runnable to create data for region " + regionName);
+ LogWriterUtils.getLogWriter().info("creating runnable to create data for region " + regionName);
SerializableRunnable createData = new SerializableRunnable() {
public void run() {
Cache cache = getCache();
- getLogWriter().info("getting region " + regionName);
+ LogWriterUtils.getLogWriter().info("getting region " + regionName);
Region region = cache.getRegion(regionName);
for(int i =startKey; i < endKey; i++) {
@@ -171,7 +168,7 @@ public class PersistentPartitionedRegionWithTransactionDUnitTest extends Persist
public void run() {
Cache cache = getCache();
- getLogWriter().info("checking data in " + regionName);
+ LogWriterUtils.getLogWriter().info("checking data in " + regionName);
Region region = cache.getRegion(regionName);
for(int i =startKey; i < endKey; i++) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ShutdownAllDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ShutdownAllDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ShutdownAllDUnitTest.java
index 4918f00..cd68c35 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ShutdownAllDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ShutdownAllDUnitTest.java
@@ -55,13 +55,16 @@ import com.gemstone.gemfire.internal.cache.PartitionedRegion;
import com.gemstone.gemfire.internal.cache.PutAllPartialResultException;
import com.gemstone.gemfire.internal.cache.control.InternalResourceManager;
import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.ResourceObserver;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
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.RMIException;
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;
/**
* Tests the basic use cases for PR persistence.
@@ -142,7 +145,7 @@ public class ShutdownAllDUnitTest extends CacheTestCase {
createData(vm0, 0, numBuckets, "a", "region");
vm0.invoke(addExceptionTag1(expectedExceptions));
- invokeInEveryVM(new SerializableRunnable("set TestInternalGemFireError") {
+ Invoke.invokeInEveryVM(new SerializableRunnable("set TestInternalGemFireError") {
public void run() {
System.setProperty("TestInternalGemFireError", "true");
}
@@ -151,7 +154,7 @@ public class ShutdownAllDUnitTest extends CacheTestCase {
assertTrue(InternalDistributedSystem.getExistingSystems().isEmpty());
- invokeInEveryVM(new SerializableRunnable("reset TestInternalGemFireError") {
+ Invoke.invokeInEveryVM(new SerializableRunnable("reset TestInternalGemFireError") {
public void run() {
System.setProperty("TestInternalGemFireError", "false");
}
@@ -178,7 +181,7 @@ public class ShutdownAllDUnitTest extends CacheTestCase {
vm0.invoke(addExceptionTag1(expectedExceptions));
vm1.invoke(addExceptionTag1(expectedExceptions));
- invokeInEveryVM(new SerializableRunnable("set TestInternalGemFireError") {
+ Invoke.invokeInEveryVM(new SerializableRunnable("set TestInternalGemFireError") {
public void run() {
System.setProperty("TestInternalGemFireError", "true");
}
@@ -187,7 +190,7 @@ public class ShutdownAllDUnitTest extends CacheTestCase {
assertTrue(InternalDistributedSystem.getExistingSystems().isEmpty());
- invokeInEveryVM(new SerializableRunnable("reset TestInternalGemFireError") {
+ Invoke.invokeInEveryVM(new SerializableRunnable("reset TestInternalGemFireError") {
public void run() {
System.setProperty("TestInternalGemFireError", "false");
}
@@ -483,7 +486,7 @@ public class ShutdownAllDUnitTest extends CacheTestCase {
});
//wait for shutdown to finish
- pause(10000);
+ Wait.pause(10000);
// restart vm0
AsyncInvocation a0 = createRegionAsync(vm0, "region", "disk", true, 1);
@@ -546,7 +549,7 @@ public class ShutdownAllDUnitTest extends CacheTestCase {
AsyncInvocation a0 = createRegionAsync(vm0, "region", "disk", true, 1);
//Wait a bit for the initialization to get stuck
- pause(20000);
+ Wait.pause(20000);
assertTrue(a0.isAlive());
//Do another shutdown all, with a member offline and another stuck
@@ -718,7 +721,7 @@ public class ShutdownAllDUnitTest extends CacheTestCase {
try {
recoveryDone.await();
} catch (InterruptedException e) {
- fail("Interrupted", e);
+ Assert.fail("Interrupted", e);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/StreamingPartitionOperationOneDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/StreamingPartitionOperationOneDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/StreamingPartitionOperationOneDUnitTest.java
index b9e8ebe..f5e0b71 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/StreamingPartitionOperationOneDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/StreamingPartitionOperationOneDUnitTest.java
@@ -47,6 +47,7 @@ import com.gemstone.gemfire.distributed.internal.ReplyProcessor21;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
import com.gemstone.gemfire.internal.cache.PartitionedRegion;
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.VM;
@@ -108,7 +109,7 @@ public class StreamingPartitionOperationOneDUnitTest extends CacheTestCase {
throw e;
}
catch (Throwable t) {
- fail("getPartitionedDataFrom failed", t);
+ Assert.fail("getPartitionedDataFrom failed", t);
}
assertTrue(streamOp.dataValidated);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningDUnitTest.java
index 30063d4..ce42945 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningDUnitTest.java
@@ -23,9 +23,11 @@ import com.gemstone.gemfire.cache.DuplicatePrimaryPartitionException;
import com.gemstone.gemfire.cache.EntryNotFoundException;
import com.gemstone.gemfire.cache.FixedPartitionAttributes;
import com.gemstone.gemfire.cache.partition.PartitionNotAvailableException;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Wait;
import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase.ExpectedException;
/**
* This Dunit test class have multiple tests to tests different validations of
@@ -53,10 +55,6 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
}
- public void tearDown2() throws Exception {
- super.tearDown2();
- }
-
/**
* This test validates that null partition name cannot be added in
* FixedPartitionAttributes
@@ -77,7 +75,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
if (!((illegal.getCause() instanceof IllegalStateException) && (illegal
.getCause().getMessage()
.contains("Fixed partition name cannot be null")))) {
- fail("Expected IllegalStateException ", illegal);
+ Assert.fail("Expected IllegalStateException ", illegal);
}
}
}
@@ -107,7 +105,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
if (!((illegal.getCause() instanceof IllegalStateException) && (illegal
.getCause().getMessage()
.contains("can be added only once in FixedPartitionAttributes")))) {
- fail("Expected IllegalStateException ", illegal);
+ Assert.fail("Expected IllegalStateException ", illegal);
}
}
}
@@ -134,7 +132,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
catch (Exception illegal) {
if (!((illegal.getCause() instanceof IllegalStateException) && (illegal
.getCause().getMessage().contains("can not be defined for accessor")))) {
- fail("Expected IllegalStateException ", illegal);
+ Assert.fail("Expected IllegalStateException ", illegal);
}
}
}
@@ -147,7 +145,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
*/
public void testSamePartitionName_Primary_OnTwoMembers() {
- ExpectedException ex = addExpectedException("DuplicatePrimaryPartitionException");
+ IgnoredException ex = IgnoredException.addIgnoredException("DuplicatePrimaryPartitionException");
try {
member1.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
FixedPartitionAttributes fpa1 = FixedPartitionAttributes
@@ -179,7 +177,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
if (!((duplicate.getCause() instanceof DuplicatePrimaryPartitionException) && (duplicate
.getCause().getMessage()
.contains("can not be defined as primary on more than one node")))) {
- fail("Expected DuplicatePrimaryPartitionException ", duplicate);
+ Assert.fail("Expected DuplicatePrimaryPartitionException ", duplicate);
}
} finally {
ex.remove();
@@ -192,7 +190,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
*/
public void testSamePartitionName_DifferentNumBuckets() {
- ExpectedException ex = addExpectedException("IllegalStateException");
+ IgnoredException ex = IgnoredException.addIgnoredException("IllegalStateException");
try {
member1.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
FixedPartitionAttributes fpa1 = FixedPartitionAttributes
@@ -220,7 +218,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
catch (Exception illegal) {
if (!((illegal.getCause() instanceof IllegalStateException) && (illegal
.getCause().getMessage().contains("num-buckets are not same")))) {
- fail("Expected IllegalStateException ", illegal);
+ Assert.fail("Expected IllegalStateException ", illegal);
}
} finally {
ex.remove();
@@ -235,7 +233,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
*/
public void testNumberOfPartitions() {
- ExpectedException expected = addExpectedException("IllegalStateException");
+ IgnoredException expected = IgnoredException.addIgnoredException("IllegalStateException");
try {
member1.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
member1.invoke(FixedPartitioningTestBase.class, "createRegionWithPartitionAttributes",
@@ -282,7 +280,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
if (!((ex.getCause() instanceof IllegalStateException) && (ex.getCause()
.getMessage()
.contains("should never exceed number of redundant copies")))) {
- fail("Expected IllegalStateException ", ex);
+ Assert.fail("Expected IllegalStateException ", ex);
}
} finally {
expected.remove();
@@ -295,7 +293,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
*/
public void testNumBuckets_totalNumBuckets() {
- ExpectedException expected = addExpectedException("IllegalStateException");
+ IgnoredException expected = IgnoredException.addIgnoredException("IllegalStateException");
try {
member1.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
member1.invoke(FixedPartitioningTestBase.class, "createRegionWithPartitionAttributes",
@@ -330,7 +328,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
if (!((ex.getCause() instanceof IllegalStateException) && (ex.getCause()
.getMessage()
.contains("for different primary partitions should not be greater than total-num-buckets ")))) {
- fail("Expected IllegalStateException ", ex);
+ Assert.fail("Expected IllegalStateException ", ex);
}
} finally {
expected.remove();
@@ -372,7 +370,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
}
catch (Exception ex) {
if (!((ex.getCause() instanceof PartitionNotAvailableException))) {
- fail("Expected PartitionNotAvailableException ", ex);
+ Assert.fail("Expected PartitionNotAvailableException ", ex);
}
}
}
@@ -384,7 +382,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
*/
public void test_DataStoreWithoutPartition_DataStoreWithPartition() {
- ExpectedException expected = addExpectedException("IllegalStateException");
+ IgnoredException expected = IgnoredException.addIgnoredException("IllegalStateException");
try {
member1.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
member1.invoke(FixedPartitioningTestBase.class, "createRegionWithPartitionAttributes",
@@ -402,7 +400,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
}
catch (Exception ex) {
if (!((ex.getCause() instanceof IllegalStateException))) {
- fail("Expected IllegalStateException ", ex);
+ Assert.fail("Expected IllegalStateException ", ex);
}
} finally {
expected.remove();
@@ -416,7 +414,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
*/
public void test_DataStoreWithPartition_DataStoreWithoutPartition() {
- ExpectedException expected = addExpectedException("IllegalStateException");
+ IgnoredException expected = IgnoredException.addIgnoredException("IllegalStateException");
try {
member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
FixedPartitionAttributes fpa1 = FixedPartitionAttributes
@@ -434,7 +432,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
}
catch (Exception ex) {
if (!((ex.getCause() instanceof IllegalStateException))) {
- fail("Expected IllegalStateException ", ex);
+ Assert.fail("Expected IllegalStateException ", ex);
}
} finally {
expected.remove();
@@ -668,7 +666,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
}
catch (Exception ex) {
if (!((ex.getCause() instanceof EntryNotFoundException))) {
- fail("Expected EntryNotFoundException ", ex);
+ Assert.fail("Expected EntryNotFoundException ", ex);
}
}
@@ -727,7 +725,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
}
catch (Exception ex) {
if (!((ex.getCause() instanceof IllegalStateException))) {
- fail("Expected IllegalStateException ", ex);
+ Assert.fail("Expected IllegalStateException ", ex);
}
}
}
@@ -876,7 +874,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
}
catch (Exception ex) {
if (!((ex.getCause() instanceof IllegalStateException))) {
- fail("Expected IllegalStateException ", ex);
+ Assert.fail("Expected IllegalStateException ", ex);
}
}
}
@@ -931,7 +929,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
}
catch (Exception ex) {
if (!((ex.getCause() instanceof IllegalStateException))) {
- fail("Expected IllegalStateException ", ex);
+ Assert.fail("Expected IllegalStateException ", ex);
}
}
}
@@ -1208,7 +1206,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
createRegionWithPartitionAttributes("Quarter", fpaList, 3, 40, 12,
new QuarterPartitionResolver(), null, false);
- pause(1000);
+ Wait.pause(1000);
member1.invoke(FixedPartitioningTestBase.class, "checkPrimaryBucketsForQuarter",
new Object[] { 3, 0 });
@@ -1328,7 +1326,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
new Object[] { 9, 3 });
member4.invoke(FixedPartitioningTestBase.class, "closeCache");
- pause(1000);
+ Wait.pause(1000);
member1.invoke(FixedPartitioningTestBase.class,
"checkPrimarySecondaryData_TwoSecondaries", new Object[] { Quarter1,
@@ -1438,7 +1436,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
new Object[] { 6, 3 });
member4.invoke(FixedPartitioningTestBase.class, "closeCache");
- pause(1000);
+ Wait.pause(1000);
member3.invoke(FixedPartitioningTestBase.class, "checkPrimaryBucketsForQuarterAfterCacheClosed",
new Object[] { 6, 6 });
@@ -1456,7 +1454,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
new Object[] { "Quarter", fpaList, 1, 40, 12,
new QuarterPartitionResolver(), null, false });
- pause(1000);
+ Wait.pause(1000);
member1.invoke(FixedPartitioningTestBase.class, "checkPrimarySecondaryData",
new Object[] { Quarter1, true });
@@ -1543,7 +1541,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
member4.invoke(FixedPartitioningTestBase.class, "closeCache");
member2.invoke(FixedPartitioningTestBase.class, "closeCache");
- pause(1000);
+ Wait.pause(1000);
member3.invoke(FixedPartitioningTestBase.class, "checkPrimaryBucketsForQuarterAfterCacheClosed",
new Object[] { 6, 6 });
@@ -1572,7 +1570,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
member2.invoke(FixedPartitioningTestBase.class, "createRegionWithPartitionAttributes",
new Object[] { "Quarter", fpaList, 1, 40, 12,
new QuarterPartitionResolver(), null, false });
- pause(1000);
+ Wait.pause(1000);
member1.invoke(FixedPartitioningTestBase.class, "checkPrimarySecondaryData",
new Object[] { Quarter1, true });
@@ -1594,7 +1592,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
member4.invoke(FixedPartitioningTestBase.class, "doRebalance");
- pause(2000);
+ Wait.pause(2000);
member1.invoke(FixedPartitioningTestBase.class, "checkPrimaryBucketsForQuarter",
new Object[] { 6, 3 });
member2.invoke(FixedPartitioningTestBase.class, "checkPrimaryBucketsForQuarter",
@@ -1674,7 +1672,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
member3.invoke(FixedPartitioningTestBase.class, "closeCache");
- pause(1000);
+ Wait.pause(1000);
member1.invoke(FixedPartitioningTestBase.class, "checkStartingBucketIDs_Nodedown");
member2.invoke(FixedPartitioningTestBase.class, "checkStartingBucketIDs_Nodedown");
@@ -1685,7 +1683,7 @@ public class FixedPartitioningDUnitTest extends FixedPartitioningTestBase {
new Object[] { "Quarter", fpaList, 2, 40, 12,
new QuarterPartitionResolver(), null, false });
- pause(3000);
+ Wait.pause(3000);
member1.invoke(FixedPartitioningTestBase.class, "checkStartingBucketIDs_Nodeup");
member2.invoke(FixedPartitioningTestBase.class, "checkStartingBucketIDs_Nodeup");