http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionCCEDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionCCEDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionCCEDUnitTest.java index 0ba2e27..a29a569 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionCCEDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionCCEDUnitTest.java @@ -66,7 +66,9 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase; 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.VM; +import com.gemstone.gemfire.test.dunit.Wait; +import com.gemstone.gemfire.test.dunit.WaitCriterion; /** * @author Bruce Schuchardt @@ -252,7 +254,7 @@ public class DistributedAckRegionCCEDUnitTest extends DistributedAckRegionDUnitT "fake_id", "fake_id_ustring", DistributionManager.NORMAL_DM_TYPE, null, null); tag.setMemberID(mbr); } catch (UnknownHostException e) { - fail("could not create member id", e); + com.gemstone.gemfire.test.dunit.Assert.fail("could not create member id", e); } // generate an event to distribute that contains the fake version tag @@ -269,7 +271,7 @@ public class DistributedAckRegionCCEDUnitTest extends DistributedAckRegionDUnitT try { partialCreate.getResult(); } catch (Throwable e) { - fail("async invocation in vm2 failed", e); + com.gemstone.gemfire.test.dunit.Assert.fail("async invocation in vm2 failed", e); } } @@ -322,7 +324,7 @@ public class DistributedAckRegionCCEDUnitTest extends DistributedAckRegionDUnitT CCRegion.put("cckey0", "ccvalue"); CCRegion.put("cckey0", "ccvalue"); // version number will end up at 4 } catch (CacheException ex) { - fail("While creating region", ex); + com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", ex); } } }; @@ -342,7 +344,7 @@ public class DistributedAckRegionCCEDUnitTest extends DistributedAckRegionDUnitT try { entry.makeTombstone(CCRegion, tag); } catch (RegionClearedException e) { - fail("region was mysteriously cleared during unit testing", e); + com.gemstone.gemfire.test.dunit.Assert.fail("region was mysteriously cleared during unit testing", e); } } }); @@ -401,12 +403,12 @@ public class DistributedAckRegionCCEDUnitTest extends DistributedAckRegionDUnitT return "waiting for GC to occur"; } }; - waitForCriterion(waitForGC, 20000, 1000, true); - pause(5000); + Wait.waitForCriterion(waitForGC, 20000, 1000, true); + Wait.pause(5000); long gcCount = CCRegion.getCachePerfStats().getTombstoneGCCount(); assertTrue("expected a few GCs, but not " + (gcCount - initialCount), gcCount < (initialCount + 20)); } catch (CacheException ex) { - fail("While creating region", ex); + com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", ex); } finally { TombstoneService.EXPIRED_TOMBSTONE_LIMIT = saveExpiredTombstoneLimit; TombstoneService.FORCE_GC_MEMORY_EVENTS = false; @@ -460,7 +462,7 @@ public class DistributedAckRegionCCEDUnitTest extends DistributedAckRegionDUnitT } assertEquals("expected no conflated events", 0, CCRegion.getCachePerfStats().getConflatedEventsCount()); } catch (CacheException ex) { - fail("While creating region", ex); + com.gemstone.gemfire.test.dunit.Assert.fail("While creating region", ex); } } };
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionCCEOffHeapDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionCCEOffHeapDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionCCEOffHeapDUnitTest.java index 4b7e49d..1c1cbaf 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionCCEOffHeapDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionCCEOffHeapDUnitTest.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; /** @@ -38,7 +39,7 @@ public class DistributedAckRegionCCEOffHeapDUnitTest extends DistributedAckRegio } @Override - public void tearDown2() throws Exception { + protected final void preTearDownCacheTestCase() throws Exception { SerializableRunnable checkOrphans = new SerializableRunnable() { @Override @@ -48,12 +49,8 @@ public class DistributedAckRegionCCEOffHeapDUnitTest extends DistributedAckRegio } } }; - 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/DistributedAckRegionDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionDUnitTest.java index 27da3d6..f957e49 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionDUnitTest.java @@ -25,7 +25,9 @@ import com.gemstone.gemfire.cache.Region; import com.gemstone.gemfire.cache.RegionAttributes; import com.gemstone.gemfire.cache.Scope; import com.gemstone.gemfire.distributed.internal.DistributionConfig; +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; @@ -60,7 +62,7 @@ public class DistributedAckRegionDUnitTest extends MultiVMRegionTestCase { public Properties getDistributedSystemProperties() { Properties p = new Properties(); p.put(DistributionConfig.STATISTIC_SAMPLING_ENABLED_NAME, "true"); - p.put(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel()); + p.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel()); return p; } @@ -90,7 +92,7 @@ public class DistributedAckRegionDUnitTest extends MultiVMRegionTestCase { createRegion(name, "INCOMPATIBLE_ROOT", getRegionAttributes()); } catch (CacheException ex) { - fail("While creating ACK region", ex); + Assert.fail("While creating ACK region", ex); } } }); @@ -109,7 +111,7 @@ public class DistributedAckRegionDUnitTest extends MultiVMRegionTestCase { } } catch (CacheException ex) { - fail("While creating GLOBAL Region", ex); + Assert.fail("While creating GLOBAL Region", ex); } } }); @@ -127,7 +129,7 @@ public class DistributedAckRegionDUnitTest extends MultiVMRegionTestCase { } } catch (CacheException ex) { - fail("While creating NOACK Region", ex); + Assert.fail("While creating NOACK Region", ex); } } }); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionOffHeapDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionOffHeapDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionOffHeapDUnitTest.java index 5d7f8f6..cbf8367 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionOffHeapDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionOffHeapDUnitTest.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; /** @@ -38,7 +39,7 @@ public class DistributedAckRegionOffHeapDUnitTest extends DistributedAckRegionDU } @Override - public void tearDown2() throws Exception { + protected final void preTearDownCacheTestCase() throws Exception { SerializableRunnable checkOrphans = new SerializableRunnable() { @Override @@ -48,12 +49,8 @@ public class DistributedAckRegionOffHeapDUnitTest extends DistributedAckRegionDU } } }; - 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/DistributedMulticastRegionDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedMulticastRegionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedMulticastRegionDUnitTest.java index 3728cf6..77e8253 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedMulticastRegionDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedMulticastRegionDUnitTest.java @@ -37,6 +37,7 @@ import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.internal.cache.OffHeapTestUtil; import com.gemstone.gemfire.test.dunit.DistributedTestCase; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.Invoke; import com.gemstone.gemfire.test.dunit.SerializableCallable; import com.gemstone.gemfire.test.dunit.SerializableRunnable; import com.gemstone.gemfire.test.dunit.VM; @@ -60,9 +61,8 @@ public class DistributedMulticastRegionDUnitTest extends CacheTestCase { } @Override - public void tearDown2() throws Exception { + protected final void preTearDownCacheTestCase() throws Exception { clean(); - super.tearDown2(); } private void clean(){ @@ -72,7 +72,7 @@ public class DistributedMulticastRegionDUnitTest extends CacheTestCase { disconnectFromDS(); } }; - invokeInEveryVM(cleanVM); + Invoke.invokeInEveryVM(cleanVM); } public void testMulticastEnabled() { @@ -172,7 +172,7 @@ public class DistributedMulticastRegionDUnitTest extends CacheTestCase { locator1Vm.invoke(new SerializableCallable() { @Override public Object call() { - final File locatorLogFile = new File(testName + "-locator-" + locatorPort + ".log"); + final File locatorLogFile = new File(getTestMethodName() + "-locator-" + locatorPort + ".log"); final Properties locatorProps = new Properties(); locatorProps.setProperty(DistributionConfig.NAME_NAME, "LocatorWithMcast"); locatorProps.setProperty(DistributionConfig.MCAST_PORT_NAME, mcastport); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionCCEDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionCCEDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionCCEDUnitTest.java index c65101e..a1cc2cd 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionCCEDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionCCEDUnitTest.java @@ -33,10 +33,13 @@ import com.gemstone.gemfire.cache.util.CacheListenerAdapter; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; import com.gemstone.gemfire.internal.cache.LocalRegion; +import com.gemstone.gemfire.test.dunit.Assert; import com.gemstone.gemfire.test.dunit.AsyncInvocation; 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; +import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.Wait; public class DistributedNoAckRegionCCEDUnitTest extends DistributedNoAckRegionDUnitTest { @@ -126,7 +129,7 @@ public class DistributedNoAckRegionCCEDUnitTest extends AsyncInvocation vm1Ops = vm1.invokeAsync(DistributedNoAckRegionCCEDUnitTest.class, "doManyOps"); AsyncInvocation vm2Ops = vm2.invokeAsync(DistributedNoAckRegionCCEDUnitTest.class, "doManyOps"); // pause to let a bunch of operations build up - pause(5000); + Wait.pause(5000); AsyncInvocation a0 = vm3.invokeAsync(DistributedNoAckRegionCCEDUnitTest.class, "clearRegion"); vm0.invoke(DistributedNoAckRegionCCEDUnitTest.class, "unblockListener"); vm1.invoke(DistributedNoAckRegionCCEDUnitTest.class, "unblockListener"); @@ -139,7 +142,7 @@ public class DistributedNoAckRegionCCEDUnitTest extends // if (a0failed && a1failed) { // fail("neither member saw event conflation - check stats for " + name); // } - pause(2000);//this test has with noack, thus we should wait before validating entries + Wait.pause(2000);//this test has with noack, thus we should wait before validating entries // check consistency of the regions Map r0Contents = (Map)vm0.invoke(this.getClass(), "getCCRegionContents"); Map r1Contents = (Map)vm1.invoke(this.getClass(), "getCCRegionContents"); @@ -171,25 +174,25 @@ public class DistributedNoAckRegionCCEDUnitTest extends if (event.isOriginRemote()) { synchronized(this) { while (ListenerBlocking) { - getLogWriter().info("blocking cache operations for " + event.getDistributedMember()); + LogWriterUtils.getLogWriter().info("blocking cache operations for " + event.getDistributedMember()); blocked = true; try { wait(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); - getLogWriter().info("blocking cache listener interrupted"); + LogWriterUtils.getLogWriter().info("blocking cache listener interrupted"); return; } } } if (blocked) { - getLogWriter().info("allowing cache operations for " + event.getDistributedMember()); + LogWriterUtils.getLogWriter().info("allowing cache operations for " + event.getDistributedMember()); } } } @Override public void close() { - getLogWriter().info("closing blocking listener"); + LogWriterUtils.getLogWriter().info("closing blocking listener"); ListenerBlocking = false; synchronized(this) { notifyAll(); @@ -314,7 +317,7 @@ public class DistributedNoAckRegionCCEDUnitTest extends } CCRegion = (LocalRegion)f.create(name); } catch (CacheException ex) { - fail("While creating region", ex); + Assert.fail("While creating region", ex); } } }; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionCCEOffHeapDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionCCEOffHeapDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionCCEOffHeapDUnitTest.java index 4d3bb80..c068876 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionCCEOffHeapDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionCCEOffHeapDUnitTest.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; /** @@ -38,7 +39,7 @@ public class DistributedNoAckRegionCCEOffHeapDUnitTest extends DistributedNoAckR } @Override - public void tearDown2() throws Exception { + protected final void preTearDownCacheTestCase() throws Exception { SerializableRunnable checkOrphans = new SerializableRunnable() { @Override @@ -48,12 +49,8 @@ public class DistributedNoAckRegionCCEOffHeapDUnitTest extends DistributedNoAckR } } }; - 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/DistributedNoAckRegionDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionDUnitTest.java index aa39758..1d680f0 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionDUnitTest.java @@ -28,11 +28,15 @@ import com.gemstone.gemfire.cache.Scope; import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember; import com.gemstone.gemfire.internal.cache.DistributedRegion; import com.gemstone.gemfire.internal.cache.StateFlushOperation; +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; /** * This class tests the functionality of a cache {@link Region region} @@ -104,7 +108,7 @@ public class DistributedNoAckRegionDUnitTest assertTrue(getRootRegion("INCOMPATIBLE_ROOT").getAttributes().getScope().isDistributedNoAck()); assertTrue(region.getAttributes().getScope().isDistributedNoAck()); } catch (CacheException ex) { - fail("While creating NO ACK region", ex); + Assert.fail("While creating NO ACK region", ex); } } }); @@ -126,7 +130,7 @@ public class DistributedNoAckRegionDUnitTest // assertNull(getRootRegion()); } catch (CacheException ex) { - fail("While creating GLOBAL Region", ex); + Assert.fail("While creating GLOBAL Region", ex); } } }); @@ -147,7 +151,7 @@ public class DistributedNoAckRegionDUnitTest // assertNull(getRootRegion()); } catch (CacheException ex) { - fail("While creating ACK Region", ex); + Assert.fail("While creating ACK Region", ex); } } }); @@ -180,12 +184,12 @@ public class DistributedNoAckRegionDUnitTest SerializableRunnable create = new CacheSerializableRunnable("Create Mirrored Region") { public void run2() throws CacheException { - getLogWriter().info("testBug30705: Start creating Mirrored Region"); + LogWriterUtils.getLogWriter().info("testBug30705: Start creating Mirrored Region"); AttributesFactory factory = new AttributesFactory(getRegionAttributes()); factory.setDataPolicy(DataPolicy.REPLICATE); createRegion(name, factory.create()); - getLogWriter().info("testBug30705: Finished creating Mirrored Region"); + LogWriterUtils.getLogWriter().info("testBug30705: Finished creating Mirrored Region"); } }; @@ -197,14 +201,14 @@ public class DistributedNoAckRegionDUnitTest Object key = new Integer(0x42); Object value = new byte[0]; assertNotNull(value); - getLogWriter().info("testBug30705: Started Distributed NoAck Puts"); + LogWriterUtils.getLogWriter().info("testBug30705: Started Distributed NoAck Puts"); for (int i = 0; i < NUM_PUTS; i++) { if (stopPutting) { - getLogWriter().info("testBug30705: Interrupted Distributed Ack Puts after " + i + " PUTS"); + LogWriterUtils.getLogWriter().info("testBug30705: Interrupted Distributed Ack Puts after " + i + " PUTS"); break; } if ((i % 1000) == 0) { - getLogWriter().info("testBug30705: modification #" + i); + LogWriterUtils.getLogWriter().info("testBug30705: modification #" + i); } rgn.put(key, value); } @@ -216,18 +220,18 @@ public class DistributedNoAckRegionDUnitTest vm0.invoke(new CacheSerializableRunnable("Put data") { public void run2() throws CacheException { - getLogWriter().info("testBug30705: starting initial data load"); + LogWriterUtils.getLogWriter().info("testBug30705: starting initial data load"); Region region = getRootRegion().getSubregion(name); final byte[] value = new byte[valueSize]; Arrays.fill(value, (byte)0x42); for (int i = 0; i < numEntries; i++) { if ((i % 1000) == 0) { - getLogWriter().info("testBug30705: initial put #" + i); + LogWriterUtils.getLogWriter().info("testBug30705: initial put #" + i); } region.put(new Integer(i), value); } - getLogWriter().info("testBug30705: finished initial data load"); + LogWriterUtils.getLogWriter().info("testBug30705: finished initial data load"); } }); @@ -236,19 +240,19 @@ public class DistributedNoAckRegionDUnitTest // do initial image try { - getLogWriter().info("testBug30705: before the critical create"); + LogWriterUtils.getLogWriter().info("testBug30705: before the critical create"); vm2.invoke(create); - getLogWriter().info("testBug30705: after the critical create"); + LogWriterUtils.getLogWriter().info("testBug30705: after the critical create"); } finally { // test passes if this does not hang - getLogWriter().info("testBug30705: INTERRUPTING Distributed NoAck Puts after GetInitialImage"); + LogWriterUtils.getLogWriter().info("testBug30705: INTERRUPTING Distributed NoAck Puts after GetInitialImage"); vm0.invoke(new SerializableRunnable("Interrupt Puts") { public void run() { - getLogWriter().info("testBug30705: interrupting putter"); + LogWriterUtils.getLogWriter().info("testBug30705: interrupting putter"); stopPutting = true; } }); - DistributedTestCase.join(async, 30 * 1000, getLogWriter()); + ThreadUtils.join(async, 30 * 1000); // wait for overflow queue to quiesce before continuing vm2.invoke(new SerializableRunnable("Wait for Overflow Queue") { public void run() { @@ -260,7 +264,7 @@ public class DistributedNoAckRegionDUnitTest return "overflow queue remains nonempty"; } }; - DistributedTestCase.waitForCriterion(ev, 30 * 1000, 200, true); + Wait.waitForCriterion(ev, 30 * 1000, 200, true); // pause(100); // try { // getRootRegion().getSubregion(name).destroyRegion(); @@ -270,20 +274,20 @@ public class DistributedNoAckRegionDUnitTest } }); } // finally - getLogWriter().info("testBug30705: at end of test"); + LogWriterUtils.getLogWriter().info("testBug30705: at end of test"); if (async.exceptionOccurred()) { - fail("Got exception", async.getException()); + Assert.fail("Got exception", async.getException()); } } @Override protected void pauseIfNecessary(int ms) { - pause(ms); + Wait.pause(ms); } @Override protected void pauseIfNecessary() { - pause(); + Wait.pause(); } @Override http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionOffHeapDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionOffHeapDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionOffHeapDUnitTest.java index 2aa1f1e..e668d3f 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionOffHeapDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionOffHeapDUnitTest.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; /** @@ -38,7 +39,7 @@ public class DistributedNoAckRegionOffHeapDUnitTest extends DistributedNoAckRegi } @Override - public void tearDown2() throws Exception { + protected final void preTearDownCacheTestCase() throws Exception { SerializableRunnable checkOrphans = new SerializableRunnable() { @Override @@ -48,12 +49,8 @@ public class DistributedNoAckRegionOffHeapDUnitTest extends DistributedNoAckRegi } } }; - 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/DynamicRegionDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DynamicRegionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DynamicRegionDUnitTest.java index f8baf5a..19d2bb7 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DynamicRegionDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/DynamicRegionDUnitTest.java @@ -32,6 +32,7 @@ import com.gemstone.gemfire.cache.Scope; import com.gemstone.gemfire.internal.OSProcess; import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.LogWriterUtils; import com.gemstone.gemfire.test.dunit.VM; /** @@ -71,8 +72,9 @@ public class DynamicRegionDUnitTest extends CacheTestCase { * in a test. * </p> */ - public void tearDown2() throws Exception { - getLogWriter().info("Running tearDown in " + this); + @Override + protected final void preTearDownCacheTestCase() throws Exception { + LogWriterUtils.getLogWriter().info("Running tearDown in " + this); try { //Asif destroy dynamic regions at the end of the test CacheSerializableRunnable destroyDynRegn = new CacheSerializableRunnable("Destroy Dynamic regions") { @@ -89,15 +91,13 @@ public class DynamicRegionDUnitTest extends CacheTestCase { if(dr != null) { dr.localDestroyRegion(); } - - super.tearDown2(); } catch (VirtualMachineError e) { SystemFailure.initiateFailure(e); throw e; } catch (Throwable t) { - getLogWriter().severe("tearDown in " + this + " failed due to " + t); + LogWriterUtils.getLogWriter().severe("tearDown in " + this + " failed due to " + t); } finally { try { @@ -108,11 +108,11 @@ public class DynamicRegionDUnitTest extends CacheTestCase { throw e; } catch (Throwable t) { - getLogWriter().severe("tearDown in " + this + " failed to disconnect all DS due to " + t); + LogWriterUtils.getLogWriter().severe("tearDown in " + this + " failed to disconnect all DS due to " + t); } } if (! DynamicRegionFactory.get().isClosed()) { - getLogWriter().severe("DynamicRegionFactory not closed!", new Exception()); + LogWriterUtils.getLogWriter().severe("DynamicRegionFactory not closed!", new Exception()); } } @@ -230,7 +230,7 @@ public class DynamicRegionDUnitTest extends CacheTestCase { DynamicRegionFactory.get().createDynamicRegion(drFullPath, "subregion" + i); } - getLogWriter().info("testPeerRegion - check #1 make sure other region has new dynamic subregion"); + LogWriterUtils.getLogWriter().info("testPeerRegion - check #1 make sure other region has new dynamic subregion"); checkForRegionOtherVm(drFullPath, true); // spot check the subregions @@ -239,13 +239,13 @@ public class DynamicRegionDUnitTest extends CacheTestCase { // now see if OTHER can recreate which should fetch meta-info from controller recreateOtherVm(); - getLogWriter().info("testPeerRegion - check #2 make sure other region has dynamic region after restarting through getInitialImage"); + LogWriterUtils.getLogWriter().info("testPeerRegion - check #2 make sure other region has dynamic region after restarting through getInitialImage"); checkForRegionOtherVm(drFullPath, true); // now close the controller and see if OTHER can still fetch meta-info from disk closeCache(); recreateOtherVm(); - getLogWriter().info("testPeerRegion - check #3 make sure dynamic region can be recovered from disk"); + LogWriterUtils.getLogWriter().info("testPeerRegion - check #3 make sure dynamic region can be recovered from disk"); checkForRegionOtherVm(drFullPath, true); for (int i=0; i<10; i++) { checkForSubregionOtherVm(drFullPath + "/subregion" + i, true); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalLockingDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalLockingDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalLockingDUnitTest.java index c6b5a05..0830b7e 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalLockingDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalLockingDUnitTest.java @@ -29,6 +29,7 @@ import com.gemstone.gemfire.cache.RegionExistsException; import com.gemstone.gemfire.cache.Scope; import com.gemstone.gemfire.cache.TimeoutException; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.LogWriterUtils; import com.gemstone.gemfire.test.dunit.VM; /** @@ -71,13 +72,13 @@ public class GlobalLockingDUnitTest extends CacheTestCase { * Tests for 32356 R2 tryLock w/ 0 timeout broken in Distributed Lock Service */ public void testBug32356() throws Exception { - getLogWriter().fine("[testBug32356]"); + LogWriterUtils.getLogWriter().fine("[testBug32356]"); Host host = Host.getHost(0); final String name = this.getUniqueName(); final Object key = "32356"; // lock/unlock '32356' in all vms... (make all vms aware of token) - getLogWriter().fine("[testBug32356] lock/unlock '32356' in all vms"); + LogWriterUtils.getLogWriter().fine("[testBug32356] lock/unlock '32356' in all vms"); for (int i = 0; i < 4; i++) { final int vm = i; host.getVM(vm).invoke(new CacheSerializableRunnable("testBug32356_step1") { @@ -92,7 +93,7 @@ public class GlobalLockingDUnitTest extends CacheTestCase { } // attempt try-lock of zero wait time in all vms - getLogWriter().fine("[testBug32356] attempt try-lock of zero wait time in all vms"); + LogWriterUtils.getLogWriter().fine("[testBug32356] attempt try-lock of zero wait time in all vms"); for (int i = 0; i < 4; i++) { final int vm = i; host.getVM(vm).invoke(new CacheSerializableRunnable("testBug32356_step2") { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionCCEDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionCCEDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionCCEDUnitTest.java index 22b303f..c328995 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionCCEDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionCCEDUnitTest.java @@ -36,6 +36,7 @@ import com.gemstone.gemfire.internal.cache.RegionClearedException; import com.gemstone.gemfire.internal.cache.RegionEntry; import com.gemstone.gemfire.internal.cache.TombstoneService; import com.gemstone.gemfire.internal.cache.versions.VersionTag; +import com.gemstone.gemfire.test.dunit.Assert; import com.gemstone.gemfire.test.dunit.Host; import com.gemstone.gemfire.test.dunit.SerializableRunnable; import com.gemstone.gemfire.test.dunit.VM; @@ -167,7 +168,7 @@ public class GlobalRegionCCEDUnitTest extends GlobalRegionDUnitTest { CCRegion.put("cckey0", "ccvalue"); CCRegion.put("cckey0", "ccvalue"); // version number will end up at 4 } catch (CacheException ex) { - fail("While creating region", ex); + Assert.fail("While creating region", ex); } } }; @@ -189,7 +190,7 @@ public class GlobalRegionCCEDUnitTest extends GlobalRegionDUnitTest { try { entry.makeTombstone(CCRegion, tag); } catch (RegionClearedException e) { - fail("region was mysteriously cleared during unit testing", e); + Assert.fail("region was mysteriously cleared during unit testing", e); } } }); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionCCEOffHeapDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionCCEOffHeapDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionCCEOffHeapDUnitTest.java index 8579548..653cab2 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionCCEOffHeapDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionCCEOffHeapDUnitTest.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; /** @@ -38,7 +39,7 @@ public class GlobalRegionCCEOffHeapDUnitTest extends GlobalRegionCCEDUnitTest { } @Override - public void tearDown2() throws Exception { + protected final void preTearDownCacheTestCase() throws Exception { SerializableRunnable checkOrphans = new SerializableRunnable() { @Override @@ -48,12 +49,8 @@ public class GlobalRegionCCEOffHeapDUnitTest extends GlobalRegionCCEDUnitTest { } } }; - 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/GlobalRegionDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionDUnitTest.java index f08b66f..008f951 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionDUnitTest.java @@ -31,10 +31,12 @@ import com.gemstone.gemfire.cache.Region; import com.gemstone.gemfire.cache.RegionAttributes; import com.gemstone.gemfire.cache.Scope; import com.gemstone.gemfire.cache.TimeoutException; +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; /** @@ -86,7 +88,7 @@ public class GlobalRegionDUnitTest extends MultiVMRegionTestCase { try { createRegion(name, "INCOMPATIBLE_ROOT", getRegionAttributes()); } catch (CacheException ex) { - fail("While creating GLOBAL region", ex); + Assert.fail("While creating GLOBAL region", ex); } assertTrue(getRootRegion("INCOMPATIBLE_ROOT").getAttributes().getScope().isGlobal()); } @@ -108,7 +110,7 @@ public class GlobalRegionDUnitTest extends MultiVMRegionTestCase { } } catch (CacheException ex) { - fail("While creating GLOBAL Region", ex); + Assert.fail("While creating GLOBAL Region", ex); } } }); @@ -134,7 +136,7 @@ public class GlobalRegionDUnitTest extends MultiVMRegionTestCase { } } catch (CacheException ex) { - fail("While creating GLOBAL Region", ex); + Assert.fail("While creating GLOBAL Region", ex); } } }); @@ -245,7 +247,7 @@ public class GlobalRegionDUnitTest extends MultiVMRegionTestCase { SystemFailure.setFailure((VirtualMachineError)e); // don't throw } String s = "Uncaught exception in thread " + t; - fail(s, e); + Assert.fail(s, e); } }; @@ -254,7 +256,7 @@ public class GlobalRegionDUnitTest extends MultiVMRegionTestCase { Thread thread = new Thread(group, new Runnable() { public void run() { try { - getLogWriter().info("testSynchronousIncrements." + this); + LogWriterUtils.getLogWriter().info("testSynchronousIncrements." + this); final Random rand = new Random(System.identityHashCode(this)); try { Region region = getRootRegion().getSubregion(name); @@ -278,15 +280,15 @@ public class GlobalRegionDUnitTest extends MultiVMRegionTestCase { region.put(key, value); assertEquals(value, region.get(key)); - getLogWriter().info("testSynchronousIncrements." + + LogWriterUtils.getLogWriter().info("testSynchronousIncrements." + this + ": " + key + " -> " + value); lock.unlock(); } } catch (InterruptedException ex) { - fail("While incrementing", ex); + Assert.fail("While incrementing", ex); } catch (Exception ex) { - fail("While incrementing", ex); + Assert.fail("While incrementing", ex); } } catch (VirtualMachineError e) { @@ -294,7 +296,7 @@ public class GlobalRegionDUnitTest extends MultiVMRegionTestCase { throw e; } catch (Throwable t) { - getLogWriter().info("testSynchronousIncrements." + + LogWriterUtils.getLogWriter().info("testSynchronousIncrements." + this + " caught Throwable", t); } } @@ -304,7 +306,7 @@ public class GlobalRegionDUnitTest extends MultiVMRegionTestCase { } for (int i = 0; i < threads.length; i++) { - DistributedTestCase.join(threads[i], 30 * 1000, getLogWriter()); + ThreadUtils.join(threads[i], 30 * 1000); } } }; @@ -315,9 +317,9 @@ public class GlobalRegionDUnitTest extends MultiVMRegionTestCase { } for (int i = 0; i < vmCount; i++) { - DistributedTestCase.join(invokes[i], 5 * 60 * 1000, getLogWriter()); + ThreadUtils.join(invokes[i], 5 * 60 * 1000); if (invokes[i].exceptionOccurred()) { - fail("invocation failed", invokes[i].getException()); + Assert.fail("invocation failed", invokes[i].getException()); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionOffHeapDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionOffHeapDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionOffHeapDUnitTest.java index 4af6072..c652c55 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionOffHeapDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionOffHeapDUnitTest.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; /** @@ -38,7 +39,7 @@ public class GlobalRegionOffHeapDUnitTest extends GlobalRegionDUnitTest { } @Override - public void tearDown2() throws Exception { + protected final void preTearDownCacheTestCase() throws Exception { SerializableRunnable checkOrphans = new SerializableRunnable() { @Override @@ -48,15 +49,9 @@ public class GlobalRegionOffHeapDUnitTest extends GlobalRegionDUnitTest { } } }; - invokeInEveryVM(checkOrphans); - try { - checkOrphans.run(); - } finally { - super.tearDown2(); - } + Invoke.invokeInEveryVM(checkOrphans); + checkOrphans.run(); } - - @Override public void DISABLED_testNBRegionInvalidationDuringGetInitialImage() throws Throwable { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/LRUEvictionControllerDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/LRUEvictionControllerDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/LRUEvictionControllerDUnitTest.java index df02539..b3a85bc 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/LRUEvictionControllerDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/LRUEvictionControllerDUnitTest.java @@ -46,6 +46,7 @@ import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.Resou import com.gemstone.gemfire.internal.cache.lru.HeapEvictor; import com.gemstone.gemfire.internal.cache.lru.LRUStatistics; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.LogWriterUtils; import com.gemstone.gemfire.test.dunit.VM; /** @@ -303,7 +304,7 @@ public class LRUEvictionControllerDUnitTest extends CacheTestCase { CacheListenerAdapter() { public void afterCreate(EntryEvent event) { try { - getLogWriter().info("AFTER CREATE"); + LogWriterUtils.getLogWriter().info("AFTER CREATE"); region.put(key, value2); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/LocalRegionDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/LocalRegionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/LocalRegionDUnitTest.java index 0ea842d..2ed532b 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/LocalRegionDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/LocalRegionDUnitTest.java @@ -26,6 +26,7 @@ import com.gemstone.gemfire.cache.Region; import com.gemstone.gemfire.cache.RegionAttributes; import com.gemstone.gemfire.cache.Scope; import com.gemstone.gemfire.cache.TimeoutException; +import com.gemstone.gemfire.test.dunit.Assert; /** * Tests the functionality of a {@link Scope#LOCAL locally scoped} @@ -124,7 +125,7 @@ public class LocalRegionDUnitTest extends CacheListenerTestCase { helper.netSearch(true); } catch (TimeoutException ex) { - fail("Why did I timeout?", ex); + Assert.fail("Why did I timeout?", ex); } return null;