You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by je...@apache.org on 2016/02/11 16:27:04 UTC
[40/62] [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/cache30/MultiVMRegionTestCase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
index 2bb172e..d3b065c 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
@@ -114,12 +114,17 @@ import com.gemstone.gemfire.internal.offheap.MemoryChunkWithRefCount;
import com.gemstone.gemfire.internal.offheap.SimpleMemoryAllocatorImpl;
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.RMIException;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Invoke;
/**
@@ -164,8 +169,8 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
disconnectAllFromDS();
}
- public void tearDown2() throws Exception {
- super.tearDown2();
+ @Override
+ protected final void postTearDownRegionTestCase() throws Exception {
DistributedTestCase.cleanupAllVms();
CCRegion = null;
}
@@ -457,11 +462,11 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
Object value = e.getNewValue();
assertNotNull(value);
try {
- getLogWriter().info("++ Adding " + value);
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("++ Adding " + value);
queue.put(value);
} catch (InterruptedException ex) {
- fail("Why was I interrupted?", ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Why was I interrupted?", ex);
}
}
});
@@ -477,13 +482,13 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
(LinkedBlockingQueue) region.getUserAttribute();
for (int i = 0; i <= lastNumber; i++) {
try {
- getLogWriter().info("++ Waiting for " + i);
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("++ Waiting for " + i);
Integer value = (Integer) queue.take();
- getLogWriter().info("++ Got " + value);
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("++ Got " + value);
assertEquals(i, value.intValue());
} catch (InterruptedException ex) {
- fail("Why was I interrupted?", ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Why was I interrupted?", ex);
}
}
}
@@ -501,14 +506,14 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
});
- DistributedTestCase.join(ai0, 30 * 1000, getLogWriter());
- DistributedTestCase.join(ai1, 30 * 1000, getLogWriter());
+ ThreadUtils.join(ai0, 30 * 1000);
+ ThreadUtils.join(ai1, 30 * 1000);
if (ai0.exceptionOccurred()) {
- fail("ai0 failed", ai0.getException());
+ com.gemstone.gemfire.test.dunit.Assert.fail("ai0 failed", ai0.getException());
} else if (ai1.exceptionOccurred()) {
- fail("ai1 failed", ai1.getException());
+ com.gemstone.gemfire.test.dunit.Assert.fail("ai1 failed", ai1.getException());
}
}
@@ -648,13 +653,13 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
region.put(key, newValue);
}
});
- invokeRepeatingIfNecessary(vm1, new CacheSerializableRunnable("Get entry") {
+ Invoke.invokeRepeatingIfNecessary(vm1, new CacheSerializableRunnable("Get entry") {
public void run2() throws CacheException {
Region region =
getRootRegion().getSubregion(name);
assertEquals(newValue, region.get(key));
}
- });
+ }, getRepeatTimeoutMs());
}
@@ -766,7 +771,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
};
- invokeInEveryVM(create);
+ Invoke.invokeInEveryVM(create);
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -780,7 +785,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
});
- invokeInEveryVM(new CacheSerializableRunnable("Verify region destruction") {
+ Invoke.invokeInEveryVM(new CacheSerializableRunnable("Verify region destruction") {
public void run2() throws CacheException {
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
@@ -790,7 +795,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
return "Waiting for region " + name + " to be destroyed";
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 10, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 10, true);
Region region = getRootRegion().getSubregion(name);
assertNull(region);
}
@@ -978,7 +983,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
// changed from severe to fine because it is possible
// for this to return non-null on d-no-ack
// that is was invokeRepeatingIfNecessary is called
- getLogWriter().fine("invalidated entry has value of " + entry.getValue());
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().fine("invalidated entry has value of " + entry.getValue());
}
assertNull(entry.getValue());
}
@@ -1085,7 +1090,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
};
- invokeInEveryVM(create);
+ Invoke.invokeInEveryVM(create);
final Object key = "KEY";
final Object value = "VALUE";
@@ -1110,7 +1115,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
};
- invokeInEveryVM(put);
+ Invoke.invokeInEveryVM(put);
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -1152,7 +1157,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
};
- invokeInEveryVMRepeatingIfNecessary(verify);
+ Invoke.invokeInEveryVMRepeatingIfNecessary(verify, getRepeatTimeoutMs());
}
/**
@@ -1212,7 +1217,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
try {
assertEquals(newValue, DataSerializer.readObject(dis));
} catch (Exception e) {
- fail("Unexpected Exception", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Unexpected Exception", e);
}
}
};
@@ -1265,7 +1270,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
try {
assertEquals(newValue, DataSerializer.readObject(dis));
} catch (Exception e) {
- fail("Unexpected Exception", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Unexpected Exception", e);
}
}
};
@@ -1749,7 +1754,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
assertEquals(value, result);
return result;
} catch (TimeoutException ex) {
- fail("Why did I time out?", ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Why did I time out?", ex);
}
return null;
}
@@ -1843,7 +1848,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
assertEquals(value, result);
return result;
} catch (TimeoutException ex) {
- fail("Why did I time out?", ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Why did I time out?", ex);
}
return null;
}
@@ -2302,7 +2307,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
} catch (CacheWriterException ex) {
if (region.isDestroyed()) {
- fail("should not have an exception if region is destroyed", ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("should not have an exception if region is destroyed", ex);
}
assertEquals(1, region.size());
if (region.getAttributes().getOffHeap() && !(region instanceof PartitionedRegion)) {
@@ -2341,7 +2346,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
return "never saw off-heap object count go to zero. Last value was " + ma.getStats().getObjects();
}
};
- DistributedTestCase.waitForCriterion(waitForStatChange, 3000, 10, true);
+ Wait.waitForCriterion(waitForStatChange, 3000, 10, true);
}
}
});
@@ -2596,7 +2601,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
assertNull(helper.netSearch(true));
} catch (TimeoutException ex) {
- fail("Why did I time out?", ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Why did I time out?", ex);
}
return value;
}
@@ -2683,7 +2688,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
getSystem().getLogWriter().info("testDistributedPut: Created Region");
}
catch (CacheException e) {
- fail("While creating region", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", e);
}
}
};
@@ -2700,7 +2705,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
}
catch (CacheException e) {
- fail("While creating region", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", e);
}
}
};
@@ -2730,13 +2735,13 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
rgn.put("key", "value");
getSystem().getLogWriter().info("testDistributedPut: Put Value");
- invokeInEveryVMRepeatingIfNecessary(new CacheSerializableRunnable("testDistributedPut: Verify Received Value") {
+ Invoke.invokeInEveryVMRepeatingIfNecessary(new CacheSerializableRunnable("testDistributedPut: Verify Received Value") {
public void run2() {
Region rgn1 = getRootRegion().getSubregion(rgnName);
assertNotNull("Could not find entry for 'key'", rgn1.getEntry("key"));
assertEquals("value", rgn1.getEntry("key").getValue());
}
- });
+ }, getRepeatTimeoutMs());
}
catch(Exception e) {
@@ -2912,14 +2917,14 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
});
- invokeRepeatingIfNecessary(vm2, new CacheSerializableRunnable("Wait for update") {
+ Invoke.invokeRepeatingIfNecessary(vm2, new CacheSerializableRunnable("Wait for update") {
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(name);
assertNotNull(region.getEntry(key1));
assertNotNull(region.getEntry(key2));
assertNotNull(region.getEntry(key3));
}
- });
+ }, getRepeatTimeoutMs());
// Destroy the local entries so we know that they are not found by
// a netSearch
@@ -2932,7 +2937,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
});
- invokeRepeatingIfNecessary(vm2, new CacheSerializableRunnable("Verify keys") {
+ Invoke.invokeRepeatingIfNecessary(vm2, new CacheSerializableRunnable("Verify keys") {
public void run2() throws CacheException {
Region region =
getRootRegion().getSubregion(name);
@@ -2952,7 +2957,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
assertNotNull(entry3);
assertEquals(value3, entry3.getValue());
}
- });
+ }, getRepeatTimeoutMs());
}
/**
@@ -3038,14 +3043,14 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
});
- invokeRepeatingIfNecessary(vm2, new CacheSerializableRunnable("Wait for update") {
+ Invoke.invokeRepeatingIfNecessary(vm2, new CacheSerializableRunnable("Wait for update") {
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(name);
assertNotNull(region.getEntry(key1));
assertNotNull(region.getEntry(key2));
assertNotNull(region.getEntry(key3));
}
- });
+ }, getRepeatTimeoutMs());
// apply delta
vm0.invoke(new CacheSerializableRunnable("Apply delta") {
@@ -3076,7 +3081,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
};
- invokeRepeatingIfNecessary(vm0, verify);
+ Invoke.invokeRepeatingIfNecessary(vm0, verify, getRepeatTimeoutMs());
// Destroy the local entries so we know that they are not found by
@@ -3088,7 +3093,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
});
- invokeRepeatingIfNecessary(vm2, verify);
+ Invoke.invokeRepeatingIfNecessary(vm2, verify, getRepeatTimeoutMs());
}
@@ -3311,7 +3316,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
assertTrue(index >= 0);
assertEquals(expectedValues.remove(index), event.getNewValue());
expectedKeys.remove(index);
- getLogWriter().info("afterCreate called in " +
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("afterCreate called in " +
"MirroredDataFromNonMirroredListener for key:" + event.getKey());
}
}
@@ -3432,7 +3437,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
Region.Entry entry1 = region.getEntry(key1);
if (!getRegionAttributes().getDataPolicy().withReplication()) {
if (entry1 != null) {
- getLogWriter().info("found entry " + entry1);
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("found entry " + entry1);
}
assertNull(entry1);
}
@@ -3714,7 +3719,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
});
- pause(shortTimeout * 10);
+ Wait.pause(shortTimeout * 10);
// Even though netSearch finds vm1's entry is not expired, it is considered
// expired with respect to vm0's attributes
@@ -3805,7 +3810,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
});
- pause(shortTimeout * 2);
+ Wait.pause(shortTimeout * 2);
// Even though netSearch finds vm1's entry is not expired, it is considered
// expired with respect to vm0's attributes
@@ -3941,7 +3946,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
return "never saw create of " + key;
}
};
- DistributedTestCase.waitForCriterion(waitForCreate, 3000, 10, true);
+ Wait.waitForCriterion(waitForCreate, 3000, 10, true);
}
});
@@ -3965,7 +3970,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
return "never saw expire of " + key + " entry=" + region.getEntry(key);
}
};
- DistributedTestCase.waitForCriterion(waitForExpire, 4000, 10, true);
+ Wait.waitForCriterion(waitForExpire, 4000, 10, true);
}
});
@@ -3980,7 +3985,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
return "never saw expire of " + key + " entry=" + region.getEntry(key);
}
};
- DistributedTestCase.waitForCriterion(waitForExpire, 4000, 10, true);
+ Wait.waitForCriterion(waitForExpire, 4000, 10, true);
assertTrue(destroyListener.waitForInvocation(555));
assertTrue(((DestroyListener)destroyListener).eventIsExpiration);
}
@@ -4090,7 +4095,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
break;
} catch (AssertionFailedError e) {
if (retry > 0) {
- pause(1);
+ Wait.pause(1);
} else {
throw e;
}
@@ -4130,7 +4135,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
return "Entry for key " + key + " never expired (since it still exists) " + expiryInfo;
}
};
- DistributedTestCase.waitForCriterion(waitForUpdate, 30000, 1, true);
+ Wait.waitForCriterion(waitForUpdate, 30000, 1, true);
}
assertNull(region.getEntry(key));
}
@@ -4192,7 +4197,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
region.create(key, null);
EntryExpiryTask eet = region.getEntryExpiryTask(key);
region.create("createExpiryTime", eet.getExpirationTime());
- waitForExpiryClockToChange(region);
+ Wait.waitForExpiryClockToChange(region);
}
});
@@ -4234,7 +4239,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
return "never saw update of " + key;
}
};
- DistributedTestCase.waitForCriterion(waitForUpdate, 3000, 10, true);
+ Wait.waitForCriterion(waitForUpdate, 3000, 10, true);
EntryExpiryTask eet = region.getEntryExpiryTask(key);
long createExpiryTime = (Long) region.get("createExpiryTime");
@@ -4286,7 +4291,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setDataPolicy(DataPolicy.NORMAL);
factory.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL));
- getLogWriter().info("MJT DEBUG: attrs0 are " + factory.create());
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("MJT DEBUG: attrs0 are " + factory.create());
createRootRegion(factory.create());
}
{
@@ -4296,7 +4301,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
if (getRegionAttributes().getDataPolicy() == DataPolicy.NORMAL) {
factory.setDataPolicy(DataPolicy.PRELOADED);
}
- getLogWriter().info("MJT DEBUG: attrs1 are " + factory.create());
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("MJT DEBUG: attrs1 are " + factory.create());
Region region = createRegion(name, factory.create());
}
finishCacheXml(name);
@@ -4358,7 +4363,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
return "replicate count never reached " + expectedProfiles;
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
DataPolicy currentPolicy = getRegionAttributes().getDataPolicy();
int numProfiles = 0;
@@ -4375,7 +4380,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
// before the get initial image is complete.
for (int i = 1; i < NB1_NUM_ENTRIES; i += 2) {
Object key = new Integer(i);
- getLogWriter().info("Operation #"+i+" on key " + key);
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Operation #"+i+" on key " + key);
switch (i % 6) {
case 1: // UPDATE
// use the current timestamp so we know when it happened
@@ -4433,34 +4438,34 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
});
}
- getLogWriter().info("Before GetInitialImage, data policy is "+getRegionAttributes().getDataPolicy()+", scope is "+getRegionAttributes().getScope());
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Before GetInitialImage, data policy is "+getRegionAttributes().getDataPolicy()+", scope is "+getRegionAttributes().getScope());
AsyncInvocation asyncGII = vm2.invokeAsync(create);
if (!getRegionAttributes().getScope().isGlobal()) {
// wait for nonblocking operations to complete
- DistributedTestCase.join(async, 30 * 1000, getLogWriter());
+ ThreadUtils.join(async, 30 * 1000);
vm2.invoke(new SerializableRunnable("Set fast image processing") {
public void run() {
com.gemstone.gemfire.internal.cache.InitialImageOperation.slowImageProcessing = 0;
}
});
- getLogWriter().info("after async nonblocking ops complete");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("after async nonblocking ops complete");
}
// wait for GII to complete
- DistributedTestCase.join(asyncGII, 30 * 1000, getLogWriter());
+ ThreadUtils.join(asyncGII, 30 * 1000);
final long iiComplete = System.currentTimeMillis();
- getLogWriter().info("Complete GetInitialImage at: " + System.currentTimeMillis());
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Complete GetInitialImage at: " + System.currentTimeMillis());
if (getRegionAttributes().getScope().isGlobal()) {
// wait for nonblocking operations to complete
- DistributedTestCase.join(async, 30 * 1000, getLogWriter());
+ ThreadUtils.join(async, 30 * 1000);
}
if (async.exceptionOccurred()) {
- fail("async failed", async.getException());
+ com.gemstone.gemfire.test.dunit.Assert.fail("async failed", async.getException());
}
if (asyncGII.exceptionOccurred()) {
- fail("asyncGII failed", asyncGII.getException());
+ com.gemstone.gemfire.test.dunit.Assert.fail("asyncGII failed", asyncGII.getException());
}
// Locally destroy the region in vm0 so we know that they are not found by
@@ -4472,7 +4477,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
region.localDestroyRegion();
}
});
- getLogWriter().info("after localDestroyRegion");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("after localDestroyRegion");
// invoke repeating so noack regions wait for all updates to get processed
vm2.invokeRepeatingIfNecessary(new CacheSerializableRunnable("Verify entryCount") {
@@ -4495,7 +4500,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
if (entriesDumped) return;
entriesDumped = true;
- LogWriter logger = getLogWriter();
+ LogWriter logger = com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter();
logger.info("DUMPING Entries with values in VM that should have been destroyed:");
for (int i = 5; i < NB1_NUM_ENTRIES; i += 6) {
try {
@@ -4508,7 +4513,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
}
}, 5000);
- getLogWriter().info("after verify entryCount");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("after verify entryCount");
vm2.invoke(new CacheSerializableRunnable("Verify keys/values & Nonblocking") {
@@ -4562,7 +4567,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
}
}
- getLogWriter().info(name + ": " + numConcurrent + " entries out of " + entryCount +
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(name + ": " + numConcurrent + " entries out of " + entryCount +
" were updated concurrently with getInitialImage");
// make sure at least some of them were concurrent
if (region.getAttributes().getScope().isGlobal()) {
@@ -4578,7 +4583,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
}
});
- getLogWriter().info("after verify key/values");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("after verify key/values");
}
/**
@@ -4690,7 +4695,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
return "replicate count never reached " + expectedProfiles;
}
};
- DistributedTestCase.waitForCriterion(ev, 100 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 100 * 1000, 200, true);
// operate on every odd entry with different value, alternating between
// updates, invalidates, and destroys. These operations are likely
@@ -4768,30 +4773,30 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
if (!getRegionAttributes().getScope().isGlobal()) {
// wait for nonblocking operations to complete
- DistributedTestCase.join(async, 30 * 1000, getLogWriter());
+ ThreadUtils.join(async, 30 * 1000);
vm2.invoke(new SerializableRunnable("Set fast image processing") {
public void run() {
com.gemstone.gemfire.internal.cache.InitialImageOperation.slowImageProcessing = 0;
}
});
- getLogWriter().info("after async nonblocking ops complete");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("after async nonblocking ops complete");
}
// wait for GII to complete
- DistributedTestCase.join(asyncGII, 30 * 1000, getLogWriter());
+ ThreadUtils.join(asyncGII, 30 * 1000);
final long iiComplete = System.currentTimeMillis();
- getLogWriter().info("Complete GetInitialImage at: " + System.currentTimeMillis());
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Complete GetInitialImage at: " + System.currentTimeMillis());
if (getRegionAttributes().getScope().isGlobal()) {
// wait for nonblocking operations to complete
- DistributedTestCase.join(async, 30 * 1000, getLogWriter());
+ ThreadUtils.join(async, 30 * 1000);
}
if (async.exceptionOccurred()) {
- fail("async failed", async.getException());
+ com.gemstone.gemfire.test.dunit.Assert.fail("async failed", async.getException());
}
if (asyncGII.exceptionOccurred()) {
- fail("asyncGII failed", asyncGII.getException());
+ com.gemstone.gemfire.test.dunit.Assert.fail("asyncGII failed", asyncGII.getException());
}
// Locally destroy the region in vm0 so we know that they are not found by
@@ -4825,7 +4830,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
if (entriesDumped) return;
entriesDumped = true;
- LogWriter logger = getLogWriter();
+ LogWriter logger = com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter();
logger.info("DUMPING Entries with values in VM that should have been destroyed:");
for (int i = 5; i < NB1_NUM_ENTRIES; i += 6) {
logger.info(i + "-->" +
@@ -4886,7 +4891,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
}
}
- getLogWriter().info(name + ": " + numConcurrent + " entries out of " + entryCount +
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(name + ": " + numConcurrent + " entries out of " + entryCount +
" were updated concurrently with getInitialImage");
// make sure at least some of them were concurrent
{
@@ -4999,7 +5004,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
return "profile count never reached " + expectedProfiles;
}
};
- DistributedTestCase.waitForCriterion(ev, 30 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 30 * 1000, 200, true);
// operate on every odd entry with different value, alternating between
// updates, invalidates, and destroys. These operations are likely
@@ -5081,7 +5086,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
if (!getRegionAttributes().getScope().isGlobal()) {
// wait for nonblocking operations to complete
try {
- DistributedTestCase.join(async, 30 * 1000, getLogWriter());
+ ThreadUtils.join(async, 30 * 1000);
} finally {
vm2.invoke(new SerializableRunnable("Set fast image processing") {
public void run() {
@@ -5089,16 +5094,16 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
});
}
- getLogWriter().info("after async nonblocking ops complete");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("after async nonblocking ops complete");
}
// wait for GII to complete
- DistributedTestCase.join(asyncGII, 30 * 1000, getLogWriter());
+ ThreadUtils.join(asyncGII, 30 * 1000);
final long iiComplete = System.currentTimeMillis();
- getLogWriter().info("Complete GetInitialImage at: " + System.currentTimeMillis());
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Complete GetInitialImage at: " + System.currentTimeMillis());
if (getRegionAttributes().getScope().isGlobal()) {
// wait for nonblocking operations to complete
- DistributedTestCase.join(async, 30 * 1000, getLogWriter());
+ ThreadUtils.join(async, 30 * 1000);
}
if (asyncGII.exceptionOccurred()) {
throw new Error("asyncGII failed", asyncGII.getException());
@@ -5139,7 +5144,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
if (entriesDumped) return;
entriesDumped = true;
- LogWriter logger = getLogWriter();
+ LogWriter logger = com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter();
logger.info("DUMPING Entries with values in VM that should have been destroyed:");
for (int i = 5; i < NB1_NUM_ENTRIES; i += 6) {
logger.info(i + "-->" +
@@ -5205,7 +5210,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
}
}
- getLogWriter().info(name + ": " + numConcurrent + " entries out of " + entryCount +
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(name + ": " + numConcurrent + " entries out of " + entryCount +
" were updated concurrently with getInitialImage");
// [sumedh] Occasionally fails. Do these assertions really make sense?
@@ -5279,7 +5284,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
// start asynchronous process that does updates to the data
AsyncInvocation async = vm0.invokeAsync(new CacheSerializableRunnable("Do Nonblocking Operations") {
public void run2() throws CacheException {
- pause(200); // give the gii guy a chance to start
+ Wait.pause(200); // give the gii guy a chance to start
Region region =
getRootRegion().getSubregion(name);
@@ -5296,7 +5301,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
return "profile count never became exactly " + expectedProfiles;
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
// since we want to force a GII while updates are flying, make sure
// the other VM gets its CreateRegionResponse and starts its GII
@@ -5365,7 +5370,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
});
- ExpectedException ex = addExpectedException("RegionDestroyedException");
+ IgnoredException ex = IgnoredException.addIgnoredException("RegionDestroyedException");
try {
// in the meantime, do the get initial image in vm2
AsyncInvocation asyncGII = vm2.invokeAsync(new CacheSerializableRunnable("Create Mirrored Region") {
@@ -5404,9 +5409,9 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
});
if (getRegionAttributes().getScope().isGlobal()) {
// wait for nonblocking operations to complete
- DistributedTestCase.join(async, 30 * 1000, getLogWriter());
+ ThreadUtils.join(async, 30 * 1000);
if (async.exceptionOccurred()) {
- fail("async invocation failed", async.getException());
+ com.gemstone.gemfire.test.dunit.Assert.fail("async invocation failed", async.getException());
}
vm2.invoke(new SerializableRunnable("Set fast image processing") {
@@ -5414,22 +5419,22 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
com.gemstone.gemfire.internal.cache.InitialImageOperation.slowImageProcessing = 0;
}
});
- getLogWriter().info("after async nonblocking ops complete");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("after async nonblocking ops complete");
}
// wait for GII to complete
//getLogWriter().info("starting wait for GetInitialImage Completion");
- DistributedTestCase.join(asyncGII, 30 * 1000, getLogWriter());
- getLogWriter().info("Complete GetInitialImage at: " + System.currentTimeMillis());
+ ThreadUtils.join(asyncGII, 30 * 1000);
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Complete GetInitialImage at: " + System.currentTimeMillis());
if (getRegionAttributes().getScope().isGlobal()) {
// wait for nonblocking operations to complete
- DistributedTestCase.join(async, 30 * 1000, getLogWriter());
+ ThreadUtils.join(async, 30 * 1000);
}
if (async.exceptionOccurred()) {
- fail("async failed", async.getException());
+ com.gemstone.gemfire.test.dunit.Assert.fail("async failed", async.getException());
}
if (asyncGII.exceptionOccurred()) {
- fail("asyncGII failed", asyncGII.getException());
+ com.gemstone.gemfire.test.dunit.Assert.fail("asyncGII failed", asyncGII.getException());
}
} finally {
ex.remove();
@@ -5460,10 +5465,10 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
- getLogWriter().info(name + ": before creates");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(name + ": before creates");
vm0.invoke(create);
vm1.invoke(create);
- getLogWriter().info(name + ": after creates");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(name + ": after creates");
final Object key = "KEY";
final Object key2 = "KEY2";
@@ -5476,7 +5481,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
disconnectFromDS();
}
});
- getLogWriter().info(name + ": after vm2 disconnect");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(name + ": after vm2 disconnect");
try {
vm0.invoke(new CacheSerializableRunnable("Put int") {
@@ -5485,7 +5490,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
IntWrapper.IntWrapperSerializer serializer =
(IntWrapper.IntWrapperSerializer)
DataSerializer.register(c);
- getLogWriter().info("Registered serializer id:" + serializer.getId()
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Registered serializer id:" + serializer.getId()
+ " class:" + c.getName());
Region region = getRootRegion().getSubregion(name);
@@ -5495,7 +5500,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
assertTrue(serializer.wasInvoked);
}
});
- getLogWriter().info(name + ": after vm0 put");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(name + ": after vm0 put");
SerializableRunnable get = new CacheSerializableRunnable("Get int") {
public void run2() throws CacheException {
@@ -5521,7 +5526,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
return "DataSerializer with id 120 was never registered";
}
};
- DistributedTestCase.waitForCriterion(ev, 30 * 1000, 10, true);
+ Wait.waitForCriterion(ev, 30 * 1000, 10, true);
} finally {
InternalDataSerializer.GetMarker.WAIT_MS = savVal;
}
@@ -5532,7 +5537,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
};
vm1.invoke(get);
- getLogWriter().info(name + ": after vm1 get");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(name + ": after vm1 get");
// Make sure that VMs that connect after registration can get the
// serializer
@@ -5546,7 +5551,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
});
vm2.invoke(create);
- getLogWriter().info(name + ": after vm2 create");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(name + ": after vm2 create");
vm2.invoke(new CacheSerializableRunnable("Put long") {
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(name);
@@ -5560,9 +5565,9 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
assertTrue(serializer.wasInvoked);
}
});
- getLogWriter().info(name + ": after vm2 put");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(name + ": after vm2 put");
vm2.invoke(get);
- getLogWriter().info(name + ": after vm2 get");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(name + ": after vm2 get");
SerializableRunnable get2 = new CacheSerializableRunnable("Get long") {
public void run2() throws CacheException {
@@ -5574,17 +5579,17 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
};
vm0.invoke(get2);
- getLogWriter().info(name + ": after vm0 get2");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(name + ": after vm0 get2");
vm1.invoke(get2);
- getLogWriter().info(name + ": after vm1 get2");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(name + ": after vm1 get2");
// wait a little while for other netsearch requests to return
// before unregistering the serializers that will be needed to process these
// responses.
} finally {
- pause(1500);
+ Wait.pause(1500);
unregisterAllSerializers();
- getLogWriter().info(name + ": after unregister");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info(name + ": after unregister");
}
}
@@ -5696,7 +5701,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
// wait a little while for other netsearch requests to return
// before unregistering the serializers that will be needed to process these
// responses.
- pause(1500);
+ Wait.pause(1500);
unregisterAllSerializers();
}
}
@@ -5707,7 +5712,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
* system.
*/
private static void unregisterAllSerializers() {
- unregisterAllDataSerializersFromAllVms();
+ DistributedTestUtils.unregisterAllDataSerializersFromAllVms();
cleanupAllVms();
}
@@ -6005,7 +6010,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
return "waiting for entry event";
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
EntryEvent listenEvent = cdcl.getEntryEvent();
assertNotNull("Cannot assert TX CacheListener Events with a null Entry Event", listenEvent);
assertEquals(re, listenEvent.getRegion());
@@ -6071,7 +6076,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
getSystem().getLogWriter().info("testTXSimpleOps: Created region");
}
catch (CacheException e) {
- fail("While creating region", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", e);
}
}
};
@@ -6088,7 +6093,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
getSystem().getLogWriter().info("testTXSimpleOps: Created Key");
}
catch (CacheException e) {
- fail("While creating region", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", e);
}
}
};
@@ -6126,10 +6131,10 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
assertEquals(commitWaits, dmStats.getCommitWaits());
}
getSystem().getLogWriter().info("testTXSimpleOps: Create/Put Value");
- invokeInEveryVM(MultiVMRegionTestCase.class,
+ Invoke.invokeInEveryVM(MultiVMRegionTestCase.class,
"assertCacheCallbackEvents",
new Object[] {rgnName, txId, "key", null, "value"});
- invokeInEveryVMRepeatingIfNecessary(new CacheSerializableRunnable("testTXSimpleOps: Verify Received Value") {
+ Invoke.invokeInEveryVMRepeatingIfNecessary(new CacheSerializableRunnable("testTXSimpleOps: Verify Received Value") {
public void run2() {
Region rgn1 = getRootRegion().getSubregion(rgnName);
assertNotNull("Could not find entry for 'key'", rgn1.getEntry("key"));
@@ -6172,17 +6177,17 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
cdcL.assertCount(0, 1, 0, 0);
}
- });
+ }, getRepeatTimeoutMs());
txMgr.begin();
rgn.put("key", "value2");
txId = txMgr.getTransactionId();
txMgr.commit();
getSystem().getLogWriter().info("testTXSimpleOps: Put(update) Value2");
- invokeInEveryVM(MultiVMRegionTestCase.class,
+ Invoke.invokeInEveryVM(MultiVMRegionTestCase.class,
"assertCacheCallbackEvents",
new Object[] {rgnName, txId, "key", "value", "value2"});
- invokeInEveryVMRepeatingIfNecessary(new CacheSerializableRunnable("testTXSimpleOps: Verify Received Value") {
+ Invoke.invokeInEveryVMRepeatingIfNecessary(new CacheSerializableRunnable("testTXSimpleOps: Verify Received Value") {
public void run2() {
Region rgn1 = getRootRegion().getSubregion(rgnName);
assertNotNull("Could not find entry for 'key'", rgn1.getEntry("key"));
@@ -6215,7 +6220,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
cdcL.assertCount(0, 2, 0, 0);
}
- });
+ }, getRepeatTimeoutMs());
txMgr.begin();
rgn.invalidate("key");
@@ -6223,10 +6228,10 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
txMgr.commit();
getSystem().getLogWriter().info("testTXSimpleOps: invalidate key");
// validate each of the CacheListeners EntryEvents
- invokeInEveryVM(MultiVMRegionTestCase.class,
+ Invoke.invokeInEveryVM(MultiVMRegionTestCase.class,
"assertCacheCallbackEvents",
new Object[] {rgnName, txId, "key", "value2", null});
- invokeInEveryVMRepeatingIfNecessary(new CacheSerializableRunnable("testTXSimpleOps: Verify Received Value") {
+ Invoke.invokeInEveryVMRepeatingIfNecessary(new CacheSerializableRunnable("testTXSimpleOps: Verify Received Value") {
public void run2() {
Region rgn1 = getRootRegion().getSubregion(rgnName);
assertNotNull("Could not find entry for 'key'", rgn1.getEntry("key"));
@@ -6260,7 +6265,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
cdcL.assertCount(0, 2, 1, 0);
}
- });
+ }, getRepeatTimeoutMs());
txMgr.begin();
rgn.destroy("key");
@@ -6268,10 +6273,10 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
txMgr.commit();
getSystem().getLogWriter().info("testTXSimpleOps: destroy key");
// validate each of the CacheListeners EntryEvents
- invokeInEveryVM(MultiVMRegionTestCase.class,
+ Invoke.invokeInEveryVM(MultiVMRegionTestCase.class,
"assertCacheCallbackEvents",
new Object[] {rgnName, txId, "key", null, null});
- invokeInEveryVMRepeatingIfNecessary(new CacheSerializableRunnable("testTXSimpleOps: Verify Received Value") {
+ Invoke.invokeInEveryVMRepeatingIfNecessary(new CacheSerializableRunnable("testTXSimpleOps: Verify Received Value") {
public void run2() {
Region rgn1 = getRootRegion().getSubregion(rgnName);
assertTrue(!rgn1.containsKey("key"));
@@ -6302,7 +6307,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
(CountingDistCacheListener) rgn1.getAttributes().getCacheListeners()[0];
cdcL.assertCount(0, 2, 1, 1);
}
- });
+ }, getRepeatTimeoutMs());
}
catch(Exception e) {
@@ -6371,7 +6376,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
flushIfNecessary(rgn);
}
catch (CacheException e) {
- fail("While creating region", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", e);
}
}
};
@@ -6593,7 +6598,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
getSystem().getLogWriter().info("testTXMultiRegion: Created region1");
}
catch (CacheException e) {
- fail("While creating region", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", e);
}
}
};
@@ -6605,7 +6610,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
getSystem().getLogWriter().info("testTXMultiRegion: Created key");
}
catch (CacheException e) {
- fail("While creating region", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", e);
}
}
};
@@ -6620,7 +6625,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
getSystem().getLogWriter().info("testTXMultiRegion: Created region2");
}
catch (CacheException e) {
- fail("While creating region", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", e);
}
}
};
@@ -6633,7 +6638,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
getSystem().getLogWriter().info("testTXMultiRegion: Created Key");
}
catch (CacheException e) {
- fail("While creating region", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", e);
}
}
};
@@ -6648,7 +6653,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
getSystem().getLogWriter().info("testTXMultiRegion: Created Region");
}
catch (CacheException e) {
- fail("While creating region", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", e);
}
}
};
@@ -6661,7 +6666,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
getSystem().getLogWriter().info("testTXMultiRegion: Created Key");
}
catch (CacheException e) {
- fail("While creating region", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", e);
}
}
};
@@ -7334,7 +7339,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
createRegion(rgnName, rgnAtts.create());
}
catch (CacheException e) {
- fail("While creating region", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", e);
}
}
};
@@ -7350,7 +7355,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
createRegion(rgnName, rgnAtts.create());
}
catch (CacheException e) {
- fail("While creating region", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", e);
}
}
};
@@ -7474,12 +7479,12 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
}
catch (CacheException e) {
- fail("While creating region", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", e);
}
}
};
- invokeInEveryVM(create);
+ Invoke.invokeInEveryVM(create);
// make sure each op sequence has the correct affect transaction event
// check C + C -> EX
// check C + P -> C
@@ -7504,7 +7509,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
txMgr.commit();
// Make sure commit did not trigger callbacks
//// callbackVal.reAssert();
- invokeInEveryVM(new CacheSerializableRunnable("testTXAlgebra: check: C+P->C") {
+ Invoke.invokeInEveryVM(new CacheSerializableRunnable("testTXAlgebra: check: C+P->C") {
public void run2() {
Region rgn1 = getRootRegion().getSubregion(rgnName);
CacheTransactionManager txMgr2 = getCache().getCacheTransactionManager();
@@ -7581,7 +7586,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
assertTrue(!rgn.containsValueForKey("key"));
txMgr.commit();
//// callbackVal.reAssert();
- invokeInEveryVM(new CacheSerializableRunnable("testTXAlgebra: check: C+DI->C (invalid value)") {
+ Invoke.invokeInEveryVM(new CacheSerializableRunnable("testTXAlgebra: check: C+DI->C (invalid value)") {
public void run2() {
Region rgn1 = getRootRegion().getSubregion(rgnName);
CacheTransactionManager txMgr2 = getCache().getCacheTransactionManager();
@@ -7651,7 +7656,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
assertTrue(rgn.containsKey("key"));
assertTrue(!rgn.containsValueForKey("key"));
txMgr.commit();
- invokeInEveryVM(new CacheSerializableRunnable("testTXAlgebra: check: committed LI + TX DI-> NOOP") {
+ Invoke.invokeInEveryVM(new CacheSerializableRunnable("testTXAlgebra: check: committed LI + TX DI-> NOOP") {
public void run2() {
Region rgn1 = getRootRegion().getSubregion(rgnName);
CacheTransactionManager txMgr2 = getCache().getCacheTransactionManager();
@@ -7681,7 +7686,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
assertTrue(rgn.containsKey("key"));
assertTrue(!rgn.containsValueForKey("key"));
txMgr.commit();
- invokeInEveryVM(new CacheSerializableRunnable("testTXAlgebra: check: TX LI + TX DI -> LI") {
+ Invoke.invokeInEveryVM(new CacheSerializableRunnable("testTXAlgebra: check: TX LI + TX DI -> LI") {
public void run2() {
Region rgn1 = getRootRegion().getSubregion(rgnName);
CacheTransactionManager txMgr2 = getCache().getCacheTransactionManager();
@@ -7733,7 +7738,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
assertTrue(!rgn.containsKey("key"));
txMgr.commit();
//// callbackVal.reAssert();
- invokeInEveryVM(new CacheSerializableRunnable("testTXAlgebra: check: C+DD->DD") {
+ Invoke.invokeInEveryVM(new CacheSerializableRunnable("testTXAlgebra: check: C+DD->DD") {
public void run2() {
Region rgn1 = getRootRegion().getSubregion(rgnName);
CacheTransactionManager txMgr2 = getCache().getCacheTransactionManager();
@@ -7769,13 +7774,13 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
// Check C + LI -> C
if (!getRegionAttributes().getDataPolicy().withReplication()) {
// assume that remote regions have same mirror type as local
- invokeInEveryVM(new CacheSerializableRunnable("testTXAlgebra: C+LI-> entry creation") {
+ Invoke.invokeInEveryVM(new CacheSerializableRunnable("testTXAlgebra: C+LI-> entry creation") {
public void run2() {
Region rgn1 = getRootRegion().getSubregion(rgnName);
try {
rgn1.create("key", null);
} catch (CacheException e) {
- fail("While creating key", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating key", e);
}
}
});
@@ -7791,7 +7796,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
assertTrue(!rgn.containsValueForKey("key"));
txMgr.commit();
//// callbackVal.reAssert();
- invokeInEveryVM(new CacheSerializableRunnable("testTXAlgebra: check: C+LI->C (with value)") {
+ Invoke.invokeInEveryVM(new CacheSerializableRunnable("testTXAlgebra: check: C+LI->C (with value)") {
public void run2() {
Region rgn1 = getRootRegion().getSubregion(rgnName);
CacheTransactionManager txMgr2 = getCache().getCacheTransactionManager();
@@ -7960,11 +7965,11 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
try {
bridge.start();
} catch (IOException ex) {
- fail("While creating bridge", ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating bridge", ex);
}
}
} catch (CacheException ex) {
- fail("While creating region", ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", ex);
}
}
};
@@ -8047,7 +8052,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
RegionFactory f = getCache().createRegionFactory(getRegionAttributes());
CCRegion = (LocalRegion)f.create(name);
} catch (CacheException ex) {
- fail("While creating region", ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", ex);
}
}
};
@@ -8065,7 +8070,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
assertTrue("expected some event conflation", events>0);
}
} catch (CacheException e) {
- fail("while performing concurrent operations", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("while performing concurrent operations", e);
}
// } catch (InterruptedException e) {
// fail("someone interrupted my sleep");
@@ -8126,7 +8131,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
long events = CCRegion.getCachePerfStats().getDeltaFailedUpdates();
assertTrue("expected some failed deltas", events>0);
} catch (CacheException e) {
- fail("while performing concurrent operations", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("while performing concurrent operations", e);
}
}
};
@@ -8170,11 +8175,11 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
long start = System.currentTimeMillis();
RegionVersionVector vm0vv = getVersionVector(vm0);
long end = System.currentTimeMillis();
- getLogWriter().info("version vector transmission took " + (end-start) + " ms");
- getLogWriter().info("vm0 vector = " + vm0vv);
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("version vector transmission took " + (end-start) + " ms");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("vm0 vector = " + vm0vv);
- RegionVersionVector vm1vv = getVersionVector(vm1); getLogWriter().info("vm1 vector = " + vm1vv);
- RegionVersionVector vm2vv = getVersionVector(vm2); getLogWriter().info("vm2 vector = " + vm2vv);
+ RegionVersionVector vm1vv = getVersionVector(vm1); com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("vm1 vector = " + vm1vv);
+ RegionVersionVector vm2vv = getVersionVector(vm2); com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("vm2 vector = " + vm2vv);
Map<String, VersionTag> vm0Versions = (Map<String, VersionTag>)vm0.invoke(this.getClass(), "getCCRegionVersions");
Map<String, VersionTag> vm1Versions = (Map<String, VersionTag>)vm1.invoke(this.getClass(), "getCCRegionVersions");
@@ -8235,7 +8240,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
boolean includeClear = true;
doOpsLoop(msToRun, includeClear);
} catch (CacheException e) {
- fail("while performing concurrent operations", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("while performing concurrent operations", e);
}
}
};
@@ -8250,7 +8255,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
f.setDiskSynchronous(syncDiskWrite);
CCRegion = (LocalRegion)f.create(name);
} catch (CacheException ex) {
- fail("While creating region", ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", ex);
}
}
};
@@ -8349,7 +8354,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
CCRegion = (LocalRegion)f.create(name);
} catch (CacheException ex) {
- fail("While creating region", ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", ex);
}
}
};
@@ -8365,7 +8370,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
try {
doOpsLoop(5000, true);
} catch (CacheException e) {
- fail("while performing concurrent operations", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("while performing concurrent operations", e);
}
// } catch (InterruptedException e) {
// fail("someone interrupted my sleep");
@@ -8460,7 +8465,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
sendSerialMessageToAll(); // flush the ops
}
} catch (CacheException ex) {
- fail("While creating region", ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", ex);
}
}
};
@@ -8483,7 +8488,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
sendSerialMessageToAll(); // flush the ops
}
} catch (CacheException e) {
- fail("while performing destroy operations", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("while performing destroy operations", e);
}
// OSProcess.printStacks(0, getLogWriter(), false);
}
@@ -8507,10 +8512,10 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
};
try {
- waitForCriterion(waitForExpiration, TombstoneService.REPLICATED_TOMBSTONE_TIMEOUT+10000, 1000, true);
+ Wait.waitForCriterion(waitForExpiration, TombstoneService.REPLICATED_TOMBSTONE_TIMEOUT+10000, 1000, true);
} catch (AssertionFailedError e) {
CCRegion.dumpBackingMap();
- getLogWriter().info("tombstone service state: " + CCRegion.getCache().getTombstoneService());
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("tombstone service state: " + CCRegion.getCache().getTombstoneService());
throw e;
}
}
@@ -8539,7 +8544,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
+ " tombstones left out of " + origCount + " initial tombstones";
}
};
- waitForCriterion(waitForExpiration, TombstoneService.REPLICATED_TOMBSTONE_TIMEOUT+10000, 1000, true);
+ Wait.waitForCriterion(waitForExpiration, TombstoneService.REPLICATED_TOMBSTONE_TIMEOUT+10000, 1000, true);
logger.debug("creating tombstones. current count={}", CCRegion.getTombstoneCount());
for (int i=0; i<numEntries; i++) {
CCRegion.create("cckey" + i, i);
@@ -8562,10 +8567,10 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
} catch (AssertionFailedError e) {
CCRegion.dumpBackingMap();
- getLogWriter().info("tombstone service state: " + CCRegion.getCache().getTombstoneService());
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("tombstone service state: " + CCRegion.getCache().getTombstoneService());
throw e;
} catch (CacheException e) {
- fail("while performing create/destroy operations", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("while performing create/destroy operations", e);
} finally {
TombstoneService.GC_MEMORY_THRESHOLD = oldLimit;
}
@@ -8600,7 +8605,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
sendSerialMessageToAll(); // flush the ops
}
} catch (CacheException e) {
- fail("while performing create operations", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("while performing create operations", e);
}
}
});
@@ -8680,7 +8685,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
CCRegion = (LocalRegion)f.create(name);
} catch (CacheException ex) {
- fail("While creating region", ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", ex);
}
}
};
@@ -8700,7 +8705,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
assertTrue("expected some event conflation", events>0);
}
} catch (CacheException e) {
- fail("while performing concurrent operations", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("while performing concurrent operations", e);
}
}
};
@@ -8861,7 +8866,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
CCRegion = (LocalRegion)f.create(name);
} catch (CacheException ex) {
- fail("While creating region", ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", ex);
}
}
};
@@ -8881,7 +8886,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
assertTrue("expected some event conflation", events>0);
}
} catch (CacheException e) {
- fail("while performing concurrent operations", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("while performing concurrent operations", e);
}
}
};
@@ -8941,7 +8946,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
public void close() {
}
public Object load(LoaderHelper helper) throws CacheLoaderException {
- getLogWriter().info("The test CacheLoader has been invoked for key '" + helper.getKey() + "'");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("The test CacheLoader has been invoked for key '" + helper.getKey() + "'");
return "loadedValue";
}
});
@@ -8999,7 +9004,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
CCRegion = (LocalRegion)f.create(regionName);
} catch (CacheException ex) {
- fail("While creating region", ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", ex);
}
}
};
@@ -9029,7 +9034,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
for (int i=0; i<100; i++) {
RegionEntry entry = r.getRegionEntry("cckey"+i);
int stamp = entry.getVersionStamp().getEntryVersion();
- getLogWriter().info("checking key cckey" + i + " having version " + stamp + " entry=" + entry);
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("checking key cckey" + i + " having version " + stamp + " entry=" + entry);
assertEquals(2, stamp);
assertEquals(result.get("cckey"+i), i+1);
}
@@ -9052,12 +9057,21 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
}
}
if (!failed) {
- fail("asyncInvocation 0 returned exception", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("asyncInvocation 0 returned exception", e);
}
}
return failed;
}
+ /**
+ * The number of milliseconds to try repeating validation code in the
+ * event that AssertionFailedError is thrown. For ACK scopes, no
+ * repeat should be necessary.
+ */
+ protected long getRepeatTimeoutMs() {
+ return 0;
+ }
+
public static void assertNoClearTimeouts() {
// if there are timeouts on waiting for version vector dominance then
// some operation was not properly recorded in the VM throwing this
@@ -9087,13 +9101,13 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
public static byte[] getCCRegionVersionVector() throws Exception {
Object id = getMemberId();
int vm = VM.getCurrentVMNum();
- getLogWriter().info("vm" + vm + " with id " + id + " copying " + CCRegion.getVersionVector().fullToString());
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("vm" + vm + " with id " + id + " copying " + CCRegion.getVersionVector().fullToString());
RegionVersionVector vector = CCRegion.getVersionVector().getCloneForTransmission();
- getLogWriter().info("clone is " + vector);
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("clone is " + vector);
HeapDataOutputStream dos = new HeapDataOutputStream(3000, Version.CURRENT);
DataSerializer.writeObject(vector, dos);
byte[] bytes = dos.toByteArray();
- getLogWriter().info("serialized size is " + bytes.length);
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("serialized size is " + bytes.length);
return bytes;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/OffHeapLRUEvictionControllerDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/OffHeapLRUEvictionControllerDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/OffHeapLRUEvictionControllerDUnitTest.java
index 8f3573b..0caa7bd 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/OffHeapLRUEvictionControllerDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/OffHeapLRUEvictionControllerDUnitTest.java
@@ -23,6 +23,7 @@ import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.OffHeapTestUtil;
import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.ResourceType;
import com.gemstone.gemfire.internal.cache.lru.HeapEvictor;
+import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
/**
@@ -40,7 +41,7 @@ public class OffHeapLRUEvictionControllerDUnitTest extends
}
@Override
- public void tearDown2() throws Exception {
+ protected final void preTearDownCacheTestCase() throws Exception {
SerializableRunnable checkOrphans = new SerializableRunnable() {
@Override
@@ -50,12 +51,8 @@ public class OffHeapLRUEvictionControllerDUnitTest extends
}
}
};
- invokeInEveryVM(checkOrphans);
- try {
- checkOrphans.run();
- } finally {
- super.tearDown2();
- }
+ Invoke.invokeInEveryVM(checkOrphans);
+ checkOrphans.run();
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PRBucketSynchronizationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PRBucketSynchronizationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PRBucketSynchronizationDUnitTest.java
index c81a55f..a68bd46 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PRBucketSynchronizationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PRBucketSynchronizationDUnitTest.java
@@ -40,9 +40,14 @@ import com.gemstone.gemfire.internal.cache.VMCachedDeserializable;
import com.gemstone.gemfire.internal.cache.versions.VMVersionTag;
import com.gemstone.gemfire.internal.cache.versions.VersionSource;
import com.gemstone.gemfire.internal.cache.versions.VersionTag;
+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.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
* concurrency-control tests for client/server
@@ -80,8 +85,8 @@ public class PRBucketSynchronizationDUnitTest extends CacheTestCase {
* did not see secondary buckets perform a delta-GII.
*/
public void doBucketsSyncOnPrimaryLoss(TestType typeOfTest) {
- addExpectedException("killing member's ds");
- addExpectedException("killing member's ds");
+ IgnoredException.addIgnoredException("killing member's ds");
+ IgnoredException.addIgnoredException("killing member's ds");
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
@@ -127,7 +132,7 @@ public class PRBucketSynchronizationDUnitTest extends CacheTestCase {
// Now we crash the primary bucket owner simulating death during distribution.
// The backup buckets should perform a delta-GII for the lost member and
// get back in sync
- crashDistributedSystem(primaryOwner);
+ DistributedTestUtils.crashDistributedSystem(primaryOwner);
for (VM vm: verifyVMs) {
verifySynchronized(vm, primaryID);
@@ -195,7 +200,7 @@ public class PRBucketSynchronizationDUnitTest extends CacheTestCase {
tag.setEntryVersion(1);
tag.setIsRemoteForTesting();
EntryEventImpl event = EntryEventImpl.create(bucket, Operation.CREATE, "Object3", true, primary, true, false);
- getLogWriter().info("applying this event to the cache: " + event);
+ LogWriterUtils.getLogWriter().info("applying this event to the cache: " + event);
event.setNewValue(new VMCachedDeserializable("value3", 12));
event.setVersionTag(tag);
bucket.getRegionMap().basicPut(event, System.currentTimeMillis(), true, false, null, false, false);
@@ -210,12 +215,12 @@ public class PRBucketSynchronizationDUnitTest extends CacheTestCase {
event = EntryEventImpl.create(bucket, Operation.CREATE, "Object5", true, primary, true, false);
event.setNewValue(Token.TOMBSTONE);
event.setVersionTag(tag);
- getLogWriter().info("applying this event to the cache: " + event);
+ LogWriterUtils.getLogWriter().info("applying this event to the cache: " + event);
bucket.getRegionMap().basicPut(event, System.currentTimeMillis(), true, false, null, false, false);
event.release();
bucket.dumpBackingMap();
- getLogWriter().info("bucket version vector is now " + bucket.getVersionVector().fullToString());
+ LogWriterUtils.getLogWriter().info("bucket version vector is now " + bucket.getVersionVector().fullToString());
assertTrue("bucket should hold entry Object3 now", bucket.containsKey("Object3"));
return true;
}
@@ -227,17 +232,17 @@ public class PRBucketSynchronizationDUnitTest extends CacheTestCase {
public Object call() throws Exception {
PartitionedRegion pr = (PartitionedRegion)TestRegion;
final BucketRegion bucket = pr.getDataStore().getLocalBucketById(0);
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
String waitingFor = "primary is still in membership view: " + crashedMember;
boolean dumped = false;
public boolean done() {
if (TestRegion.getCache().getDistributionManager().isCurrentMember(crashedMember)) {
- getLogWriter().info(waitingFor);
+ LogWriterUtils.getLogWriter().info(waitingFor);
return false;
}
if (!TestRegion.containsKey("Object3")) {
waitingFor = "entry for Object3 not found";
- getLogWriter().info(waitingFor);
+ LogWriterUtils.getLogWriter().info(waitingFor);
return false;
}
RegionEntry re = bucket.getRegionMap().getEntry("Object5");
@@ -247,7 +252,7 @@ public class PRBucketSynchronizationDUnitTest extends CacheTestCase {
bucket.dumpBackingMap();
}
waitingFor = "entry for Object5 not found";
- getLogWriter().info(waitingFor);
+ LogWriterUtils.getLogWriter().info(waitingFor);
return false;
}
if (!re.isTombstone()) {
@@ -256,7 +261,7 @@ public class PRBucketSynchronizationDUnitTest extends CacheTestCase {
bucket.dumpBackingMap();
}
waitingFor = "Object5 is not a tombstone but should be: " + re;
- getLogWriter().info(waitingFor);
+ LogWriterUtils.getLogWriter().info(waitingFor);
return false;
}
return true;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionDUnitTest.java
index 234203f..0408eb7 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionDUnitTest.java
@@ -41,6 +41,7 @@ import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
import com.gemstone.gemfire.internal.cache.PartitionedRegionException;
import com.gemstone.gemfire.internal.logging.InternalLogWriter;
import com.gemstone.gemfire.internal.logging.PureLogWriter;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
@@ -187,7 +188,7 @@ public class PartitionedRegionDUnitTest extends MultiVMRegionTestCase {
fact.addCacheListener(new CacheListenerAdapter(){
@Override
public void afterInvalidate(EntryEvent event) {
- getLogWriter().info("afterInvalidate invoked with " + event);
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("afterInvalidate invoked with " + event);
InvalidateInvoked = true;
}
});
@@ -227,7 +228,7 @@ public class PartitionedRegionDUnitTest extends MultiVMRegionTestCase {
createRegion(name, "INCOMPATIBLE_ROOT", getRegionAttributes());
} catch (CacheException ex) {
- fail("While creating Partitioned region", ex);
+ Assert.fail("While creating Partitioned region", ex);
}
}
});
@@ -245,7 +246,7 @@ public class PartitionedRegionDUnitTest extends MultiVMRegionTestCase {
}
} catch (CacheException ex) {
- fail("While creating Partitioned Region", ex);
+ Assert.fail("While creating Partitioned Region", ex);
}
}
});
@@ -259,7 +260,7 @@ public class PartitionedRegionDUnitTest extends MultiVMRegionTestCase {
try {
createRegion(regionName, "root", getRegionAttributes());
} catch (CacheException ex) {
- fail("While creating Partitioned region", ex);
+ Assert.fail("While creating Partitioned region", ex);
}
}
};
@@ -293,7 +294,7 @@ public class PartitionedRegionDUnitTest extends MultiVMRegionTestCase {
}
}
catch (Exception ex) {
- fail("while creating or populating partitioned region", ex);
+ Assert.fail("while creating or populating partitioned region", ex);
}
finally {
if (region != null) {
@@ -360,7 +361,7 @@ public class PartitionedRegionDUnitTest extends MultiVMRegionTestCase {
}
catch (Exception ex2) {
}
- fail("Unexpected exception", ex);
+ Assert.fail("Unexpected exception", ex);
}
}
});
@@ -496,7 +497,7 @@ public class PartitionedRegionDUnitTest extends MultiVMRegionTestCase {
try {
createRegion(regionName, "root", getRegionAttributes());
} catch (CacheException ex) {
- fail("While creating Partitioned region", ex);
+ Assert.fail("While creating Partitioned region", ex);
}
}
};
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionOffHeapDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionOffHeapDUnitTest.java
index 455cefc..efd42ad 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionOffHeapDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionOffHeapDUnitTest.java
@@ -22,6 +22,7 @@ import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.RegionAttributes;
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;
/**
@@ -37,7 +38,7 @@ public class PartitionedRegionOffHeapDUnitTest extends PartitionedRegionDUnitTes
}
@Override
- public void tearDown2() throws Exception {
+ protected final void preTearDownCacheTestCase() throws Exception {
SerializableRunnable checkOrphans = new SerializableRunnable() {
@Override
@@ -47,12 +48,8 @@ public class PartitionedRegionOffHeapDUnitTest extends PartitionedRegionDUnitTes
}
}
};
- invokeInEveryVM(checkOrphans);
- try {
- checkOrphans.run();
- } finally {
- super.tearDown2();
- }
+ Invoke.invokeInEveryVM(checkOrphans);
+ checkOrphans.run();
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PreloadedRegionTestCase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PreloadedRegionTestCase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PreloadedRegionTestCase.java
index 97bae11..86dfcc7 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PreloadedRegionTestCase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PreloadedRegionTestCase.java
@@ -22,6 +22,7 @@ import com.gemstone.gemfire.cache.DataPolicy;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.Scope;
+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;
@@ -62,7 +63,7 @@ public class PreloadedRegionTestCase extends MultiVMRegionTestCase {
getSystem().getLogWriter().info("testDistributedCreate: Created Region");
}
catch (CacheException e) {
- fail("While creating region", e);
+ Assert.fail("While creating region", e);
}
}
};
@@ -76,7 +77,7 @@ public class PreloadedRegionTestCase extends MultiVMRegionTestCase {
getSystem().getLogWriter().info("testDistributedCReate: Created Key");
}
catch (CacheException e) {
- fail("While creating region", e);
+ Assert.fail("While creating region", e);
}
}
};
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkRemoteVMDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkRemoteVMDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkRemoteVMDUnitTest.java
index ac818f3..caa8333 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkRemoteVMDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkRemoteVMDUnitTest.java
@@ -42,7 +42,10 @@ import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
*
@@ -81,15 +84,16 @@ public class PutAllCallBkRemoteVMDUnitTest extends DistributedTestCase {
VM vm1 = host.getVM(1);
vm0.invoke(PutAllCallBkRemoteVMDUnitTest.class, "createCacheForVM0");
vm1.invoke(PutAllCallBkRemoteVMDUnitTest.class, "createCacheForVM1");
- getLogWriter().info("Cache created successfully");
+ LogWriterUtils.getLogWriter().info("Cache created successfully");
}
- public void tearDown2(){
- Host host = Host.getHost(0);
- VM vm0 = host.getVM(0);
- VM vm1 = host.getVM(1);
- vm0.invoke(PutAllCallBkRemoteVMDUnitTest.class, "closeCache");
- vm1.invoke(PutAllCallBkRemoteVMDUnitTest.class, "closeCache");
+ @Override
+ protected final void preTearDown() throws Exception {
+ Host host = Host.getHost(0);
+ VM vm0 = host.getVM(0);
+ VM vm1 = host.getVM(1);
+ vm0.invoke(PutAllCallBkRemoteVMDUnitTest.class, "closeCache");
+ vm1.invoke(PutAllCallBkRemoteVMDUnitTest.class, "closeCache");
}
public static synchronized void createCacheForVM0(){
@@ -167,7 +171,7 @@ public class PutAllCallBkRemoteVMDUnitTest extends DistributedTestCase {
}catch (Exception ex){
throw new RuntimeException("exception putting entries", ex);
}
- getLogWriter().info("****************paperRegion.get(afterCreate)***************"+paperRegion.get("afterCreate"));
+ LogWriterUtils.getLogWriter().info("****************paperRegion.get(afterCreate)***************"+paperRegion.get("afterCreate"));
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
@@ -184,7 +188,7 @@ public class PutAllCallBkRemoteVMDUnitTest extends DistributedTestCase {
return "Waiting for event";
}
};
- DistributedTestCase.waitForCriterion(ev, 3000, 200, true);
+ Wait.waitForCriterion(ev, 3000, 200, true);
}
});
@@ -337,9 +341,9 @@ public class PutAllCallBkRemoteVMDUnitTest extends DistributedTestCase {
if(counter==null) counter = new Integer(1);
paperRegion.put("afterCreate",new Integer(counter.intValue()+1));
- getLogWriter().info("In afterCreate"+putAllcounter);
+ LogWriterUtils.getLogWriter().info("In afterCreate"+putAllcounter);
if(putAllcounter == forCreate){
- getLogWriter().info("performingtrue");
+ LogWriterUtils.getLogWriter().info("performingtrue");
afterCreate = true;
}
try{
@@ -350,7 +354,7 @@ public class PutAllCallBkRemoteVMDUnitTest extends DistributedTestCase {
}
notified = true;
- getLogWriter().info("*******afterCreate***** Key :"+event.getKey()+ " Value :"+event.getNewValue());
+ LogWriterUtils.getLogWriter().info("*******afterCreate***** Key :"+event.getKey()+ " Value :"+event.getNewValue());
}
public void afterUpdate(EntryEvent event){
@@ -358,9 +362,9 @@ public class PutAllCallBkRemoteVMDUnitTest extends DistributedTestCase {
Integer counter = (Integer)paperRegion.get("afterUpdate");
if(counter==null) counter = new Integer(1);
paperRegion.put("afterUpdate",new Integer(counter.intValue()+1));
- getLogWriter().info("In afterUpdate"+afterUpdateputAllcounter);
+ LogWriterUtils.getLogWriter().info("In afterUpdate"+afterUpdateputAllcounter);
if(afterUpdateputAllcounter == forUpdate){
- getLogWriter().info("performingtrue afterUpdate");
+ LogWriterUtils.getLogWriter().info("performingtrue afterUpdate");
afterUpdate = true;
}
try{
@@ -373,7 +377,7 @@ public class PutAllCallBkRemoteVMDUnitTest extends DistributedTestCase {
notified = true;
- getLogWriter().info("*******afterUpdate***** Key :"+event.getKey()+ " Value :"+event.getNewValue());
+ LogWriterUtils.getLogWriter().info("*******afterUpdate***** Key :"+event.getKey()+ " Value :"+event.getNewValue());
}
}
@@ -383,15 +387,15 @@ public class PutAllCallBkRemoteVMDUnitTest extends DistributedTestCase {
Integer counter = (Integer)paperRegion.get("beforeCreate");
if(counter==null) counter = new Integer(1);
paperRegion.put("beforeCreate",new Integer(counter.intValue()+1));
- getLogWriter().info("*******BeforeCreate***** event="+event);
+ LogWriterUtils.getLogWriter().info("*******BeforeCreate***** event="+event);
}
public void beforeUpdate(EntryEvent event) {
Integer counter = (Integer)paperRegion.get("beforeUpdate");
if(counter==null) counter = new Integer(1);
paperRegion.put("beforeUpdate",new Integer(counter.intValue()+1));
- getLogWriter().info("In beforeUpdate"+beforeUpdateputAllcounter);
- getLogWriter().info("*******BeforeUpdate***** event="+event);
+ LogWriterUtils.getLogWriter().info("In beforeUpdate"+beforeUpdateputAllcounter);
+ LogWriterUtils.getLogWriter().info("*******BeforeUpdate***** event="+event);
}
}
}// end of test class