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:26:58 UTC
[34/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/internal/cache/EvictionStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionStatsDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionStatsDUnitTest.java
index 189d0d2..a31e1e7 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionStatsDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionStatsDUnitTest.java
@@ -40,7 +40,9 @@ import com.gemstone.gemfire.internal.cache.control.InternalResourceManager;
import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.ResourceType;
import com.gemstone.gemfire.internal.cache.lru.HeapEvictor;
import com.gemstone.gemfire.internal.cache.lru.HeapLRUCapacityController;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
@@ -325,14 +327,14 @@ public class EvictionStatsDUnitTest extends CacheTestCase {
@Override
public void run2() throws CacheException {
PartitionedRegion pr1 = (PartitionedRegion)cache.getRegion("PR1");
- getLogWriter().info("dddd local"+pr1.getLocalMaxMemory());
- getLogWriter().info("dddd local evi"+((AbstractLRURegionMap)pr1.entries)._getLruList().stats()
+ LogWriterUtils.getLogWriter().info("dddd local"+pr1.getLocalMaxMemory());
+ LogWriterUtils.getLogWriter().info("dddd local evi"+((AbstractLRURegionMap)pr1.entries)._getLruList().stats()
.getEvictions());
- getLogWriter().info("dddd local entries"+((AbstractLRURegionMap)pr1.entries)._getLruList().stats()
+ LogWriterUtils.getLogWriter().info("dddd local entries"+((AbstractLRURegionMap)pr1.entries)._getLruList().stats()
.getCounter()/(1024*1024));
HeapMemoryMonitor hmm = ((InternalResourceManager) cache.getResourceManager()).getHeapMonitor();
long memused=hmm.getBytesUsed()/(1024*1024);
- getLogWriter().info("dddd local memused= "+memused);
+ LogWriterUtils.getLogWriter().info("dddd local memused= "+memused);
assertTrue(((AbstractLRURegionMap)pr1.entries)._getLruList().stats()
.getEvictions() >= extraEntries / 2);
assertEquals(((AbstractLRURegionMap)pr1.entries)._getLruList().stats()
@@ -410,12 +412,12 @@ public class EvictionStatsDUnitTest extends CacheTestCase {
ds = getSystem(props);
cache = CacheFactory.create(ds);
assertNotNull(cache);
- getLogWriter().info("cache= " + cache);
- getLogWriter().info("cache closed= " + cache.isClosed());
+ LogWriterUtils.getLogWriter().info("cache= " + cache);
+ LogWriterUtils.getLogWriter().info("cache closed= " + cache.isClosed());
cache.getResourceManager().setEvictionHeapPercentage(20);
}
catch (Exception e) {
- fail("Failed while creating the cache", e);
+ Assert.fail("Failed while creating the cache", e);
}
}
@@ -482,7 +484,7 @@ public class EvictionStatsDUnitTest extends CacheTestCase {
region = cache.createRegion(regionName, factory.create());
assertNotNull(region);
- getLogWriter().info("Partitioned Region created Successfully :" + region);
+ LogWriterUtils.getLogWriter().info("Partitioned Region created Successfully :" + region);
}
public static void putData(final String regionName, final int noOfElememts) {
@@ -541,7 +543,7 @@ public class EvictionStatsDUnitTest extends CacheTestCase {
if (bucketRegion == null) {
continue;
}
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Size of bucket " + bucketRegion.getName() + "of Pr " + prRegionName
+ " = " + bucketRegion.getCounter() / (1000000));
bucketSize = bucketSize + bucketRegion.getCounter();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionTestBase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionTestBase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionTestBase.java
index cbd2f65..6726747 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionTestBase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionTestBase.java
@@ -44,11 +44,14 @@ import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.Resou
import com.gemstone.gemfire.internal.cache.control.MemoryEvent;
import com.gemstone.gemfire.internal.cache.control.MemoryThresholds.MemoryState;
import com.gemstone.gemfire.internal.cache.lru.HeapEvictor;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.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;
public class EvictionTestBase extends CacheTestCase {
@@ -85,18 +88,6 @@ public class EvictionTestBase extends CacheTestCase {
dataStore4 = host.getVM(3);
}
- public void tearDown2() throws Exception {
- super.tearDown2();
- /*
- * dataStore1.invoke(EvictionTestBase.class, "destroyObjects", new Object[] {
- * setEvictionOn, evictionAlgorithm, regionName, totalNoOfBuckets,
- * evictionAction, evictorInterval });
- * dataStore2.invoke(EvictionTestBase.class, "createPartitionedRegion", new
- * Object[] { setEvictionOn, evictionAlgorithm, regionName,
- * totalNoOfBuckets, evictionAction, evictorInterval });
- */
- }
-
public void prepareScenario1(EvictionAlgorithm evictionAlgorithm,int maxEntries) {
createCacheInAllVms();
createPartitionedRegionInAllVMS(true, evictionAlgorithm, "PR1",
@@ -138,7 +129,7 @@ public class EvictionTestBase extends CacheTestCase {
.getEvictions();
}
};
- DistributedTestCase.waitForCriterion(wc, 60000, 1000, true);
+ Wait.waitForCriterion(wc, 60000, 1000, true);
}
});
}
@@ -290,14 +281,14 @@ public class EvictionTestBase extends CacheTestCase {
ds = getSystem(props);
cache = CacheFactory.create(ds);
assertNotNull(cache);
- getLogWriter().info("cache= " + cache);
- getLogWriter().info("cache closed= " + cache.isClosed());
+ LogWriterUtils.getLogWriter().info("cache= " + cache);
+ LogWriterUtils.getLogWriter().info("cache closed= " + cache.isClosed());
cache.getResourceManager().setEvictionHeapPercentage(85);
- getLogWriter().info("eviction= "+cache.getResourceManager().getEvictionHeapPercentage());
- getLogWriter().info("critical= "+cache.getResourceManager().getCriticalHeapPercentage());
+ LogWriterUtils.getLogWriter().info("eviction= "+cache.getResourceManager().getEvictionHeapPercentage());
+ LogWriterUtils.getLogWriter().info("critical= "+cache.getResourceManager().getCriticalHeapPercentage());
}
catch (Exception e) {
- fail("Failed while creating the cache", e);
+ Assert.fail("Failed while creating the cache", e);
}
}
@@ -375,7 +366,7 @@ public class EvictionTestBase extends CacheTestCase {
region = cache.createRegion(regionName, factory.create());
assertNotNull(region);
- getLogWriter().info("Partitioned Region created Successfully :" + region);
+ LogWriterUtils.getLogWriter().info("Partitioned Region created Successfully :" + region);
}
public static void putData(final String regionName, final int noOfElememts,
@@ -399,7 +390,7 @@ public class EvictionTestBase extends CacheTestCase {
final Region pr = cache.getRegion("DR1");
for (int counter = 1; counter <= noOfElememts; counter++) {
pr.put(new Integer(counter), new byte[sizeOfElement * 1024 * 1024]);
- getLogWriter().info("Amar put data element no->" + counter);
+ LogWriterUtils.getLogWriter().info("Amar put data element no->" + counter);
}
}
});
@@ -422,7 +413,7 @@ public class EvictionTestBase extends CacheTestCase {
if (bucketRegion == null) {
continue;
}
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"FINAL bucket= " + bucketRegion.getFullPath() + "size= "
+ bucketRegion.size());
}
@@ -437,7 +428,7 @@ public class EvictionTestBase extends CacheTestCase {
};
long evictionsInVM1 = (Long)dataStore1.invoke(validate);
long evictionsInVM2 = (Long)dataStore2.invoke(validate);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"EEE evicitons = " + noOfEvictions + " "
+ (evictionsInVM1 + evictionsInVM2));
assertEquals(noOfEvictions, (evictionsInVM1 + evictionsInVM2));
@@ -488,7 +479,7 @@ public class EvictionTestBase extends CacheTestCase {
while(itr.hasNext())
{
BucketRegion br=(BucketRegion)itr.next();
- getLogWriter().info("Print "+ br.size());
+ LogWriterUtils.getLogWriter().info("Print "+ br.size());
}
}
});
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/FixedPRSinglehopDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/FixedPRSinglehopDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/FixedPRSinglehopDUnitTest.java
index 6a96948..86376d9 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/FixedPRSinglehopDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/FixedPRSinglehopDUnitTest.java
@@ -40,10 +40,13 @@ import com.gemstone.gemfire.internal.cache.partitioned.fixed.QuarterPartitionRes
import com.gemstone.gemfire.internal.cache.partitioned.fixed.SingleHopQuarterPartitionResolver;
import com.gemstone.gemfire.internal.cache.partitioned.fixed.FixedPartitioningTestBase.Q1_Months;
import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerTestUtil;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
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 java.io.DataInput;
import java.io.DataOutput;
@@ -281,7 +284,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
VM server4 = host.getVM(3);
Boolean simpleFPR = false;
final int portLocator = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
- final String hostLocator = getServerHostName(server1.getHost());
+ final String hostLocator = NetworkUtils.getServerHostName(server1.getHost());
final String locator = hostLocator + "[" + portLocator + "]";
server3.invoke(FixedPRSinglehopDUnitTest.class,
"startLocatorInVM", new Object[] { portLocator });
@@ -308,7 +311,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
putIntoPartitionedRegionsThreeQs();
getFromPartitionedRegionsFor3Qs();
- pause(2000);
+ Wait.pause(2000);
// TODO: Verify that all the fpa's are in the map
server1.invoke(FixedPRSinglehopDUnitTest.class, "printView");
server2.invoke(FixedPRSinglehopDUnitTest.class, "printView");
@@ -331,13 +334,13 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
FixedPRSinglehopDUnitTest.class, "createServerWithLocator", new Object[] { locator, false,
fpaList, simpleFPR });
- pause(2000);
+ Wait.pause(2000);
putIntoPartitionedRegions();
// Client should get the new partition
// TODO: Verify that
getFromPartitionedRegions();
- pause(2000);
+ Wait.pause(2000);
server1.invoke(FixedPRSinglehopDUnitTest.class, "printView");
server2.invoke(FixedPRSinglehopDUnitTest.class, "printView");
server4.invoke(FixedPRSinglehopDUnitTest.class, "printView");
@@ -367,7 +370,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
server.start();
}
catch (IOException e) {
- fail("Failed to start server ", e);
+ Assert.fail("Failed to start server ", e);
}
if (!fpaList.isEmpty() || isAccessor) {
@@ -385,7 +388,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
attr.setPartitionAttributes(paf.create());
region = cache.createRegion(PR_NAME, attr.create());
assertNotNull(region);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Partitioned Region " + PR_NAME + " created Successfully :"
+ region.toString());
}
@@ -412,7 +415,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
server.start();
}
catch (IOException e) {
- fail("Failed to start server ", e);
+ Assert.fail("Failed to start server ", e);
}
if (!fpaList.isEmpty() || isAccessor) {
@@ -431,7 +434,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
attr.setPartitionAttributes(paf.create());
region = cache.createRegion(PR_NAME, attr.create());
assertNotNull(region);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Partitioned Region " + PR_NAME + " created Successfully :"
+ region.toString());
}
@@ -485,7 +488,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
attr.setPartitionAttributes(paf.create());
region = cache.createRegion(PR_NAME, attr.create());
assertNotNull(region);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Partitioned Region " + PR_NAME + " created Successfully :"
+ region.toString());
@@ -602,7 +605,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
RegionAttributes attrs = factory.create();
region = cache.createRegion(PR_NAME, attrs);
assertNotNull(region);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Distributed Region " + PR_NAME + " created Successfully :"
+ region.toString());
}
@@ -859,7 +862,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
return "expected no metadata to be refreshed";
}
};
- DistributedTestCase.waitForCriterion(wc, 60000, 1000, true);
+ Wait.waitForCriterion(wc, 60000, 1000, true);
assertTrue(regionMetaData.containsKey(region.getFullPath()));
final ClientPartitionAdvisor prMetaData = regionMetaData
@@ -873,7 +876,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
return "expected no metadata to be refreshed";
}
};
- DistributedTestCase.waitForCriterion(wc, 60000, 1000, true);
+ Wait.waitForCriterion(wc, 60000, 1000, true);
for (Entry entry : prMetaData.getBucketServerLocationsMap_TEST_ONLY()
.entrySet()) {
assertEquals(currentRedundancy, ((List)entry.getValue()).size());
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/GIIDeltaDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/GIIDeltaDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/GIIDeltaDUnitTest.java
index 9f318fb..1e714f1 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/GIIDeltaDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/GIIDeltaDUnitTest.java
@@ -55,12 +55,17 @@ import com.gemstone.gemfire.internal.cache.persistence.DiskStoreID;
import com.gemstone.gemfire.internal.cache.versions.RegionVersionVector;
import com.gemstone.gemfire.internal.cache.versions.VersionTag;
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.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
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;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
@@ -83,7 +88,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
// protected static String REGION_NAME = GIIDeltaDUnitTest.class.getSimpleName()+"_Region";
protected static String REGION_NAME = "_Region";
final String expectedExceptions = GemFireIOException.class.getName();
- protected ExpectedException expectedEx;
+ protected IgnoredException expectedEx;
static Object giiSyncObject = new Object();
/**
@@ -95,7 +100,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
public void setUp() throws Exception {
super.setUp();
- invokeInEveryVM(GIIDeltaDUnitTest.class,"setRegionName", new Object[]{getUniqueName()});
+ Invoke.invokeInEveryVM(GIIDeltaDUnitTest.class,"setRegionName", new Object[]{getUniqueName()});
setRegionName(getUniqueName());
}
@@ -103,7 +108,8 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
REGION_NAME = testName + "_Region";
}
- public void tearDown2() throws Exception {
+ @Override
+ protected final void preTearDownCacheTestCase() throws Exception {
P.invoke(GIIDeltaDUnitTest.class, "resetSlowGII");
R.invoke(GIIDeltaDUnitTest.class, "resetSlowGII");
P.invoke(InitialImageOperation.class, "resetAllGIITestHooks");
@@ -113,8 +119,10 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
changeForceFullGII(P, false, false);
P = null;
R = null;
- super.tearDown2();
-
+ }
+
+ @Override
+ protected final void postTearDownCacheTestCase() throws Exception {
// clean up the test hook, which can be moved to CacheTestCase
DistributedCacheOperation.SLOW_DISTRIBUTION_MS = 0;
if (expectedEx != null) {
@@ -152,7 +160,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
createDistributedRegion(vm1);
assignVMsToPandR(vm0, vm1);
// from now on, use P and R as vmhttps://wiki.gemstone.com/display/gfepersistence/DeltaGII+Spec+for+8.0
- expectedEx = addExpectedException(expectedExceptions);
+ expectedEx = IgnoredException.addIgnoredException(expectedExceptions);
}
// these steps are shared by all test cases
@@ -516,7 +524,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
// force tombstone GC to let RVVGC to become P4:R0
changeTombstoneTimout(R, MAX_WAIT);
changeTombstoneTimout(P, MAX_WAIT);
- pause((int)MAX_WAIT);
+ Wait.pause((int)MAX_WAIT);
forceGC(P, 2);
waitForToVerifyRVV(P, memberP, 6, null, 4); // P's rvv=p6, gc=4
@@ -1244,7 +1252,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
}
};
- DistributedTestCase.waitForCriterion(ev, 30000, 200, true);
+ Wait.waitForCriterion(ev, 30000, 200, true);
int count = getDeltaGIICount(P);
assertEquals(2, count);
@@ -1253,7 +1261,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
changeTombstoneTimout(R, MAX_WAIT);
changeTombstoneTimout(P, MAX_WAIT);
changeTombstoneTimout(T, MAX_WAIT);
- pause((int)MAX_WAIT);
+ Wait.pause((int)MAX_WAIT);
forceGC(P, 2);
waitForToVerifyRVV(P, memberP, 7, null, 0); // P's rvv=p7, gc=0
@@ -1270,7 +1278,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev2, 30000, 200, true);
+ Wait.waitForCriterion(ev2, 30000, 200, true);
count = getDeltaGIICount(P);
assertEquals(0, count);
verifyTombstoneExist(P, "key2", true, true); // expect key2 is still tombstone during and after GIIs
@@ -1372,7 +1380,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
}
};
- DistributedTestCase.waitForCriterion(ev, 30000, 200, true);
+ Wait.waitForCriterion(ev, 30000, 200, true);
int count = getDeltaGIICount(P);
assertEquals(1, count);
@@ -1380,7 +1388,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
// Wait for tombstone is GCed at R, but still exists in P
changeTombstoneTimout(R, MAX_WAIT);
changeTombstoneTimout(P, MAX_WAIT);
- pause((int)MAX_WAIT);
+ Wait.pause((int)MAX_WAIT);
forceGC(R, 3);
forceGC(P, 3);
@@ -1432,7 +1440,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
forceAddGIICount(P);
changeTombstoneTimout(R, MAX_WAIT);
changeTombstoneTimout(P, MAX_WAIT);
- pause((int)MAX_WAIT);
+ Wait.pause((int)MAX_WAIT);
forceGC(R, 3);
waitForToVerifyRVV(P, memberR, 6, null, 0); // P's rvv=r6, gc=0
waitForToVerifyRVV(P, memberR, 6, null, 0); // P's rvv=r6, gc=0
@@ -2003,7 +2011,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
try {
future.join(MAX_WAIT);
} catch (InterruptedException e) {
- fail("Create region is interrupted", e);
+ Assert.fail("Create region is interrupted", e);
}
if(future.isAlive()) {
fail("Region not created within" + MAX_WAIT);
@@ -2022,10 +2030,10 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
RegionFactory f = getCache().createRegionFactory(getRegionAttributes());
// CCRegion = (LocalRegion)f.create(REGION_NAME);
LocalRegion lr = (LocalRegion)f.create(REGION_NAME);
- getLogWriter().info("In createDistributedRegion, using hydra.getLogWriter()");
- getLogWriter().fine("Unfinished Op limit="+InitialImageOperation.MAXIMUM_UNFINISHED_OPERATIONS);
+ LogWriterUtils.getLogWriter().info("In createDistributedRegion, using hydra.getLogWriter()");
+ LogWriterUtils.getLogWriter().fine("Unfinished Op limit="+InitialImageOperation.MAXIMUM_UNFINISHED_OPERATIONS);
} catch (CacheException ex) {
- fail("While creating region", ex);
+ Assert.fail("While creating region", ex);
}
}
};
@@ -2091,9 +2099,9 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
protected void removeSystemPropertiesInVM(VM vm, final String prop) {
SerializableRunnable change = new SerializableRunnable() {
public void run() {
- getLogWriter().info("Current prop setting: "+prop+"="+System.getProperty(prop));
+ LogWriterUtils.getLogWriter().info("Current prop setting: "+prop+"="+System.getProperty(prop));
System.getProperties().remove(prop);
- getLogWriter().info(prop+"="+System.getProperty(prop));
+ LogWriterUtils.getLogWriter().info(prop+"="+System.getProperty(prop));
}
};
vm.invoke(change);
@@ -2126,7 +2134,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
DiskStoreID dsid0 = getMemberID(vm0);
DiskStoreID dsid1 = getMemberID(vm1);
int compare = dsid0.compareTo(dsid1);
- getLogWriter().info("Before assignVMsToPandR, dsid0 is "+dsid0+",dsid1 is "+dsid1+",compare="+compare);
+ LogWriterUtils.getLogWriter().info("Before assignVMsToPandR, dsid0 is "+dsid0+",dsid1 is "+dsid1+",compare="+compare);
if (compare > 0) {
P = vm0;
R = vm1;
@@ -2134,7 +2142,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
P = vm1;
R = vm0;
}
- getLogWriter().info("After assignVMsToPandR, P is "+P.getPid()+"; R is "+R.getPid()+" for region "+REGION_NAME);
+ LogWriterUtils.getLogWriter().info("After assignVMsToPandR, P is "+P.getPid()+"; R is "+R.getPid()+" for region "+REGION_NAME);
}
private DiskStoreID getMemberID(VM vm) {
@@ -2188,7 +2196,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
for (long i:exceptionList) {
exceptionListVerified = !rvv.contains(member, i);
if (!exceptionListVerified) {
- getLogWriter().finer("DeltaGII:missing exception "+i+":"+rvv);
+ LogWriterUtils.getLogWriter().finer("DeltaGII:missing exception "+i+":"+rvv);
break;
}
}
@@ -2197,7 +2205,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
for (long i = 1; i<=regionversion; i++) {
if (!rvv.contains(member, i)) {
exceptionListVerified = false;
- getLogWriter().finer("DeltaGII:unexpected exception "+i);
+ LogWriterUtils.getLogWriter().finer("DeltaGII:unexpected exception "+i);
break;
}
}
@@ -2213,8 +2221,8 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
long gcversion = getRegionVersionForMember(rvv, member, true);
boolean exceptionListVerified = verifyExceptionList(member, regionversion, rvv, exceptionList);
- getLogWriter().info("DeltaGII:expected:"+expectedRegionVersion+":"+expectedGCVersion);
- getLogWriter().info("DeltaGII:actual:"+regionversion+":"+gcversion+":"+exceptionListVerified+":"+rvv);
+ LogWriterUtils.getLogWriter().info("DeltaGII:expected:"+expectedRegionVersion+":"+expectedGCVersion);
+ LogWriterUtils.getLogWriter().info("DeltaGII:actual:"+regionversion+":"+gcversion+":"+exceptionListVerified+":"+rvv);
boolean match = true;
if (expectedRegionVersion != -1) {
@@ -2233,7 +2241,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
}
};
- DistributedTestCase.waitForCriterion(ev, 10 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 10 * 1000, 200, true);
RegionVersionVector rvv = ((LocalRegion)getCache().getRegion(REGION_NAME)).getVersionVector().getCloneForTransmission();
long regionversion = getRegionVersionForMember(rvv, member, false);
long gcversion = getRegionVersionForMember(rvv, member, true);
@@ -2265,7 +2273,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
}
};
- DistributedTestCase.waitForCriterion(ev, 30000, 200, true);
+ Wait.waitForCriterion(ev, 30000, 200, true);
if (callback == null || !callback.isRunning) {
fail("GII tesk hook is not started yet");
}
@@ -2303,7 +2311,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
}
};
- DistributedTestCase.waitForCriterion(ev, 10 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 10 * 1000, 200, true);
String value = (String)((LocalRegion)getCache().getRegion(REGION_NAME)).get(key);
assertEquals(expect_value, value);
}
@@ -2367,9 +2375,9 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
try {
remote_rvv = DataSerializer.readObject(new DataInputStream(bais));
} catch (IOException e) {
- fail("Unexpected exception", e);
+ Assert.fail("Unexpected exception", e);
} catch (ClassNotFoundException e) {
- fail("Unexpected exception", e);
+ Assert.fail("Unexpected exception", e);
}
RequestImageMessage rim = new RequestImageMessage();
rim.setSender(R_ID);
@@ -2499,7 +2507,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
}
};
- DistributedTestCase.waitForCriterion(ev, 10 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 10 * 1000, 200, true);
assertTrue(doneVerify());
}
};
@@ -2521,10 +2529,10 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
try {
async.join(30000);
if (async.exceptionOccurred()) {
- fail("Test failed", async.getException());
+ Assert.fail("Test failed", async.getException());
}
} catch (InterruptedException e1) {
- fail("Test failed", e1);
+ Assert.fail("Test failed", e1);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/GIIFlowControlDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/GIIFlowControlDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/GIIFlowControlDUnitTest.java
index d478b8b..e2d4af6 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/GIIFlowControlDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/GIIFlowControlDUnitTest.java
@@ -30,10 +30,15 @@ import com.gemstone.gemfire.distributed.internal.DistributionManager;
import com.gemstone.gemfire.distributed.internal.DistributionMessage;
import com.gemstone.gemfire.distributed.internal.DistributionMessageObserver;
import com.gemstone.gemfire.internal.cache.InitialImageOperation.ImageReplyMessage;
+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.Invoke;
import com.gemstone.gemfire.test.dunit.Host;
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
@@ -54,21 +59,20 @@ public class GIIFlowControlDUnitTest extends CacheTestCase {
}
@Override
- public void tearDown2() throws Exception {
- invokeInEveryVM(new SerializableRunnable("reset chunk size") {
+ protected final void preTearDownCacheTestCase() throws Exception {
+ Invoke.invokeInEveryVM(new SerializableRunnable("reset chunk size") {
public void run() {
InitialImageOperation.CHUNK_SIZE_IN_BYTES = origChunkSize;
InitialImageOperation.CHUNK_PERMITS = origNumChunks;
}
});
- super.tearDown2();
}
public void testLotsOfChunks() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
- invokeInEveryVM(new SerializableRunnable("reset chunk size") {
+ Invoke.invokeInEveryVM(new SerializableRunnable("reset chunk size") {
public void run() {
InitialImageOperation.CHUNK_SIZE_IN_BYTES = 10;
InitialImageOperation.CHUNK_PERMITS = 2;
@@ -89,7 +93,7 @@ public class GIIFlowControlDUnitTest extends CacheTestCase {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
- invokeInEveryVM(new SerializableRunnable("set chunk size") {
+ Invoke.invokeInEveryVM(new SerializableRunnable("set chunk size") {
public void run() {
InitialImageOperation.CHUNK_SIZE_IN_BYTES = 10;
InitialImageOperation.CHUNK_PERMITS = 2;
@@ -118,7 +122,7 @@ public class GIIFlowControlDUnitTest extends CacheTestCase {
vm1.invoke(new SerializableRunnable("Wait for chunks") {
public void run() {
- waitForCriterion(new WaitCriterion(){
+ Wait.waitForCriterion(new WaitCriterion(){
public String description() {
return "Waiting for messages to be at least 2: " + observer.messageCount.get();
@@ -134,7 +138,7 @@ public class GIIFlowControlDUnitTest extends CacheTestCase {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
- fail("interrupted", e);
+ Assert.fail("interrupted", e);
}
assertEquals(2, observer.messageCount.get());
observer.allowMessages.countDown();
@@ -158,7 +162,7 @@ public class GIIFlowControlDUnitTest extends CacheTestCase {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
- invokeInEveryVM(new SerializableRunnable("set chunk size") {
+ Invoke.invokeInEveryVM(new SerializableRunnable("set chunk size") {
public void run() {
InitialImageOperation.CHUNK_SIZE_IN_BYTES = 10;
InitialImageOperation.CHUNK_PERMITS = 2;
@@ -185,7 +189,7 @@ public class GIIFlowControlDUnitTest extends CacheTestCase {
vm1.invoke(new SerializableRunnable("Wait to flow control messages") {
public void run() {
- waitForCriterion(new WaitCriterion(){
+ Wait.waitForCriterion(new WaitCriterion(){
public String description() {
return "Waiting for messages to be at least 2: " + observer.messageCount.get();
@@ -201,7 +205,7 @@ public class GIIFlowControlDUnitTest extends CacheTestCase {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
- fail("interrupted", e);
+ Assert.fail("interrupted", e);
}
assertEquals(2, observer.messageCount.get());
}
@@ -237,7 +241,7 @@ public class GIIFlowControlDUnitTest extends CacheTestCase {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
- invokeInEveryVM(new SerializableRunnable("set chunk size") {
+ Invoke.invokeInEveryVM(new SerializableRunnable("set chunk size") {
public void run() {
InitialImageOperation.CHUNK_SIZE_IN_BYTES = 10;
InitialImageOperation.CHUNK_PERMITS = 2;
@@ -257,7 +261,7 @@ public class GIIFlowControlDUnitTest extends CacheTestCase {
}
});
- ExpectedException expectedEx = null;
+ IgnoredException expectedEx = null;
try {
createRegion(vm0);
@@ -268,7 +272,7 @@ public class GIIFlowControlDUnitTest extends CacheTestCase {
vm1.invoke(new SerializableRunnable("Wait to flow control messages") {
public void run() {
- waitForCriterion(new WaitCriterion(){
+ Wait.waitForCriterion(new WaitCriterion(){
public String description() {
return "Waiting for messages to be at least 2: " + observer.messageCount.get();
@@ -284,7 +288,7 @@ public class GIIFlowControlDUnitTest extends CacheTestCase {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
- fail("interrupted", e);
+ Assert.fail("interrupted", e);
}
assertEquals(2, observer.messageCount.get());
}
@@ -306,7 +310,7 @@ public class GIIFlowControlDUnitTest extends CacheTestCase {
throw e;
}
- expectedEx = addExpectedException(InterruptedException.class.getName(),
+ expectedEx = IgnoredException.addIgnoredException(InterruptedException.class.getName(),
vm1);
if(disconnect) {
disconnect(vm1);
@@ -325,7 +329,7 @@ public class GIIFlowControlDUnitTest extends CacheTestCase {
public void run() {
final DMStats stats = getSystem().getDMStats();
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
public boolean done() {
return stats.getInitialImageMessagesInFlight() == 0;
@@ -437,7 +441,7 @@ public class GIIFlowControlDUnitTest extends CacheTestCase {
try {
allowMessages.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/GridAdvisorDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/GridAdvisorDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/GridAdvisorDUnitTest.java
index 9a6b3e4..f12333f 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/GridAdvisorDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/GridAdvisorDUnitTest.java
@@ -33,8 +33,11 @@ import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.distributed.internal.InternalLocator;
import com.gemstone.gemfire.internal.AvailablePort.Keeper;
import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
@@ -78,14 +81,14 @@ public class GridAdvisorDUnitTest extends DistributedTestCase {
final Keeper bsKeeper4 = freeTCPPorts.get(5);
final int bsPort4 = bsKeeper4.getPort();
- final String host0 = getServerHostName(host);
+ final String host0 = NetworkUtils.getServerHostName(host);
final String locators = host0 + "[" + port1 + "]" + ","
+ host0 + "[" + port2 + "]";
final Properties dsProps = new Properties();
dsProps.setProperty("locators", locators);
dsProps.setProperty("mcast-port", "0");
- dsProps.setProperty("log-level", getDUnitLogLevel());
+ dsProps.setProperty("log-level", LogWriterUtils.getDUnitLogLevel());
dsProps.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
keeper1.release();
@@ -96,7 +99,7 @@ public class GridAdvisorDUnitTest extends DistributedTestCase {
try {
Locator.startLocatorAndDS(port1, logFile, null, dsProps, true, true, null);
} catch (IOException ex) {
- fail("While starting locator on port " + port1, ex);
+ Assert.fail("While starting locator on port " + port1, ex);
}
}
});
@@ -112,7 +115,7 @@ public class GridAdvisorDUnitTest extends DistributedTestCase {
Locator.startLocatorAndDS(port2, logFile, null, dsProps, true, true, "locator2HNFC");
} catch (IOException ex) {
- fail("While starting locator on port " + port2, ex);
+ Assert.fail("While starting locator on port " + port2, ex);
}
}
});
@@ -123,7 +126,7 @@ public class GridAdvisorDUnitTest extends DistributedTestCase {
Properties props = new Properties();
props.setProperty("mcast-port", "0");
props.setProperty("locators", locators);
- dsProps.setProperty("log-level", getDUnitLogLevel());
+ dsProps.setProperty("log-level", LogWriterUtils.getDUnitLogLevel());
CacheFactory.create(DistributedSystem.connect(props));
}
};
@@ -283,7 +286,7 @@ public class GridAdvisorDUnitTest extends DistributedTestCase {
DistributionAdvisee advisee = (DistributionAdvisee)bslist.get(i);
CacheServerAdvisor bsa = (CacheServerAdvisor)advisee.getDistributionAdvisor();
List others = bsa.fetchBridgeServers();
- getLogWriter().info("found these bridgeservers in " + advisee + ": " + others);
+ LogWriterUtils.getLogWriter().info("found these bridgeservers in " + advisee + ": " + others);
assertEquals(3, others.size());
others = bsa.fetchControllers();
assertEquals(2, others.size());
@@ -311,7 +314,7 @@ public class GridAdvisorDUnitTest extends DistributedTestCase {
DistributionAdvisee advisee = (DistributionAdvisee)bslist.get(i);
CacheServerAdvisor bsa = (CacheServerAdvisor)advisee.getDistributionAdvisor();
List others = bsa.fetchBridgeServers();
- getLogWriter().info("found these bridgeservers in " + advisee + ": " + others);
+ LogWriterUtils.getLogWriter().info("found these bridgeservers in " + advisee + ": " + others);
assertEquals(3, others.size());
others = bsa.fetchControllers();
assertEquals(2, others.size());
@@ -587,14 +590,14 @@ public class GridAdvisorDUnitTest extends DistributedTestCase {
final Keeper bsKeeper4 = freeTCPPorts.get(5);
final int bsPort4 = bsKeeper4.getPort();
- final String host0 = getServerHostName(host);
+ final String host0 = NetworkUtils.getServerHostName(host);
final String locators = host0 + "[" + port1 + "]" + ","
+ host0 + "[" + port2 + "]";
final Properties dsProps = new Properties();
dsProps.setProperty("locators", locators);
dsProps.setProperty("mcast-port", "0");
- dsProps.setProperty("log-level", getDUnitLogLevel());
+ dsProps.setProperty("log-level", LogWriterUtils.getDUnitLogLevel());
dsProps.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
keeper1.release();
@@ -605,7 +608,7 @@ public class GridAdvisorDUnitTest extends DistributedTestCase {
try {
Locator.startLocatorAndDS(port1, logFile, null, dsProps, true, true, null);
} catch (IOException ex) {
- fail("While starting locator on port " + port1, ex);
+ Assert.fail("While starting locator on port " + port1, ex);
}
}
});
@@ -621,7 +624,7 @@ public class GridAdvisorDUnitTest extends DistributedTestCase {
Locator.startLocatorAndDS(port2, logFile, null, dsProps, true, true, "locator2HNFC");
} catch (IOException ex) {
- fail("While starting locator on port " + port2, ex);
+ Assert.fail("While starting locator on port " + port2, ex);
}
}
});
@@ -632,7 +635,7 @@ public class GridAdvisorDUnitTest extends DistributedTestCase {
props.setProperty("mcast-port", "0");
props.setProperty("locators", locators);
props.setProperty("groups", "bs1Group1, bs1Group2");
- props.setProperty("log-level", getDUnitLogLevel());
+ props.setProperty("log-level", LogWriterUtils.getDUnitLogLevel());
CacheFactory.create(DistributedSystem.connect(props));
}
});
@@ -642,7 +645,7 @@ public class GridAdvisorDUnitTest extends DistributedTestCase {
props.setProperty("mcast-port", "0");
props.setProperty("locators", locators);
props.setProperty("groups", "bs2Group1, bs2Group2");
- props.setProperty("log-level", getDUnitLogLevel());
+ props.setProperty("log-level", LogWriterUtils.getDUnitLogLevel());
CacheFactory.create(DistributedSystem.connect(props));
}
});
@@ -797,7 +800,7 @@ public class GridAdvisorDUnitTest extends DistributedTestCase {
DistributionAdvisee advisee = (DistributionAdvisee)bslist.get(i);
CacheServerAdvisor bsa = (CacheServerAdvisor)advisee.getDistributionAdvisor();
List others = bsa.fetchBridgeServers();
- getLogWriter().info("found these bridgeservers in " + advisee + ": " + others);
+ LogWriterUtils.getLogWriter().info("found these bridgeservers in " + advisee + ": " + others);
assertEquals(3, others.size());
others = bsa.fetchControllers();
assertEquals(2, others.size());
@@ -825,7 +828,7 @@ public class GridAdvisorDUnitTest extends DistributedTestCase {
DistributionAdvisee advisee = (DistributionAdvisee)bslist.get(i);
CacheServerAdvisor bsa = (CacheServerAdvisor)advisee.getDistributionAdvisor();
List others = bsa.fetchBridgeServers();
- getLogWriter().info("found these bridgeservers in " + advisee + ": " + others);
+ LogWriterUtils.getLogWriter().info("found these bridgeservers in " + advisee + ": " + others);
assertEquals(3, others.size());
others = bsa.fetchControllers();
assertEquals(2, others.size());
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/HABug36773DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/HABug36773DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/HABug36773DUnitTest.java
index 1396aba..a590aef 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/HABug36773DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/HABug36773DUnitTest.java
@@ -38,8 +38,11 @@ import com.gemstone.gemfire.cache30.ClientServerTestCase;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
import com.gemstone.gemfire.test.dunit.VM;
/**
@@ -156,7 +159,7 @@ public class HABug36773DUnitTest extends DistributedTestCase
public void testDummyForBug36773()
{
- getLogWriter().info(" This is the dummy test for the Bug 36773");
+ LogWriterUtils.getLogWriter().info(" This is the dummy test for the Bug 36773");
}
@@ -171,7 +174,7 @@ public class HABug36773DUnitTest extends DistributedTestCase
{
Region region = cache.getRegion(Region.SEPARATOR + REGION_NAME);
assertNotNull(region);
- getLogWriter().info("Size of the region " + region.size());
+ LogWriterUtils.getLogWriter().info("Size of the region " + region.size());
assertEquals(size, region.size());
}
};
@@ -234,7 +237,7 @@ public class HABug36773DUnitTest extends DistributedTestCase
Thread.sleep(700);
}
catch (InterruptedException ie) {
- fail("Interrupted while waiting ", ie);
+ Assert.fail("Interrupted while waiting ", ie);
}
}
}
@@ -260,7 +263,7 @@ public class HABug36773DUnitTest extends DistributedTestCase
assertEquals(r1.getEntry(KEY2).getValue(), "key-2");
}
catch (Exception ex) {
- fail("failed while createEntriesK1andK2()", ex);
+ Assert.fail("failed while createEntriesK1andK2()", ex);
}
}
@@ -280,7 +283,7 @@ public class HABug36773DUnitTest extends DistributedTestCase
new HABug36773DUnitTest("temp").createCache(props);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
- ClientServerTestCase.configureConnectionPool(factory, DistributedTestCase.getIPLiteral(), new int[] {PORT1,PORT2}, true, -1, 2, null);
+ ClientServerTestCase.configureConnectionPool(factory, NetworkUtils.getIPLiteral(), new int[] {PORT1,PORT2}, true, -1, 2, null);
RegionAttributes attrs = factory.create();
cache.createRegion(REGION_NAME, attrs);
}
@@ -316,7 +319,7 @@ public class HABug36773DUnitTest extends DistributedTestCase
}
catch (Exception ex) {
- fail("failed while registering interest", ex);
+ Assert.fail("failed while registering interest", ex);
}
}
@@ -354,16 +357,14 @@ public class HABug36773DUnitTest extends DistributedTestCase
}
- public void tearDown2() throws Exception
- {
+ @Override
+ protected final void preTearDown() throws Exception {
//close client
client1.invoke(HABug36773DUnitTest.class, "closeCache");
client2.invoke(HABug36773DUnitTest.class, "closeCache");
//close server
server1.invoke(HABug36773DUnitTest.class, "closeCache");
server2.invoke(HABug36773DUnitTest.class, "closeCache");
-
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/HAOverflowMemObjectSizerDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/HAOverflowMemObjectSizerDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/HAOverflowMemObjectSizerDUnitTest.java
index 4539321..371d8f9 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/HAOverflowMemObjectSizerDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/HAOverflowMemObjectSizerDUnitTest.java
@@ -40,6 +40,7 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.ClientUpdateMessageImpl;
import com.gemstone.gemfire.internal.cache.tier.sockets.ConflationDUnitTest;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
import com.gemstone.gemfire.test.dunit.VM;
/**
@@ -93,8 +94,8 @@ public class HAOverflowMemObjectSizerDUnitTest extends DistributedTestCase {
serverVM = host.getVM(3);
}
- public void tearDown2() throws Exception {
- super.tearDown2();
+ @Override
+ protected final void preTearDown() throws Exception {
serverVM.invoke(ConflationDUnitTest.class, "unsetIsSlowStart");
client.invoke(HAOverflowMemObjectSizerDUnitTest.class, "closeCache");
serverVM.invoke(HAOverflowMemObjectSizerDUnitTest.class, "closeCache");
@@ -190,7 +191,7 @@ public class HAOverflowMemObjectSizerDUnitTest extends DistributedTestCase {
client.invoke(HAOverflowMemObjectSizerDUnitTest.class,
"createCacheClient",
new Object[] { port1,
- getServerHostName(client.getHost()) });
+ NetworkUtils.getServerHostName(client.getHost()) });
serverVM.invoke(HAOverflowMemObjectSizerDUnitTest.class, "performPut",
new Object[] { new Long(0L), new Long(100L) });
@@ -216,7 +217,7 @@ public class HAOverflowMemObjectSizerDUnitTest extends DistributedTestCase {
client.invoke(HAOverflowMemObjectSizerDUnitTest.class,
"createCacheClient",
new Object[] { port2,
- getServerHostName(client.getHost()) });
+ NetworkUtils.getServerHostName(client.getHost()) });
serverVM.invoke(HAOverflowMemObjectSizerDUnitTest.class, "performPut",
new Object[] { new Long(101L), new Long(200L) });
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/IncrementalBackupDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/IncrementalBackupDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/IncrementalBackupDUnitTest.java
index 0d1f0b4..c8f0933 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/IncrementalBackupDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/IncrementalBackupDUnitTest.java
@@ -50,11 +50,13 @@ import com.gemstone.gemfire.internal.JarDeployer;
import com.gemstone.gemfire.internal.cache.persistence.BackupManager;
import com.gemstone.gemfire.internal.util.IOUtils;
import com.gemstone.gemfire.internal.util.TransformUtils;
-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.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 for the incremental backup feature.
@@ -88,7 +90,7 @@ public class IncrementalBackupDUnitTest extends CacheTestCase {
private final SerializableRunnable createRegions = new SerializableRunnable() {
@Override
public void run() {
- Cache cache = getCache(new CacheFactory().set("log-level", getDUnitLogLevel()));
+ Cache cache = getCache(new CacheFactory().set("log-level", LogWriterUtils.getDUnitLogLevel()));
cache.createDiskStoreFactory().setDiskDirs(getDiskDirs()).create("fooStore");
cache.createDiskStoreFactory().setDiskDirs(getDiskDirs()).create("barStore");
getRegionFactory(cache).setDiskStoreName("fooStore").create("fooRegion");
@@ -125,7 +127,7 @@ public class IncrementalBackupDUnitTest extends CacheTestCase {
* @param message a message to log.
*/
private void log(String message) {
- getLogWriter().info("[IncrementalBackupDUnitTest] " + message);
+ LogWriterUtils.getLogWriter().info("[IncrementalBackupDUnitTest] " + message);
}
/**
@@ -365,7 +367,7 @@ public class IncrementalBackupDUnitTest extends CacheTestCase {
});
final Set<PersistentID> missingMembers = new HashSet<PersistentID>();
- DistributedTestCase.waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
@Override
public boolean done() {
missingMembers.clear();
@@ -666,12 +668,10 @@ public class IncrementalBackupDUnitTest extends CacheTestCase {
* Removes backup directories (and all backup data).
*/
@Override
- public void tearDown2() throws Exception {
+ protected final void preTearDownCacheTestCase() throws Exception {
FileUtil.delete(getIncremental2Dir());
FileUtil.delete(getIncrementalDir());
FileUtil.delete(getBaselineDir());
-
- super.tearDown2();
}
/**
@@ -837,7 +837,7 @@ public class IncrementalBackupDUnitTest extends CacheTestCase {
* member is back online.
*/
final Set<PersistentID> missingMembers = new HashSet<PersistentID>();
- DistributedTestCase.waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
@Override
public boolean done() {
missingMembers.clear();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptClientServerDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptClientServerDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptClientServerDUnitTest.java
index 03d9edd..fdf2a5b 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptClientServerDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptClientServerDUnitTest.java
@@ -34,6 +34,8 @@ import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.cache.UpdateOperation.UpdateMessage;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.VM;
@@ -54,8 +56,8 @@ public class InterruptClientServerDUnitTest extends CacheTestCase {
@Override
- public void tearDown2() throws Exception {
- invokeInEveryVM(new SerializableCallable() {
+ protected final void preTearDownCacheTestCase() throws Exception {
+ Invoke.invokeInEveryVM(new SerializableCallable() {
@Override
public Object call() throws Exception {
@@ -63,7 +65,6 @@ public class InterruptClientServerDUnitTest extends CacheTestCase {
return null;
}
});
- super.tearDown2();
}
public void _testLoop() throws Throwable {
@@ -83,7 +84,7 @@ public class InterruptClientServerDUnitTest extends CacheTestCase {
* @throws Throwable
*/
public void testClientPutWithInterrupt() throws Throwable {
- addExpectedException("InterruptedException");
+ IgnoredException.addIgnoredException("InterruptedException");
Host host = Host.getHost(0);
final VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptsDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptsDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptsDUnitTest.java
index 416dff9..6a0ffba 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptsDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptsDUnitTest.java
@@ -30,6 +30,7 @@ import com.gemstone.gemfire.distributed.internal.DistributionMessageObserver;
import com.gemstone.gemfire.internal.cache.UpdateOperation.UpdateMessage;
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.SerializableCallable;
import com.gemstone.gemfire.test.dunit.VM;
@@ -50,8 +51,8 @@ public class InterruptsDUnitTest extends CacheTestCase {
@Override
- public void tearDown2() throws Exception {
- invokeInEveryVM(new SerializableCallable() {
+ protected final void preTearDownCacheTestCase() throws Exception {
+ Invoke.invokeInEveryVM(new SerializableCallable() {
@Override
public Object call() throws Exception {
@@ -59,7 +60,6 @@ public class InterruptsDUnitTest extends CacheTestCase {
return null;
}
});
- super.tearDown2();
}
public void _testLoop() throws Throwable {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/MapClearGIIDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/MapClearGIIDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/MapClearGIIDUnitTest.java
index 3910c3c..3aeceec 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/MapClearGIIDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/MapClearGIIDUnitTest.java
@@ -32,11 +32,15 @@ import com.gemstone.gemfire.cache.RegionEvent;
import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
import com.gemstone.gemfire.cache30.CacheTestCase;
+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.LogWriterUtils;
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.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
* @author ashahid
@@ -138,7 +142,7 @@ public class MapClearGIIDUnitTest extends CacheTestCase {
region = new MapClearGIIDUnitTest("dumb object to get cache").getCache().createRegion("map", attr);
// region = region.createSubregion("map",attr);
- getLogWriter().info("Region in VM0 created ");
+ LogWriterUtils.getLogWriter().info("Region in VM0 created ");
}
/*
public static void closeCache() {
@@ -166,7 +170,7 @@ public class MapClearGIIDUnitTest extends CacheTestCase {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 10 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 10 * 1000, 200, true);
region.clear();
assertEquals(0, region.size());
}
@@ -214,7 +218,7 @@ public class MapClearGIIDUnitTest extends CacheTestCase {
}
}
});
- getLogWriter().info("Cache created in VM1 successfully");
+ LogWriterUtils.getLogWriter().info("Cache created in VM1 successfully");
try {
AsyncInvocation asyncGII = vm0.invokeAsync(MapClearGIIDUnitTest.class,
"createRegionInVm0");
@@ -230,28 +234,28 @@ public class MapClearGIIDUnitTest extends CacheTestCase {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 30 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 30 * 1000, 200, true);
}
});
// now that the gii has received some entries do the clear
vm1.invoke(MapClearGIIDUnitTest.class, "clearRegionInVm1");
// wait for GII to complete
- DistributedTestCase.join(asyncGII, 30 * 1000, getLogWriter());
+ ThreadUtils.join(asyncGII, 30 * 1000);
if (asyncGII.exceptionOccurred()) {
Throwable t = asyncGII.getException();
- fail("createRegionInVM0 failed", t);
+ Assert.fail("createRegionInVM0 failed", t);
}
assertTrue(vm0
.invokeBoolean(MapClearGIIDUnitTest.class, "checkImageStateFlag"));
if (asyncGII.exceptionOccurred()) {
- fail("asyncGII failed", asyncGII.getException());
+ Assert.fail("asyncGII failed", asyncGII.getException());
}
}
catch (Exception e) {
- fail("Test failed", e);
+ Assert.fail("Test failed", e);
}
finally {
vm0.invoke(new SerializableRunnable("Set fast image processing") {
@@ -267,13 +271,13 @@ public class MapClearGIIDUnitTest extends CacheTestCase {
public static class CacheObserverImpl extends CacheObserverAdapter {
public void afterRegionClear(RegionEvent event) {
- getLogWriter().info("**********Received clear event in VM0 . ");
+ LogWriterUtils.getLogWriter().info("**********Received clear event in VM0 . ");
Region rgn = event.getRegion();
wasGIIInProgressDuringClear = ((LocalRegion) rgn).getImageState()
.wasRegionClearedDuringGII();
InitialImageOperation.slowImageProcessing = 0;
InitialImageOperation.slowImageSleeps = 0;
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"wasGIIInProgressDuringClear when clear event was received= "
+ wasGIIInProgressDuringClear);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/MapInterface2JUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/MapInterface2JUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/MapInterface2JUnitTest.java
index 91fea15..0129ec6 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/MapInterface2JUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/MapInterface2JUnitTest.java
@@ -41,7 +41,7 @@ import com.gemstone.gemfire.cache.query.CacheUtils;
import com.gemstone.gemfire.cache.query.data.Portfolio;
import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
import com.gemstone.gemfire.internal.util.StopWatch;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
/**
@@ -221,7 +221,7 @@ public class MapInterface2JUnitTest {
callbackSync.notify();
}
}
- DistributedTestCase.join(th, 30 * 1000, null);
+ ThreadUtils.join(th, 30 * 1000);
}
@@ -274,7 +274,7 @@ public class MapInterface2JUnitTest {
}catch (Exception cwe) {
fail("The test experienced exception "+cwe);
}
- DistributedTestCase.join(th, 30 * 1000, null);
+ ThreadUtils.join(th, 30 * 1000);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/NetSearchMessagingDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/NetSearchMessagingDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/NetSearchMessagingDUnitTest.java
index b1375a8..f49a4c6 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/NetSearchMessagingDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/NetSearchMessagingDUnitTest.java
@@ -36,9 +36,12 @@ import com.gemstone.gemfire.distributed.internal.DistributionMessageObserver;
import com.gemstone.gemfire.internal.cache.SearchLoadAndWriteProcessor.NetSearchRequestMessage;
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.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
@@ -193,7 +196,7 @@ public class NetSearchMessagingDUnitTest extends CacheTestCase {
LocalRegion region = (LocalRegion)cache.getRegion("region");
RegionEntry re = region.getRegionEntry("a");
Object o = re.getValueInVM(null);
- getLogWriter().info("key a="+o);;
+ LogWriterUtils.getLogWriter().info("key a="+o);;
return o == null || o == Token.NOT_AVAILABLE;
}
};
@@ -215,7 +218,7 @@ public class NetSearchMessagingDUnitTest extends CacheTestCase {
for (String key: keys) {
RegionEntry re = region.getRegionEntry(key);
Object o = re.getValueInVM(null);
- getLogWriter().info("key " + key + "=" + o);
+ LogWriterUtils.getLogWriter().info("key " + key + "=" + o);
assertTrue("expected key " + key + " to not be evicted",
(o != null) && (o != Token.NOT_AVAILABLE));
}
@@ -333,9 +336,9 @@ public class NetSearchMessagingDUnitTest extends CacheTestCase {
public Object call() {
Cache cache = getCache();
Region region = cache.getRegion("region");
- getLogWriter().info("putting key="+key+"="+value);
+ LogWriterUtils.getLogWriter().info("putting key="+key+"="+value);
Object result = region.put(key, value);
- getLogWriter().info("done putting key="+key);
+ LogWriterUtils.getLogWriter().info("done putting key="+key);
return result;
}
});
@@ -353,7 +356,7 @@ public class NetSearchMessagingDUnitTest extends CacheTestCase {
}
private void waitForReceivedMessages(final VM vm, final long expected) {
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
@Override
public boolean done() {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionDUnitTest.java
index 4482533..708b983 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionDUnitTest.java
@@ -25,9 +25,13 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.ResourceType;
import com.gemstone.gemfire.internal.cache.lru.HeapEvictor;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.Assert;
+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;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
* Performs eviction dunit tests for off-heap memory.
@@ -39,7 +43,7 @@ public class OffHeapEvictionDUnitTest extends EvictionDUnitTest {
}
@Override
- public void tearDown2() throws Exception {
+ protected final void preTearDownCacheTestCase() throws Exception {
SerializableRunnable checkOrphans = new SerializableRunnable() {
@Override
@@ -49,12 +53,8 @@ public class OffHeapEvictionDUnitTest extends EvictionDUnitTest {
}
}
};
- invokeInEveryVM(checkOrphans);
- try {
- checkOrphans.run();
- } finally {
- super.tearDown2();
- }
+ Invoke.invokeInEveryVM(checkOrphans);
+ checkOrphans.run();
}
@Override
@@ -74,15 +74,15 @@ public class OffHeapEvictionDUnitTest extends EvictionDUnitTest {
ds = getSystem(getDistributedSystemProperties());
cache = CacheFactory.create(ds);
assertNotNull(cache);
- getLogWriter().info("cache= " + cache);
- getLogWriter().info("cache closed= " + cache.isClosed());
+ LogWriterUtils.getLogWriter().info("cache= " + cache);
+ LogWriterUtils.getLogWriter().info("cache closed= " + cache.isClosed());
cache.getResourceManager().setEvictionOffHeapPercentage(85);
((GemFireCacheImpl) cache).getResourceManager().getOffHeapMonitor().stopMonitoring(true);
- getLogWriter().info("eviction= "+cache.getResourceManager().getEvictionOffHeapPercentage());
- getLogWriter().info("critical= "+cache.getResourceManager().getCriticalOffHeapPercentage());
+ LogWriterUtils.getLogWriter().info("eviction= "+cache.getResourceManager().getEvictionOffHeapPercentage());
+ LogWriterUtils.getLogWriter().info("critical= "+cache.getResourceManager().getCriticalOffHeapPercentage());
}
catch (Exception e) {
- fail("Failed while creating the cache", e);
+ Assert.fail("Failed while creating the cache", e);
}
}
@@ -115,7 +115,7 @@ public class OffHeapEvictionDUnitTest extends EvictionDUnitTest {
.getEvictions();
}
};
- DistributedTestCase.waitForCriterion(wc, 60000, 1000, true);
+ Wait.waitForCriterion(wc, 60000, 1000, true);
}
});
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionStatsDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionStatsDUnitTest.java
index a2d0555..f574e99 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionStatsDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionStatsDUnitTest.java
@@ -21,6 +21,9 @@ import java.util.Properties;
import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
/**
@@ -36,7 +39,7 @@ public class OffHeapEvictionStatsDUnitTest extends EvictionStatsDUnitTest {
}
@Override
- public void tearDown2() throws Exception {
+ protected final void preTearDownCacheTestCase() throws Exception {
SerializableRunnable checkOrphans = new SerializableRunnable() {
@Override
@@ -46,12 +49,8 @@ public class OffHeapEvictionStatsDUnitTest extends EvictionStatsDUnitTest {
}
}
};
- invokeInEveryVM(checkOrphans);
- try {
- checkOrphans.run();
- } finally {
- super.tearDown2();
- }
+ Invoke.invokeInEveryVM(checkOrphans);
+ checkOrphans.run();
}
@Override
@@ -71,14 +70,14 @@ public class OffHeapEvictionStatsDUnitTest extends EvictionStatsDUnitTest {
ds = getSystem(getDistributedSystemProperties());
cache = CacheFactory.create(ds);
assertNotNull(cache);
- getLogWriter().info("cache= " + cache);
- getLogWriter().info("cache closed= " + cache.isClosed());
+ LogWriterUtils.getLogWriter().info("cache= " + cache);
+ LogWriterUtils.getLogWriter().info("cache closed= " + cache.isClosed());
cache.getResourceManager().setEvictionOffHeapPercentage(20);
- getLogWriter().info("eviction= "+cache.getResourceManager().getEvictionOffHeapPercentage());
- getLogWriter().info("critical= "+cache.getResourceManager().getCriticalOffHeapPercentage());
+ LogWriterUtils.getLogWriter().info("eviction= "+cache.getResourceManager().getEvictionOffHeapPercentage());
+ LogWriterUtils.getLogWriter().info("critical= "+cache.getResourceManager().getCriticalOffHeapPercentage());
}
catch (Exception e) {
- fail("Failed while creating the cache", e);
+ Assert.fail("Failed while creating the cache", e);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapTestUtil.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapTestUtil.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapTestUtil.java
index 948c7f8..cbf3bf6 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapTestUtil.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapTestUtil.java
@@ -30,7 +30,7 @@ import com.gemstone.gemfire.internal.offheap.SimpleMemoryAllocatorImpl;
@SuppressWarnings("deprecation")
public class OffHeapTestUtil {
- public static void checkOrphans() {
+ public static void checkOrphans() { // TODO:KIRK: need to do something special to guarantee proper tearDown
SimpleMemoryAllocatorImpl allocator = null;
try {
allocator = SimpleMemoryAllocatorImpl.getAllocator();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java
index 9daf69f..1d9213e 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java
@@ -57,8 +57,9 @@ import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
import com.gemstone.gemfire.internal.InternalDataSerializer;
import com.gemstone.gemfire.internal.cache.Oplog.OPLOG_TYPE;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
import com.jayway.awaitility.Awaitility;
@@ -1677,7 +1678,7 @@ public class OplogJUnitTest extends DiskRegionTestingBase
});
assertNull(conflated);
th.start();
- DistributedTestCase.join(th, 30 * 1000, null);
+ ThreadUtils.join(th, 30 * 1000);
LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER = false;
}
@@ -2093,7 +2094,7 @@ public class OplogJUnitTest extends DiskRegionTestingBase
finally {
((LocalRegion)region).getDiskRegion().releaseWriteLock();
}
- DistributedTestCase.join(th, 30 * 1000, null);
+ ThreadUtils.join(th, 30 * 1000);
region.close();
region = DiskRegionHelperFactory.getSyncPersistOnlyRegion(cache,
diskProps, Scope.LOCAL);
@@ -2710,16 +2711,16 @@ public class OplogJUnitTest extends DiskRegionTestingBase
assertEquals(0, dss.getQueueSize());
put100Int();
- DistributedTestCase.waitForCriterion(evFull, 2 * 1000, 200, true);
+ Wait.waitForCriterion(evFull, 2 * 1000, 200, true);
assertEquals(0, dss.getFlushes());
region.writeToDisk();
- DistributedTestCase.waitForCriterion(ev, 2 * 1000, 200, true);
- DistributedTestCase.waitForCriterion(ev2, 1000, 200, true);
+ Wait.waitForCriterion(ev, 2 * 1000, 200, true);
+ Wait.waitForCriterion(ev2, 1000, 200, true);
put100Int();
- DistributedTestCase.waitForCriterion(evFull, 2 * 1000, 200, true);
+ Wait.waitForCriterion(evFull, 2 * 1000, 200, true);
region.writeToDisk();
- DistributedTestCase.waitForCriterion(ev, 2 * 1000, 200, true);
- DistributedTestCase.waitForCriterion(ev3, 1000, 200, true);
+ Wait.waitForCriterion(ev, 2 * 1000, 200, true);
+ Wait.waitForCriterion(ev3, 1000, 200, true);
closeDown();
}
@@ -3169,7 +3170,7 @@ public class OplogJUnitTest extends DiskRegionTestingBase
}
});
try {
- DistributedTestCase.join(clearOp, 30 * 1000, null);
+ ThreadUtils.join(clearOp, 30 * 1000);
}
catch (Exception e) {
testFailed = true;
@@ -3236,7 +3237,7 @@ public class OplogJUnitTest extends DiskRegionTestingBase
});
clearTh.start();
try {
- DistributedTestCase.join(clearTh, 120 * 1000, null);
+ ThreadUtils.join(clearTh, 120 * 1000);
failure = clearTh.isAlive();
failureCause = "Clear Thread still running !";
} catch(Exception e) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/P2PDeltaPropagationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/P2PDeltaPropagationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/P2PDeltaPropagationDUnitTest.java
index 508347d..3f814d4 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/P2PDeltaPropagationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/P2PDeltaPropagationDUnitTest.java
@@ -510,14 +510,12 @@ public class P2PDeltaPropagationDUnitTest extends DistributedTestCase
}
}
- public void tearDown2() throws Exception
- {
- super.tearDown2();
+ @Override
+ protected final void preTearDown() throws Exception {
closeCache();
server1.invoke(P2PDeltaPropagationDUnitTest.class, "closeCache");
server2.invoke(P2PDeltaPropagationDUnitTest.class, "closeCache");
server3.invoke(P2PDeltaPropagationDUnitTest.class, "closeCache");
-
}
public static void closeCache()
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PRBadToDataDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PRBadToDataDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PRBadToDataDUnitTest.java
index f1e7988..8249d2b 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PRBadToDataDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PRBadToDataDUnitTest.java
@@ -24,6 +24,7 @@ import com.gemstone.gemfire.cache.CacheException;
import com.gemstone.gemfire.cache.PartitionAttributesFactory;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
import com.gemstone.gemfire.cache30.CacheTestCase;
+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;
@@ -76,7 +77,7 @@ public class PRBadToDataDUnitTest extends CacheTestCase {
assertNotNull(pr);
}
catch (final 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/internal/cache/PartitionedRegionAPIDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionAPIDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionAPIDUnitTest.java
index bb34cc1..466dfa4 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionAPIDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionAPIDUnitTest.java
@@ -47,6 +47,7 @@ import com.gemstone.gemfire.distributed.internal.ReplyException;
import com.gemstone.gemfire.internal.cache.PartitionedRegion;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
@@ -171,7 +172,7 @@ public class PartitionedRegionAPIDUnitTest extends
RegionAttributes regionAttribs = attr.create();
cache.createRegion("PR1",
regionAttribs);
- getLogWriter().info("Region created in VM1.");
+ LogWriterUtils.getLogWriter().info("Region created in VM1.");
}
};
@@ -191,12 +192,12 @@ public class PartitionedRegionAPIDUnitTest extends
for (int b = 0; b < numBucks; b++) {
if (par.getBucketKeys(b).contains(key)) {
foundIt = true;
- getLogWriter().severe("Key " + key + " found in bucket " + b);
+ LogWriterUtils.getLogWriter().severe("Key " + key + " found in bucket " + b);
break;
}
}
if (!foundIt) {
- getLogWriter().severe("Key " + key + " not found in any bucket");
+ LogWriterUtils.getLogWriter().severe("Key " + key + " not found in any bucket");
}
return foundIt;
}
@@ -347,8 +348,8 @@ public class PartitionedRegionAPIDUnitTest extends
"<ExpectedException action=remove>"
+ entryNotFoundException
+ "</ExpectedException>");
- getLogWriter().fine("Out of doPutOperations1");
- getLogWriter().fine("All the puts done successfully for vm0.");
+ LogWriterUtils.getLogWriter().fine("Out of doPutOperations1");
+ LogWriterUtils.getLogWriter().fine("All the puts done successfully for vm0.");
}
});
@@ -506,8 +507,8 @@ public class PartitionedRegionAPIDUnitTest extends
+ entryNotFoundException
+ "</ExpectedException>");
- getLogWriter().fine("Out of doPutOperations2");
- getLogWriter().fine("All the puts done successfully for vm1.");
+ LogWriterUtils.getLogWriter().fine("Out of doPutOperations2");
+ LogWriterUtils.getLogWriter().fine("All the puts done successfully for vm1.");
}
});
}
@@ -654,7 +655,7 @@ public class PartitionedRegionAPIDUnitTest extends
size = pr.size();
assertEquals("Size doesnt return expected value", size, 10);
// }
- getLogWriter().fine(
+ LogWriterUtils.getLogWriter().fine(
"All the puts done successfully for vm0.");
@@ -795,7 +796,7 @@ public class PartitionedRegionAPIDUnitTest extends
"<ExpectedException action=remove>"
+ entryNotFoundException
+ "</ExpectedException>");
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.fine("All the remove done successfully for vm0.");
}
});
@@ -1018,7 +1019,7 @@ public class PartitionedRegionAPIDUnitTest extends
assertTrue("containsKey() Validation failed for key = "
+ i, conKey);
}
- getLogWriter().fine(
+ LogWriterUtils.getLogWriter().fine(
"containsKey() Validated entry for key = " + i);
}
@@ -1036,7 +1037,7 @@ public class PartitionedRegionAPIDUnitTest extends
"containsValueForKey() Validation failed for key = "
+ i, conKey);
}
- getLogWriter().fine(
+ LogWriterUtils.getLogWriter().fine(
"containsValueForKey() Validated entry for key = "
+ i);
}