http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/disttx/DistTXDebugDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/disttx/DistTXDebugDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/disttx/DistTXDebugDUnitTest.java index 58e76a6..db36aac 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/disttx/DistTXDebugDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/disttx/DistTXDebugDUnitTest.java @@ -43,6 +43,8 @@ import com.gemstone.gemfire.internal.cache.PartitionedRegion; import com.gemstone.gemfire.internal.cache.control.InternalResourceManager; import com.gemstone.gemfire.internal.cache.execute.CustomerIDPartitionResolver; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.Invoke; +import com.gemstone.gemfire.test.dunit.LogWriterUtils; import com.gemstone.gemfire.test.dunit.SerializableCallable; import com.gemstone.gemfire.test.dunit.SerializableRunnable; import com.gemstone.gemfire.test.dunit.VM; @@ -68,9 +70,8 @@ public class DistTXDebugDUnitTest extends CacheTestCase { } @Override - public void tearDown2() throws Exception { - super.tearDown2(); - invokeInEveryVM(new SerializableRunnable() { + protected final void postTearDownCacheTestCase() throws Exception { + Invoke.invokeInEveryVM(new SerializableRunnable() { public void run() { InternalResourceManager.setResourceObserver(null); } @@ -126,7 +127,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { assertNotNull(cache); Region pr = cache.createRegion(partitionedRegionName, attr.create()); assertNotNull(pr); - getLogWriter().info( + LogWriterUtils.getLogWriter().info( "Partitioned Region " + partitionedRegionName + " created Successfully :" + pr.toString()); } @@ -147,7 +148,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { assertNotNull(cache); Region pr = cache.getRegion(partitionedRegionName); assertNotNull(pr); - getLogWriter().info( + LogWriterUtils.getLogWriter().info( "Destroying Partitioned Region " + partitionedRegionName); pr.destroyRegion(); } @@ -164,7 +165,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { // af.create()); Region rr = cache.createRegion(replicatedRegionName, af.create()); assertNotNull(rr); - getLogWriter().info( + LogWriterUtils.getLogWriter().info( "Replicated Region " + replicatedRegionName + " created Successfully :" + rr.toString()); } @@ -195,7 +196,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 3; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info(" calling pr.put"); + LogWriterUtils.getLogWriter().info(" calling pr.put"); pr1.put(dummy, "1_entry__" + i); } @@ -208,7 +209,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 3; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info(" calling pr.put in tx 1"); + LogWriterUtils.getLogWriter().info(" calling pr.put in tx 1"); pr1.put(dummy, "2_entry__" + i); } ctx.commit(); @@ -217,7 +218,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 3; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info(" calling pr.get"); + LogWriterUtils.getLogWriter().info(" calling pr.get"); assertEquals("2_entry__" + i, pr1.get(dummy)); } @@ -226,7 +227,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 3; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info(" calling pr.put in tx 2"); + LogWriterUtils.getLogWriter().info(" calling pr.put in tx 2"); pr1.put(dummy, "3_entry__" + i); } ctx.rollback(); @@ -235,7 +236,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 3; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info(" calling pr.get"); + LogWriterUtils.getLogWriter().info(" calling pr.get"); assertEquals("2_entry__" + i, pr1.get(dummy)); } @@ -244,7 +245,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 3; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info(" calling pr.destroy in tx 3"); + LogWriterUtils.getLogWriter().info(" calling pr.destroy in tx 3"); pr1.destroy(dummy); } ctx.commit(); @@ -253,7 +254,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 3; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info(" calling pr.get"); + LogWriterUtils.getLogWriter().info(" calling pr.get"); assertEquals(null, pr1.get(dummy)); } @@ -263,7 +264,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { public Object call() throws CacheException { PartitionedRegion pr1 = (PartitionedRegion) cache .getRegion("pregion1"); - getLogWriter().info( + LogWriterUtils.getLogWriter().info( " calling pr.getLocalSize " + pr1.getLocalSize()); assertEquals(0, pr1.getLocalSize()); return null; @@ -302,7 +303,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 6; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info(" calling non-tx put"); + LogWriterUtils.getLogWriter().info(" calling non-tx put"); pr1.put(dummy, "1_entry__" + i); rr1.put(dummy, "1_entry__" + i); } @@ -314,19 +315,19 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 3; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info( + LogWriterUtils.getLogWriter().info( " calling pr1.destroy in tx key=" + dummy); pr1.destroy(dummy); - getLogWriter().info(" calling rr1.destroy in tx key=" + i); + LogWriterUtils.getLogWriter().info(" calling rr1.destroy in tx key=" + i); rr1.destroy(dummy); } for (int i = 4; i <= 6; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info( + LogWriterUtils.getLogWriter().info( " calling pr1.invalidate in tx key=" + dummy); pr1.invalidate(dummy); - getLogWriter().info(" calling rr1.invalidate in tx key=" + i); + LogWriterUtils.getLogWriter().info(" calling rr1.invalidate in tx key=" + i); rr1.invalidate(dummy); } ctx.commit(); @@ -335,9 +336,9 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 6; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info(" calling pr1.get"); + LogWriterUtils.getLogWriter().info(" calling pr1.get"); assertEquals(null, pr1.get(dummy)); - getLogWriter().info(" calling rr1.get"); + LogWriterUtils.getLogWriter().info(" calling rr1.get"); assertEquals(null, rr1.get(i)); } return null; @@ -352,10 +353,10 @@ public class DistTXDebugDUnitTest extends CacheTestCase { public Object call() throws CacheException { PartitionedRegion pr1 = (PartitionedRegion) cache.getRegion("pregion1"); Region rr1 = cache.getRegion("rregion1"); - getLogWriter().info( + LogWriterUtils.getLogWriter().info( " calling pr1.getLocalSize " + pr1.getLocalSize()); assertEquals(2, pr1.getLocalSize()); - getLogWriter().info(" calling rr1.size " + rr1.size()); + LogWriterUtils.getLogWriter().info(" calling rr1.size " + rr1.size()); assertEquals(3, rr1.size()); return null; } @@ -390,9 +391,9 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 3; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info(" calling pr.put non-tx PR1_entry__" + i); + LogWriterUtils.getLogWriter().info(" calling pr.put non-tx PR1_entry__" + i); pr1.put(dummy, "PR1_entry__" + i); - getLogWriter().info(" calling rr.put non-tx RR1_entry__" + i); + LogWriterUtils.getLogWriter().info(" calling rr.put non-tx RR1_entry__" + i); rr1.put(new Integer(i), "RR1_entry__" + i); } @@ -405,9 +406,9 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 3; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info(" calling pr.put in tx PR2_entry__" + i); + LogWriterUtils.getLogWriter().info(" calling pr.put in tx PR2_entry__" + i); pr1.put(dummy, "PR2_entry__" + i); - getLogWriter().info(" calling rr.put in tx RR2_entry__" + i); + LogWriterUtils.getLogWriter().info(" calling rr.put in tx RR2_entry__" + i); rr1.put(new Integer(i), "RR2_entry__" + i); } ctx.commit(); @@ -416,9 +417,9 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 3; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info(" calling pr.get PR2_entry__" + i); + LogWriterUtils.getLogWriter().info(" calling pr.get PR2_entry__" + i); assertEquals("PR2_entry__" + i, pr1.get(dummy)); - getLogWriter().info(" calling rr.get RR2_entry__" + i); + LogWriterUtils.getLogWriter().info(" calling rr.get RR2_entry__" + i); assertEquals("RR2_entry__" + i, rr1.get(new Integer(i))); } return null; @@ -432,12 +433,12 @@ public class DistTXDebugDUnitTest extends CacheTestCase { @Override public Object call() throws CacheException { PartitionedRegion pr1 = (PartitionedRegion) cache.getRegion("pregion1"); - getLogWriter().info( + LogWriterUtils.getLogWriter().info( " calling pr.getLocalSize " + pr1.getLocalSize()); assertEquals(2, pr1.getLocalSize()); Region rr1 = cache.getRegion("rregion1"); - getLogWriter() + LogWriterUtils.getLogWriter() .info(" calling rr.getLocalSize " + rr1.size()); assertEquals(3, rr1.size()); return null; @@ -474,7 +475,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 3; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info(" calling pr.put in tx 1"); + LogWriterUtils.getLogWriter().info(" calling pr.put in tx 1"); pr1.put(dummy, "2_entry__" + i); } ctx.commit(); @@ -483,7 +484,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 3; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info(" calling pr.get " + pr1.get(dummy)); + LogWriterUtils.getLogWriter().info(" calling pr.get " + pr1.get(dummy)); assertEquals("2_entry__" + i, pr1.get(dummy)); } return null; @@ -497,7 +498,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { public Object call() throws CacheException { PartitionedRegion pr1 = (PartitionedRegion) cache.getRegion("pregion1"); CacheTransactionManager ctx = cache.getCacheTransactionManager(); - getLogWriter().info( + LogWriterUtils.getLogWriter().info( " calling pr.getLocalSize " + pr1.getLocalSize()); assertEquals(2, pr1.getLocalSize()); return null; @@ -525,7 +526,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 3; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info( + LogWriterUtils.getLogWriter().info( " calling pr.put in tx for rollback no_entry__" + i); pr1.put(dummy, "no_entry__" + i); } @@ -535,7 +536,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 3; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info( + LogWriterUtils.getLogWriter().info( " calling pr.get after rollback " + pr1.get(dummy)); assertEquals("2_entry__" + i, pr1.get(dummy)); } @@ -569,10 +570,10 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 3; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info(" calling pr.create in tx 1"); + LogWriterUtils.getLogWriter().info(" calling pr.create in tx 1"); pr1.create(dummy, "2_entry__" + i); - getLogWriter().info(" calling rr.create " + "2_entry__" + i); + LogWriterUtils.getLogWriter().info(" calling rr.create " + "2_entry__" + i); rr1.create(new Integer(i), "2_entry__" + i); } ctx.commit(); @@ -581,10 +582,10 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 3; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info(" calling pr.get " + pr1.get(dummy)); + LogWriterUtils.getLogWriter().info(" calling pr.get " + pr1.get(dummy)); assertEquals("2_entry__" + i, pr1.get(dummy)); - getLogWriter().info( + LogWriterUtils.getLogWriter().info( " calling rr.get " + rr1.get(new Integer(i))); assertEquals("2_entry__" + i, rr1.get(new Integer(i))); } @@ -599,12 +600,12 @@ public class DistTXDebugDUnitTest extends CacheTestCase { @Override public Object call() throws CacheException { Region rr1 = cache.getRegion("rregion1"); - getLogWriter() + LogWriterUtils.getLogWriter() .info(" calling rr.getLocalSize " + rr1.size()); assertEquals(3, rr1.size()); PartitionedRegion pr1 = (PartitionedRegion) cache.getRegion("pregion1"); - getLogWriter().info( + LogWriterUtils.getLogWriter().info( " calling pr.getLocalSize " + pr1.getLocalSize()); assertEquals(2, pr1.getLocalSize()); return null; @@ -649,10 +650,10 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 3; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info(" calling pr.get " + pr1.get(dummy)); + LogWriterUtils.getLogWriter().info(" calling pr.get " + pr1.get(dummy)); assertEquals("2_entry__" + i, pr1.get(dummy)); - getLogWriter().info( + LogWriterUtils.getLogWriter().info( " calling rr.get " + rr1.get(new Integer(i))); assertEquals("2_entry__" + i, rr1.get(new Integer(i))); } @@ -667,12 +668,12 @@ public class DistTXDebugDUnitTest extends CacheTestCase { @Override public Object call() throws CacheException { Region rr1 = cache.getRegion("rregion1"); - getLogWriter() + LogWriterUtils.getLogWriter() .info(" calling rr.getLocalSize " + rr1.size()); assertEquals(3, rr1.size()); PartitionedRegion pr1 = (PartitionedRegion) cache.getRegion("pregion1"); - getLogWriter().info( + LogWriterUtils.getLogWriter().info( " calling pr.getLocalSize " + pr1.getLocalSize()); assertEquals(2, pr1.getLocalSize()); return null; @@ -713,7 +714,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 3; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info(" calling pr.get " + pr1.get(dummy)); + LogWriterUtils.getLogWriter().info(" calling pr.get " + pr1.get(dummy)); assertEquals("2_entry__" + i, pr1.get(dummy)); } @@ -729,7 +730,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { @Override public Object call() throws CacheException { PartitionedRegion pr1 = (PartitionedRegion) cache.getRegion("pregion1"); - getLogWriter().info( + LogWriterUtils.getLogWriter().info( " calling pr.getLocalSize " + pr1.getLocalSize()); assertEquals(2, pr1.getLocalSize()); return null; @@ -780,7 +781,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { // verify the data for (int i = 1; i <= 3; i++) { - getLogWriter().info( + LogWriterUtils.getLogWriter().info( " calling rr.get " + rr1.get(new Integer(i))); assertEquals(null, rr1.get(new Integer(i))); } @@ -799,7 +800,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { @Override public Object call() throws CacheException { Region rr1 = cache.getRegion("rregion1"); - getLogWriter() + LogWriterUtils.getLogWriter() .info(" calling rr.getLocalSize " + rr1.size()); assertEquals(0, rr1.size()); return null; @@ -840,7 +841,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { for (int i = 1; i <= 3; i++) { DummyKeyBasedRoutingResolver dummy = new DummyKeyBasedRoutingResolver( i); - getLogWriter().info(" calling pr.get " + pr1.get(dummy)); + LogWriterUtils.getLogWriter().info(" calling pr.get " + pr1.get(dummy)); assertEquals(null, pr1.get(dummy)); } return null; @@ -854,7 +855,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { @Override public Object call() throws CacheException { PartitionedRegion pr1 = (PartitionedRegion) cache.getRegion("pregion1"); - getLogWriter().info( + LogWriterUtils.getLogWriter().info( " calling pr.getLocalSize " + pr1.getLocalSize()); assertEquals(0, pr1.getLocalSize()); return null; @@ -885,14 +886,14 @@ public class DistTXDebugDUnitTest extends CacheTestCase { ctx.setDistributed(true); ctx.begin(); for (int i = 1; i <= 3; i++) { - getLogWriter().info(" calling rr.put " + "2_entry__" + i); + LogWriterUtils.getLogWriter().info(" calling rr.put " + "2_entry__" + i); rr1.put(new Integer(i), "2_entry__" + i); } ctx.commit(); // verify the data for (int i = 1; i <= 3; i++) { - getLogWriter().info( + LogWriterUtils.getLogWriter().info( " calling rr.get " + rr1.get(new Integer(i))); assertEquals("2_entry__" + i, rr1.get(new Integer(i))); } @@ -911,7 +912,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { @Override public Object call() throws CacheException { Region rr1 = cache.getRegion("rregion1"); - getLogWriter() + LogWriterUtils.getLogWriter() .info(" calling rr.getLocalSize " + rr1.size()); assertEquals(3, rr1.size()); return null; @@ -929,7 +930,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { ctx.setDistributed(true); ctx.begin(); for (int i = 1; i <= 3; i++) { - getLogWriter().info( + LogWriterUtils.getLogWriter().info( " calling rr.put for rollback no_entry__" + i); rr1.put(new Integer(i), "no_entry__" + i); } @@ -938,7 +939,7 @@ public class DistTXDebugDUnitTest extends CacheTestCase { // verify the data for (int i = 1; i <= 3; i++) { - getLogWriter().info( + LogWriterUtils.getLogWriter().info( " calling rr.get after rollback " + rr1.get(new Integer(i))); assertEquals("2_entry__" + i, rr1.get(new Integer(i)));
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/disttx/DistTXPersistentDebugDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/disttx/DistTXPersistentDebugDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/disttx/DistTXPersistentDebugDUnitTest.java index 5a7375a..2cfeae7 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/disttx/DistTXPersistentDebugDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/disttx/DistTXPersistentDebugDUnitTest.java @@ -27,6 +27,8 @@ import com.gemstone.gemfire.cache.RegionAttributes; import com.gemstone.gemfire.internal.cache.TXManagerImpl; import com.gemstone.gemfire.internal.cache.execute.data.CustId; import com.gemstone.gemfire.internal.cache.execute.data.Customer; +import com.gemstone.gemfire.test.dunit.Invoke; +import com.gemstone.gemfire.test.dunit.LogWriterUtils; import com.gemstone.gemfire.test.dunit.SerializableCallable; public class DistTXPersistentDebugDUnitTest extends DistTXDebugDUnitTest { @@ -38,7 +40,7 @@ public class DistTXPersistentDebugDUnitTest extends DistTXDebugDUnitTest { @Override public void setUp() throws Exception { super.setUp(); - this.invokeInEveryVM(new SerializableCallable() { + Invoke.invokeInEveryVM(new SerializableCallable() { @Override public Object call() throws Exception { //System.setProperty("gemfire.ALLOW_PERSISTENT_TRANSACTIONS", "true"); @@ -49,8 +51,8 @@ public class DistTXPersistentDebugDUnitTest extends DistTXDebugDUnitTest { } @Override - public void tearDown2() throws Exception { - this.invokeInEveryVM(new SerializableCallable() { + protected final void preTearDownCacheTestCase() throws Exception { + Invoke.invokeInEveryVM(new SerializableCallable() { @Override public Object call() throws Exception { //System.setProperty("gemfire.ALLOW_PERSISTENT_TRANSACTIONS", "false"); @@ -58,7 +60,6 @@ public class DistTXPersistentDebugDUnitTest extends DistTXDebugDUnitTest { return null; } }); - super.tearDown2(); } protected void createPesistentPR(Object[] attributes) { @@ -106,21 +107,21 @@ public class DistTXPersistentDebugDUnitTest extends DistTXDebugDUnitTest { public Object call() throws Exception { CacheTransactionManager mgr = cache.getCacheTransactionManager(); mgr.setDistributed(true); - getLogWriter().fine("SJ:TX BEGIN"); + LogWriterUtils.getLogWriter().fine("SJ:TX BEGIN"); mgr.begin(); Region<CustId, Customer> prRegion = cache.getRegion(regionName); CustId custIdOne = new CustId(1); Customer customerOne = new Customer("name1", "addr1"); - getLogWriter().fine("SJ:TX PUT 1"); + LogWriterUtils.getLogWriter().fine("SJ:TX PUT 1"); prRegion.put(custIdOne, customerOne); CustId custIdTwo = new CustId(2); Customer customerTwo = new Customer("name2", "addr2"); - getLogWriter().fine("SJ:TX PUT 2"); + LogWriterUtils.getLogWriter().fine("SJ:TX PUT 2"); prRegion.put(custIdTwo, customerTwo); - getLogWriter().fine("SJ:TX COMMIT"); + LogWriterUtils.getLogWriter().fine("SJ:TX COMMIT"); mgr.commit(); return null; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/disttx/DistributedTransactionDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/disttx/DistributedTransactionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/disttx/DistributedTransactionDUnitTest.java index 61c31d4..2eaef9c 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/disttx/DistributedTransactionDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/disttx/DistributedTransactionDUnitTest.java @@ -57,7 +57,10 @@ import com.gemstone.gemfire.internal.cache.execute.data.CustId; import com.gemstone.gemfire.internal.cache.execute.data.Customer; import com.gemstone.gemfire.internal.cache.execute.data.Order; import com.gemstone.gemfire.internal.cache.execute.data.OrderId; +import com.gemstone.gemfire.test.dunit.Assert; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.Invoke; +import com.gemstone.gemfire.test.dunit.LogWriterUtils; import com.gemstone.gemfire.test.dunit.SerializableCallable; import com.gemstone.gemfire.test.dunit.VM; @@ -79,7 +82,7 @@ public class DistributedTransactionDUnitTest extends CacheTestCase { @Override public void setUp() throws Exception{ super.setUp(); - this.invokeInEveryVM(new SerializableCallable() { + Invoke.invokeInEveryVM(new SerializableCallable() { @Override public Object call() throws Exception { System.setProperty("gemfire.sync-commits", "true"); @@ -95,7 +98,7 @@ public class DistributedTransactionDUnitTest extends CacheTestCase { // } // }); - this.invokeInEveryVM(new SerializableCallable() { + Invoke.invokeInEveryVM(new SerializableCallable() { @Override public Object call() throws Exception { //System.setProperty("gemfire.ALLOW_PERSISTENT_TRANSACTIONS", "true"); @@ -105,15 +108,16 @@ public class DistributedTransactionDUnitTest extends CacheTestCase { }); } - public void tearDown2() throws Exception { - this.invokeInEveryVM(new SerializableCallable() { + @Override + protected final void preTearDownCacheTestCase() throws Exception { + Invoke.invokeInEveryVM(new SerializableCallable() { @Override public Object call() throws Exception { System.setProperty("gemfire.sync-commits", "false"); return null; } }); - this.invokeInEveryVM(new SerializableCallable() { + Invoke.invokeInEveryVM(new SerializableCallable() { @Override public Object call() throws Exception { //System.setProperty("gemfire.ALLOW_PERSISTENT_TRANSACTIONS", "false"); @@ -121,8 +125,6 @@ public class DistributedTransactionDUnitTest extends CacheTestCase { return null; } }); - - super.tearDown2(); } public DistributedTransactionDUnitTest(String name) { @@ -1950,7 +1952,7 @@ public class DistributedTransactionDUnitTest extends CacheTestCase { public Exception ex = new Exception(); public void run() { - getLogWriter().info("Inside TxConflictRunnable.TxThread after aquiring locks"); + LogWriterUtils.getLogWriter().info("Inside TxConflictRunnable.TxThread after aquiring locks"); CacheTransactionManager mgr = getGemfireCache().getTxManager(); mgr.setDistributed(true); mgr.begin(); @@ -1963,10 +1965,10 @@ public class DistributedTransactionDUnitTest extends CacheTestCase { mgr.commit(); } catch (CommitConflictException ce) { gotConflict = true; - getLogWriter().info("Received exception ", ce); + LogWriterUtils.getLogWriter().info("Received exception ", ce); } catch (Exception e) { gotOtherException = true; - getLogWriter().info("Received exception ", e); + LogWriterUtils.getLogWriter().info("Received exception ", e); ex.initCause(e); } } @@ -1984,7 +1986,7 @@ public class DistributedTransactionDUnitTest extends CacheTestCase { assertTrue("This test should fail with CommitConflictException", txThread.gotConflict); if (txThread.gotOtherException) { - fail("Received unexpected exception ", txThread.ex); + Assert.fail("Received unexpected exception ", txThread.ex); } } } @@ -2085,7 +2087,7 @@ public class DistributedTransactionDUnitTest extends CacheTestCase { public Exception ex = new Exception(); public void run() { - getLogWriter() + LogWriterUtils.getLogWriter() .info("Inside TxRunnable.TxThread after aquiring locks"); CacheTransactionManager mgr = getGemfireCache().getTxManager(); mgr.setDistributed(true); @@ -2099,7 +2101,7 @@ public class DistributedTransactionDUnitTest extends CacheTestCase { mgr.commit(); } catch (Exception e) { gotException = true; - getLogWriter().info("Received exception ", e); + LogWriterUtils.getLogWriter().info("Received exception ", e); ex.initCause(e); } } @@ -2114,7 +2116,7 @@ public class DistributedTransactionDUnitTest extends CacheTestCase { e.printStackTrace(); } if (txThread.gotException) { - fail("Received exception ", txThread.ex); + Assert.fail("Received exception ", txThread.ex); } } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/BackwardCompatibilitySerializationDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/BackwardCompatibilitySerializationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/BackwardCompatibilitySerializationDUnitTest.java index 35269f7..f1e5dda 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/BackwardCompatibilitySerializationDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/BackwardCompatibilitySerializationDUnitTest.java @@ -70,7 +70,7 @@ public class BackwardCompatibilitySerializationDUnitTest extends CacheTestCase { } @After - public void tearDown2() { + protected final void preTearDownCacheTestCase() { resetFlags(); // reset the class mapped to the dsfid DSFIDFactory.registerDSFID(DataSerializableFixedID.PUTALL_VERSIONS_LIST, http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/ClassNotFoundExceptionDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/ClassNotFoundExceptionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/ClassNotFoundExceptionDUnitTest.java index 185ae2d..8ab0b2c 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/ClassNotFoundExceptionDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/ClassNotFoundExceptionDUnitTest.java @@ -39,6 +39,8 @@ import com.gemstone.gemfire.pdx.PdxReader; import com.gemstone.gemfire.pdx.PdxSerializable; import com.gemstone.gemfire.pdx.PdxWriter; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.IgnoredException; +import com.gemstone.gemfire.test.dunit.NetworkUtils; import com.gemstone.gemfire.test.dunit.SerializableCallable; import com.gemstone.gemfire.test.dunit.SerializableRunnable; import com.gemstone.gemfire.test.dunit.VM; @@ -65,7 +67,7 @@ public class ClassNotFoundExceptionDUnitTest extends CacheTestCase { } public void doTest(final ObjectFactory objectFactory) throws InterruptedException { - addExpectedException("SerializationException"); + IgnoredException.addIgnoredException("SerializationException"); Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); @@ -189,7 +191,7 @@ public class ClassNotFoundExceptionDUnitTest extends CacheTestCase { public Object call() throws Exception { disconnectFromDS(); ClientCacheFactory cf = new ClientCacheFactory(); - cf.addPoolServer(getServerHostName(vm.getHost()), port); + cf.addPoolServer(NetworkUtils.getServerHostName(vm.getHost()), port); cf.setPoolSubscriptionEnabled(true); ClientCache cache = getClientCache(cf); cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY) http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/JSSESocketJUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/JSSESocketJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/JSSESocketJUnitTest.java index 54275dc..c8927b6 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/JSSESocketJUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/JSSESocketJUnitTest.java @@ -48,7 +48,7 @@ import org.junit.rules.TestName; import com.gemstone.gemfire.internal.logging.LogService; import com.gemstone.gemfire.util.test.TestUtil; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; +import com.gemstone.gemfire.test.dunit.ThreadUtils; import com.gemstone.gemfire.test.junit.categories.IntegrationTest; /** @@ -122,7 +122,7 @@ public class JSSESocketJUnitTest { oos.writeObject( expected ); oos.flush(); - DistributedTestCase.join(serverThread, 30 * 1000, null); + ThreadUtils.join(serverThread, 30 * 1000); client.close(); if ( expected.equals( receiver[0] ) ) { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/JarDeployerDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/JarDeployerDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/JarDeployerDUnitTest.java index 99a3053..5895a7d 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/JarDeployerDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/JarDeployerDUnitTest.java @@ -45,6 +45,7 @@ import com.gemstone.gemfire.cache30.CacheTestCase; import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; +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; @@ -65,7 +66,7 @@ public class JarDeployerDUnitTest extends CacheTestCase { } @Override - public void tearDown2() throws Exception { + protected final void preTearDownCacheTestCase() throws Exception { JarDeployer jarDeployer = new JarDeployer(); for (JarClassLoader jarClassLoader : jarDeployer.findJarClassLoaders()) { if (jarClassLoader.getJarName().startsWith("JarDeployerDUnit")) { @@ -79,7 +80,6 @@ public class JarDeployerDUnitTest extends CacheTestCase { } disconnectAllFromDS(); deleteSavedJarFiles(); - super.tearDown2(); } @Test @@ -194,9 +194,9 @@ public class JarDeployerDUnitTest extends CacheTestCase { fail("Should not have been able to obtain exclusive lock on file:" + jarFile1.getAbsolutePath()); } } catch (FileNotFoundException fnfex) { - fail("JAR file not found where expected", fnfex); + Assert.fail("JAR file not found where expected", fnfex); } catch (IOException ioex) { - fail("IOException when trying to obtain exclusive lock", ioex); + Assert.fail("IOException when trying to obtain exclusive lock", ioex); } finally { if (outStream != null) { try { @@ -628,7 +628,7 @@ public class JarDeployerDUnitTest extends CacheTestCase { randomAccessFile.write("GARBAGE".getBytes(), 0, 7); randomAccessFile.close(); } catch (IOException ioex) { - fail("Error trying to create garbage file for test", ioex); + Assert.fail("Error trying to create garbage file for test", ioex); } getSystem(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/PdxDeleteFieldDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/PdxDeleteFieldDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/PdxDeleteFieldDUnitTest.java index d805a38..f7b6529 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/PdxDeleteFieldDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/PdxDeleteFieldDUnitTest.java @@ -39,6 +39,7 @@ import com.gemstone.gemfire.pdx.PdxWriter; import com.gemstone.gemfire.pdx.internal.PdxType; import com.gemstone.gemfire.pdx.internal.PdxUnreadData; 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.VM; @@ -171,16 +172,15 @@ public class PdxDeleteFieldDUnitTest extends CacheTestCase{ } @Override - public void tearDown2() throws Exception { + public void preTearDownCacheTestCase() throws Exception { for (String path : this.filesToBeDeleted) { try { FileUtil.delete(new File(path)); } catch (IOException e) { - getLogWriter().error("Unable to delete file", e); + LogWriterUtils.getLogWriter().error("Unable to delete file", e); } } this.filesToBeDeleted.clear(); - super.tearDown2(); } public static class PdxValue implements PdxSerializable { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/PdxRenameDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/PdxRenameDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/PdxRenameDUnitTest.java index 6303719..f10d953 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/PdxRenameDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/PdxRenameDUnitTest.java @@ -40,6 +40,7 @@ import com.gemstone.gemfire.pdx.internal.EnumInfo; import com.gemstone.gemfire.pdx.internal.PdxInstanceImpl; import com.gemstone.gemfire.pdx.internal.PdxType; 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.VM; @@ -178,16 +179,15 @@ public class PdxRenameDUnitTest extends CacheTestCase{ } @Override - public void tearDown2() throws Exception { + public void preTearDownCacheTestCase() throws Exception { for (String path : this.filesToBeDeleted) { try { FileUtil.delete(new File(path)); } catch (IOException e) { - getLogWriter().error("Unable to delete file", e); + LogWriterUtils.getLogWriter().error("Unable to delete file", e); } } this.filesToBeDeleted.clear(); - super.tearDown2(); } enum Day { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/SocketCloserJUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/SocketCloserJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/SocketCloserJUnitTest.java index 7335528..83f4a08 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/SocketCloserJUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/SocketCloserJUnitTest.java @@ -30,8 +30,8 @@ import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; -import com.gemstone.gemfire.test.dunit.DistributedTestCase.WaitCriterion; +import com.gemstone.gemfire.test.dunit.Wait; +import com.gemstone.gemfire.test.dunit.WaitCriterion; import com.gemstone.gemfire.test.junit.categories.UnitTest; /** @@ -121,7 +121,7 @@ public class SocketCloserJUnitTest { return "expected " + 2*maxThreads + " waiters but found only " + waitingToClose.get(); } }; - DistributedTestCase.waitForCriterion(wc, 5000, 10, true); + Wait.waitForCriterion(wc, 5000, 10, true); } // now count down the latch that allows the sockets to close cdl.countDown(); @@ -141,7 +141,7 @@ public class SocketCloserJUnitTest { return "one or more sockets did not close"; } }; - DistributedTestCase.waitForCriterion(wc, 5000, 10, true); + Wait.waitForCriterion(wc, 5000, 10, true); } } @@ -162,7 +162,7 @@ public class SocketCloserJUnitTest { Socket s = createClosableSocket(); s.close(); this.socketCloser.asyncClose(s, "A", r); - DistributedTestCase.pause(10); + Wait.pause(10); assertEquals(false, runnableCalled.get()); } @@ -190,6 +190,6 @@ public class SocketCloserJUnitTest { return "runnable was not called or socket was not closed"; } }; - DistributedTestCase.waitForCriterion(wc, 5000, 10, true); + Wait.waitForCriterion(wc, 5000, 10, true); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/BackupDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/BackupDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/BackupDUnitTest.java index 6b0493e..a91fb8e 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/BackupDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/BackupDUnitTest.java @@ -50,9 +50,12 @@ import com.gemstone.gemfire.distributed.internal.DistributionMessageObserver; import com.gemstone.gemfire.distributed.internal.ReplyMessage; import com.gemstone.gemfire.internal.FileUtil; import com.gemstone.gemfire.internal.cache.partitioned.PersistentPartitionedRegionTestBase; +import com.gemstone.gemfire.test.dunit.Assert; import com.gemstone.gemfire.test.dunit.AsyncInvocation; import com.gemstone.gemfire.test.dunit.DUnitEnv; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.Invoke; +import com.gemstone.gemfire.test.dunit.LogWriterUtils; import com.gemstone.gemfire.test.dunit.SerializableCallable; import com.gemstone.gemfire.test.dunit.SerializableRunnable; import com.gemstone.gemfire.test.dunit.VM; @@ -72,13 +75,12 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase { } @Override - public void tearDown2() throws Exception { + protected final void preTearDownCacheTestCase() throws Exception { StringBuilder failures = new StringBuilder(); FileUtil.delete(getBackupDir(), failures); if (failures.length() > 0) { - getLogWriter().error(failures.toString()); + LogWriterUtils.getLogWriter().error(failures.toString()); } - super.tearDown2(); } public void testBackupPR() throws Throwable { @@ -87,9 +89,9 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase { VM vm1 = host.getVM(1); VM vm2 = host.getVM(2); - getLogWriter().info("Creating region in VM0"); + LogWriterUtils.getLogWriter().info("Creating region in VM0"); createPersistentRegion(vm0); - getLogWriter().info("Creating region in VM1"); + LogWriterUtils.getLogWriter().info("Creating region in VM1"); createPersistentRegion(vm1); long lm0 = setBackupFiles(vm0); @@ -119,7 +121,7 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase { closeCache(vm1); //Destroy the current data - invokeInEveryVM(new SerializableRunnable("Clean disk dirs") { + Invoke.invokeInEveryVM(new SerializableRunnable("Clean disk dirs") { public void run() { try { cleanDiskDirs(); @@ -131,9 +133,9 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase { restoreBackup(2); - getLogWriter().info("Creating region in VM0"); + LogWriterUtils.getLogWriter().info("Creating region in VM0"); AsyncInvocation async0 = createPersistentRegionAsync(vm0); - getLogWriter().info("Creating region in VM1"); + LogWriterUtils.getLogWriter().info("Creating region in VM1"); AsyncInvocation async1 = createPersistentRegionAsync(vm1); async0.getResult(MAX_WAIT); @@ -154,9 +156,9 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase { VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); - getLogWriter().info("Creating region in VM0"); + LogWriterUtils.getLogWriter().info("Creating region in VM0"); createPersistentRegion(vm0); - getLogWriter().info("Creating region in VM1"); + LogWriterUtils.getLogWriter().info("Creating region in VM1"); createPersistentRegion(vm1); createData(vm0, 0, 5, "A", "region1"); @@ -176,7 +178,7 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase { closeCache(vm1); //Destroy the current data - invokeInEveryVM(new SerializableRunnable("Clean disk dirs") { + Invoke.invokeInEveryVM(new SerializableRunnable("Clean disk dirs") { public void run() { try { cleanDiskDirs(); @@ -188,9 +190,9 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase { restoreBackup(2); - getLogWriter().info("Creating region in VM0"); + LogWriterUtils.getLogWriter().info("Creating region in VM0"); AsyncInvocation async0 = createPersistentRegionAsync(vm0); - getLogWriter().info("Creating region in VM1"); + LogWriterUtils.getLogWriter().info("Creating region in VM1"); AsyncInvocation async1 = createPersistentRegionAsync(vm1); async0.getResult(MAX_WAIT); @@ -219,14 +221,14 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase { final VM vm2 = host.getVM(2); - getLogWriter().info("Creating region in VM0"); + LogWriterUtils.getLogWriter().info("Creating region in VM0"); createPersistentRegion(vm0); //create a bucket on vm0 createData(vm0, 0, 1, "A", "region1"); //create the pr on vm1, which won't have any buckets - getLogWriter().info("Creating region in VM1"); + LogWriterUtils.getLogWriter().info("Creating region in VM1"); createPersistentRegion(vm1); @@ -266,7 +268,7 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase { closeCache(vm1); //Destroy the current data - invokeInEveryVM(new SerializableRunnable("Clean disk dirs") { + Invoke.invokeInEveryVM(new SerializableRunnable("Clean disk dirs") { public void run() { try { cleanDiskDirs(); @@ -278,9 +280,9 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase { restoreBackup(2); - getLogWriter().info("Creating region in VM0"); + LogWriterUtils.getLogWriter().info("Creating region in VM0"); AsyncInvocation async0 = createPersistentRegionAsync(vm0); - getLogWriter().info("Creating region in VM1"); + LogWriterUtils.getLogWriter().info("Creating region in VM1"); AsyncInvocation async1 = createPersistentRegionAsync(vm1); async0.getResult(MAX_WAIT); @@ -379,14 +381,14 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase { }); try { - getLogWriter().info("Creating region in VM0"); + LogWriterUtils.getLogWriter().info("Creating region in VM0"); createPersistentRegion(vm0); //create twos bucket on vm0 createData(vm0, 0, 2, "A", "region1"); //create the pr on vm1, which won't have any buckets - getLogWriter().info("Creating region in VM1"); + LogWriterUtils.getLogWriter().info("Creating region in VM1"); createPersistentRegion(vm1); @@ -402,7 +404,7 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase { results = op.getResults(); assertEquals(1, results.getTotalBucketTransfersCompleted()); } catch (Exception e) { - fail("interupted", e); + Assert.fail("interupted", e); } } }); @@ -416,7 +418,7 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase { closeCache(vm1); //Destroy the current data - invokeInEveryVM(new SerializableRunnable("Clean disk dirs") { + Invoke.invokeInEveryVM(new SerializableRunnable("Clean disk dirs") { public void run() { try { cleanDiskDirs(); @@ -428,9 +430,9 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase { restoreBackup(2); - getLogWriter().info("Creating region in VM0"); + LogWriterUtils.getLogWriter().info("Creating region in VM0"); AsyncInvocation async0 = createPersistentRegionAsync(vm0); - getLogWriter().info("Creating region in VM1"); + LogWriterUtils.getLogWriter().info("Creating region in VM1"); AsyncInvocation async1 = createPersistentRegionAsync(vm1); async0.getResult(MAX_WAIT); @@ -459,9 +461,9 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase { VM vm1 = host.getVM(1); VM vm2 = host.getVM(2); - getLogWriter().info("Creating region in VM0"); + LogWriterUtils.getLogWriter().info("Creating region in VM0"); createPersistentRegion(vm0); - getLogWriter().info("Creating region in VM1"); + LogWriterUtils.getLogWriter().info("Creating region in VM1"); createOverflowRegion(vm1); createData(vm0, 0, 5, "A", "region1"); @@ -484,11 +486,11 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase { VM vm2 = host.getVM(2); VM vm3 = host.getVM(3); - getLogWriter().info("Creating region in VM0"); + LogWriterUtils.getLogWriter().info("Creating region in VM0"); createPersistentRegion(vm0); - getLogWriter().info("Creating region in VM1"); + LogWriterUtils.getLogWriter().info("Creating region in VM1"); createPersistentRegion(vm1); - getLogWriter().info("Creating region in VM2"); + LogWriterUtils.getLogWriter().info("Creating region in VM2"); createPersistentRegion(vm2); createData(vm0, 0, 5, "A", "region1"); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug33359DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug33359DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug33359DUnitTest.java index aa2a9b2..d6ff35c 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug33359DUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug33359DUnitTest.java @@ -36,6 +36,7 @@ import com.gemstone.gemfire.cache30.CacheSerializableRunnable; import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.test.dunit.DistributedTestCase; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.LogWriterUtils; import com.gemstone.gemfire.test.dunit.VM; /** @@ -67,16 +68,16 @@ public class Bug33359DUnitTest extends DistributedTestCase { VM vm1 = host.getVM(1); vm0.invoke(Bug33359DUnitTest.class, "createCacheVM0"); vm1.invoke(Bug33359DUnitTest.class, "createCacheVM1"); - getLogWriter().fine("Cache created in successfully"); + LogWriterUtils.getLogWriter().fine("Cache created in successfully"); } - public void tearDown2(){ - Host host = Host.getHost(0); - VM vm0 = host.getVM(0); - VM vm1 = host.getVM(1); - vm0.invoke(Bug33359DUnitTest.class, "closeCache"); - vm1.invoke(Bug33359DUnitTest.class, "closeCache"); - + @Override + protected final void preTearDown(){ + Host host = Host.getHost(0); + VM vm0 = host.getVM(0); + VM vm1 = host.getVM(1); + vm0.invoke(Bug33359DUnitTest.class, "closeCache"); + vm1.invoke(Bug33359DUnitTest.class, "closeCache"); } public static void createCacheVM0(){ @@ -140,7 +141,7 @@ public class Bug33359DUnitTest extends DistributedTestCase { for(int i=0; i<10; i++){ region.put(new Integer(i), Integer.toString(i)); } - getLogWriter().fine("Did all puts successfully"); + LogWriterUtils.getLogWriter().fine("Did all puts successfully"); } } ); @@ -148,7 +149,7 @@ public class Bug33359DUnitTest extends DistributedTestCase { vm0.invoke(new CacheSerializableRunnable("perform clear on region"){ public void run2() throws CacheException { region.clear(); - getLogWriter().fine("region is cleared"); + LogWriterUtils.getLogWriter().fine("region is cleared"); } } ); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug33726DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug33726DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug33726DUnitTest.java index 08cb340..5e7903e 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug33726DUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug33726DUnitTest.java @@ -44,7 +44,8 @@ public class Bug33726DUnitTest extends DistributedTestCase { super(name); } - public void tearDown2() { + @Override + protected final void preTearDown() throws Exception { Host host = Host.getHost(0); 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/Bug37241DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug37241DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug37241DUnitTest.java index 4ad5133..3726ae8 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug37241DUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug37241DUnitTest.java @@ -31,6 +31,7 @@ import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.distributed.internal.ReplyException; import com.gemstone.gemfire.test.dunit.DistributedTestCase; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.LogWriterUtils; import com.gemstone.gemfire.test.dunit.VM; /* @@ -155,10 +156,10 @@ public class Bug37241DUnitTest extends DistributedTestCase .getName()); //added for not to log exepected IllegalStateExcepion. - getLogWriter().info( + LogWriterUtils.getLogWriter().info( "<ExpectedException action=add>" + expectedReplyException + "</ExpectedException>"); - getLogWriter().info( + LogWriterUtils.getLogWriter().info( "<ExpectedException action=add>" + expectedException + "</ExpectedException>"); cache.getLogger().info( @@ -199,10 +200,10 @@ public class Bug37241DUnitTest extends DistributedTestCase cache.getLogger().info( "<ExpectedException action=remove>" + expectedReplyException + "</ExpectedException>"); - getLogWriter().info( + LogWriterUtils.getLogWriter().info( "<ExpectedException action=remove>" + expectedException + "</ExpectedException>"); - getLogWriter().info( + LogWriterUtils.getLogWriter().info( "<ExpectedException action=remove>" + expectedReplyException + "</ExpectedException>"); } @@ -222,12 +223,11 @@ public class Bug37241DUnitTest extends DistributedTestCase } } - public void tearDown2() throws Exception - { + @Override + protected final void preTearDown() throws Exception { server1.invoke(Bug37241DUnitTest.class, "closeCache"); server2.invoke(Bug37241DUnitTest.class, "closeCache"); } - } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug37377DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug37377DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug37377DUnitTest.java index f7a2911..766ecd4 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug37377DUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug37377DUnitTest.java @@ -34,10 +34,11 @@ import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.internal.cache.lru.EnableLRU; import com.gemstone.gemfire.internal.util.concurrent.CustomEntryConcurrentHashMap.HashEntry; 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.SerializableRunnable; +import com.gemstone.gemfire.test.dunit.ThreadUtils; import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.Wait; /** * Bug37377 DUNIT Test: The Clear operation during a GII in progress can leave a @@ -94,13 +95,12 @@ public class Bug37377DUnitTest extends CacheTestCase } - public void tearDown2() throws Exception + @Override + protected final void preTearDownCacheTestCase() throws Exception { vm1.invoke(destroyRegion()); vm0.invoke(destroyRegion()); - - super.tearDown2(); } /** @@ -313,8 +313,8 @@ public class Bug37377DUnitTest extends CacheTestCase vm0.invoke(createCacheForVM0()); vm0.invoke(putSomeEntries()); AsyncInvocation as1 = vm1.invokeAsync(createCacheForVM1()); - pause(10000); - DistributedTestCase.join(as1, 30 * 1000, getLogWriter()); + Wait.pause(10000); + ThreadUtils.join(as1, 30 * 1000); vm0.invoke(closeCacheForVM(0)); vm1.invoke(closeCacheForVM(1)); vm1.invoke(createCacheForVM1()); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug39079DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug39079DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug39079DUnitTest.java index cc07a3a..532b806 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug39079DUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug39079DUnitTest.java @@ -43,7 +43,9 @@ import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.cache.persistence.UninterruptibleFileChannel; +import com.gemstone.gemfire.test.dunit.Assert; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.NetworkUtils; import com.gemstone.gemfire.test.dunit.SerializableRunnable; import com.gemstone.gemfire.test.dunit.VM; @@ -175,12 +177,9 @@ public class Bug39079DUnitTest extends CacheTestCase { }; return (CacheSerializableRunnable)createCache; } - - - - public void tearDown2() throws Exception { - super.tearDown2(); + @Override + protected final void postTearDownCacheTestCase() throws Exception { disconnectAllFromDS(); vm0.invoke(Bug39079DUnitTest.class, "ignorePreAllocate", new Object[] { Boolean.FALSE }); @@ -307,7 +306,7 @@ public class Bug39079DUnitTest extends CacheTestCase { Integer port = (Integer)vm0.invoke(Bug39079DUnitTest.class, "createServerCache"); //create cache client vm1.invoke(Bug39079DUnitTest.class, "createClientCache", - new Object[] { getServerHostName(vm0.getHost()), port}); + new Object[] { NetworkUtils.getServerHostName(vm0.getHost()), port}); // validate vm0.invoke(Bug39079DUnitTest.class, "validateRuningBridgeServerList"); @@ -370,7 +369,7 @@ public class Bug39079DUnitTest extends CacheTestCase { }catch(DiskAccessException dae) { //OK expected }catch (IOException e) { - fail("test failed due to ", e); + Assert.fail("test failed due to ", e); } ((LocalRegion) region).getDiskStore().waitForClose(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug40299DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug40299DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug40299DUnitTest.java index e2d7eb7..60f9bd5 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug40299DUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug40299DUnitTest.java @@ -41,6 +41,7 @@ import com.gemstone.gemfire.internal.cache.SearchLoadAndWriteProcessor; 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.IgnoredException; import com.gemstone.gemfire.test.dunit.SerializableRunnable; import com.gemstone.gemfire.test.dunit.VM; @@ -83,10 +84,10 @@ public class Bug40299DUnitTest extends CacheTestCase vm0 = host.getVM(0); } - public void tearDown2() throws Exception + @Override + protected final void preTearDownCacheTestCase() throws Exception { vm0.invoke(destroyRegion()); - super.tearDown2(); } /** @@ -290,7 +291,7 @@ public class Bug40299DUnitTest extends CacheTestCase public void testQueryGetWithClear() { - addExpectedException("Entry has been cleared and is not present on disk"); + IgnoredException.addIgnoredException("Entry has been cleared and is not present on disk"); // create region in VM0 vm0.invoke(createCacheForVM0()); // Do puts to region. http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41091DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41091DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41091DUnitTest.java index e023ed4..a03f035 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41091DUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41091DUnitTest.java @@ -34,7 +34,10 @@ import com.gemstone.gemfire.distributed.internal.DistributionMessage; import com.gemstone.gemfire.distributed.internal.DistributionMessageObserver; import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.cache.InitialImageOperation.RequestImageMessage; +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.SerializableRunnable; import com.gemstone.gemfire.test.dunit.VM; @@ -55,8 +58,7 @@ public class Bug41091DUnitTest extends CacheTestCase { } @Override - public void tearDown2() throws Exception { - super.tearDown2(); + protected final void postTearDownCacheTestCase() throws Exception { disconnectAllFromDS(); } @@ -96,7 +98,7 @@ public class Bug41091DUnitTest extends CacheTestCase { Properties props = new Properties(); props.setProperty(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "true"); - props.setProperty(DistributionConfig.LOCATORS_NAME, getServerHostName(host) + "[" + locatorPort + "]"); + props.setProperty(DistributionConfig.LOCATORS_NAME, NetworkUtils.getServerHostName(host) + "[" + locatorPort + "]"); getSystem(props); @@ -116,7 +118,7 @@ public class Bug41091DUnitTest extends CacheTestCase { public void run() { Properties props = new Properties(); props.setProperty(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "true"); - props.setProperty(DistributionConfig.LOCATORS_NAME, getServerHostName(host) + "[" + locatorPort + "]"); + props.setProperty(DistributionConfig.LOCATORS_NAME, NetworkUtils.getServerHostName(host) + "[" + locatorPort + "]"); getSystem(props); Cache cache = getCache(); AttributesFactory af = new AttributesFactory(); @@ -150,7 +152,7 @@ public class Bug41091DUnitTest extends CacheTestCase { disconnectFromDS(); Properties props = new Properties(); props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0)); - props.setProperty(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel()); + props.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel()); props.setProperty(DistributionConfig.ENABLE_NETWORK_PARTITION_DETECTION_NAME, "true"); props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); try { @@ -158,13 +160,13 @@ public class Bug41091DUnitTest extends CacheTestCase { + ".log"); InetAddress bindAddr = null; try { - bindAddr = InetAddress.getByName(getServerHostName(vm.getHost())); + bindAddr = InetAddress.getByName(NetworkUtils.getServerHostName(vm.getHost())); } catch (UnknownHostException uhe) { - fail("While resolving bind address ", uhe); + Assert.fail("While resolving bind address ", uhe); } Locator locator = Locator.startLocatorAndDS(locatorPort, logFile, bindAddr, props); } catch (IOException ex) { - fail("While starting locator on port " + locatorPort, ex); + Assert.fail("While starting locator on port " + locatorPort, ex); } } }); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41733DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41733DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41733DUnitTest.java index 2679d45..58179f2 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41733DUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41733DUnitTest.java @@ -58,9 +58,8 @@ public class Bug41733DUnitTest extends CacheTestCase { @Override - public void tearDown2() throws Exception { + protected final void preTearDownCacheTestCase() throws Exception { disconnectAllFromDS(); - super.tearDown2(); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41957DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41957DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41957DUnitTest.java index 1cdf92e..a16a9c3 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41957DUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug41957DUnitTest.java @@ -34,7 +34,10 @@ import com.gemstone.gemfire.cache30.CacheSerializableRunnable; import com.gemstone.gemfire.cache30.ClientServerTestCase; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.AvailablePort; +import com.gemstone.gemfire.test.dunit.Assert; +import com.gemstone.gemfire.test.dunit.DistributedTestUtils; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.NetworkUtils; import com.gemstone.gemfire.test.dunit.VM; /** @@ -52,8 +55,8 @@ import com.gemstone.gemfire.test.dunit.VM; super(name); } - public void tearDown2() throws Exception { - super.tearDown2(); + @Override + protected final void postTearDownCacheTestCase() throws Exception { disconnectAllFromDS(); } @@ -63,7 +66,7 @@ import com.gemstone.gemfire.test.dunit.VM; final VM client = host.getVM(1); final String regionName = getUniqueName(); final int serverPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); - final String serverHost = getServerHostName(server.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server.getHost()); createBridgeServer(server, regionName, serverPort, false); @@ -88,7 +91,7 @@ import com.gemstone.gemfire.test.dunit.VM; public void run2() throws CacheException { // Create DS Properties config = new Properties(); - config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]"); + config.setProperty("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]"); getSystem(config); // Create Region @@ -112,7 +115,7 @@ import com.gemstone.gemfire.test.dunit.VM; try { startBridgeServer(serverPort); } catch (Exception e) { - fail("While starting CacheServer", e); + Assert.fail("While starting CacheServer", e); } } }); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug45164DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug45164DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug45164DUnitTest.java index a2e9c5d..371df3f 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug45164DUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug45164DUnitTest.java @@ -25,6 +25,7 @@ import com.gemstone.gemfire.cache.RegionShortcut; import com.gemstone.gemfire.cache30.CacheTestCase; 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; public class Bug45164DUnitTest extends CacheTestCase { @@ -78,7 +79,7 @@ public class Bug45164DUnitTest extends CacheTestCase { Cache cache = getCache(new CacheFactory()); Region<Integer, Object> region = cache.<Integer, Object>createRegionFactory(RegionShortcut.PARTITION).create("test"); if (region == null) { - getLogWriter().error("oops!"); + LogWriterUtils.getLogWriter().error("oops!"); } } }; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug47667DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug47667DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug47667DUnitTest.java index 40ba9ea..097aeb5 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug47667DUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug47667DUnitTest.java @@ -25,6 +25,7 @@ import com.gemstone.gemfire.cache.client.PoolManager; import com.gemstone.gemfire.cache.client.internal.LocatorTestBase; import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.NetworkUtils; import com.gemstone.gemfire.test.dunit.SerializableCallable; import com.gemstone.gemfire.test.dunit.VM; @@ -43,8 +44,7 @@ public class Bug47667DUnitTest extends LocatorTestBase { } @Override - public void tearDown2() throws Exception { - super.tearDown2(); + protected final void postTearDownLocatorTestBase() throws Exception { disconnectAllFromDS(); } @@ -56,7 +56,7 @@ public class Bug47667DUnitTest extends LocatorTestBase { VM client = host.getVM(3); final int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); - final String locatorHost = getServerHostName(host); + final String locatorHost = NetworkUtils.getServerHostName(host); startLocatorInVM(locator, locatorPort, ""); String locString = getLocatorString(host, locatorPort); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/CacheAdvisorDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/CacheAdvisorDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/CacheAdvisorDUnitTest.java index 66a7880..eb64e93 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/CacheAdvisorDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/CacheAdvisorDUnitTest.java @@ -40,6 +40,7 @@ import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.Invoke; import com.gemstone.gemfire.test.dunit.VM; /** @@ -174,7 +175,7 @@ public class CacheAdvisorDUnitTest extends CacheTestCase { RegionAttributes attrs = fac.create(); DistributedRegion rgn = (DistributedRegion)createRegion(rgnName, attrs); - invokeInEveryVM(new CacheSerializableRunnable("CachAdvisorTest.testNetLoadAdviceWithAttributesMutator;createRegion") { + Invoke.invokeInEveryVM(new CacheSerializableRunnable("CachAdvisorTest.testNetLoadAdviceWithAttributesMutator;createRegion") { public void run2() throws CacheException { AttributesFactory f = new AttributesFactory(); f.setScope(Scope.DISTRIBUTED_ACK); @@ -231,7 +232,7 @@ public class CacheAdvisorDUnitTest extends CacheTestCase { final InternalDistributedMember myMemberId = getSystem().getDistributionManager().getId(); // assert that other VMs advisors have test member id - invokeInEveryVM(new CacheSerializableRunnable("CacheAdvisorDUnitTest.basicTestClose;verify1") { + Invoke.invokeInEveryVM(new CacheSerializableRunnable("CacheAdvisorDUnitTest.basicTestClose;verify1") { public void run2() throws CacheException { DistributedRegion rgn1 = (DistributedRegion)getRootRegion(); assertTrue(rgn1.getDistributionAdvisor().adviseGeneric().contains(myMemberId)); @@ -249,7 +250,7 @@ public class CacheAdvisorDUnitTest extends CacheTestCase { fail("expected op(" + op + ") to be CACHE_CLOSE, REGION_CLOSE, or REGION_LOCAL_DESTROY"); } final InternalDistributedMember closedMemberId = getSystem().getDistributionManager().getId(); - invokeInEveryVM(new CacheSerializableRunnable("CacheAdvisorDUnitTest.basicTestClose;verify") { + Invoke.invokeInEveryVM(new CacheSerializableRunnable("CacheAdvisorDUnitTest.basicTestClose;verify") { public void run2() throws CacheException { DistributedRegion rgn1 = (DistributedRegion)getRootRegion(); assertTrue(!rgn1.getDistributionAdvisor().adviseGeneric().contains(closedMemberId)); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ClearDAckDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ClearDAckDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ClearDAckDUnitTest.java index 39e7604..dabc277 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ClearDAckDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ClearDAckDUnitTest.java @@ -38,6 +38,8 @@ import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.internal.cache.versions.VersionSource; import com.gemstone.gemfire.test.dunit.DistributedTestCase; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.Invoke; +import com.gemstone.gemfire.test.dunit.LogWriterUtils; import com.gemstone.gemfire.test.dunit.SerializableRunnable; import com.gemstone.gemfire.test.dunit.VM; @@ -71,20 +73,21 @@ public class ClearDAckDUnitTest extends DistributedTestCase { VM vm1 = host.getVM(1); vm0ID = (DistributedMember)vm0.invoke(ClearDAckDUnitTest.class, "createCacheVM0"); vm1ID = (DistributedMember)vm1.invoke(ClearDAckDUnitTest.class, "createCacheVM1"); - getLogWriter().info("Cache created in successfully"); + LogWriterUtils.getLogWriter().info("Cache created in successfully"); } - public void tearDown2(){ - Host host = Host.getHost(0); - VM vm0 = host.getVM(0); - VM vm1 = host.getVM(1); - VM vm2 = host.getVM(2); - vm0.invoke(ClearDAckDUnitTest.class, "closeCache"); - vm1.invoke(ClearDAckDUnitTest.class, "resetClearCallBack"); - vm1.invoke(ClearDAckDUnitTest.class, "closeCache"); - vm2.invoke(ClearDAckDUnitTest.class, "closeCache"); - cache = null; - invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } }); + @Override + protected final void preTearDown() throws Exception { + Host host = Host.getHost(0); + VM vm0 = host.getVM(0); + VM vm1 = host.getVM(1); + VM vm2 = host.getVM(2); + vm0.invoke(ClearDAckDUnitTest.class, "closeCache"); + vm1.invoke(ClearDAckDUnitTest.class, "resetClearCallBack"); + vm1.invoke(ClearDAckDUnitTest.class, "closeCache"); + vm2.invoke(ClearDAckDUnitTest.class, "closeCache"); + cache = null; + Invoke.invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } }); } public static long getRegionVersion(DistributedMember memberID) { @@ -102,7 +105,7 @@ public class ClearDAckDUnitTest extends DistributedTestCase { try{ // props.setProperty("mcast-port", "1234"); // ds = DistributedSystem.connect(props); - getLogWriter().info("I am vm0"); + LogWriterUtils.getLogWriter().info("I am vm0"); ds = (new ClearDAckDUnitTest("temp")).getSystem(props); cache = CacheFactory.create(ds); @@ -116,7 +119,7 @@ public class ClearDAckDUnitTest extends DistributedTestCase { RegionAttributes attr = factory.create(); region = cache.createRegion("map", attr); - getLogWriter().info("vm0 map region: " + region); + LogWriterUtils.getLogWriter().info("vm0 map region: " + region); paperWork = cache.createRegion("paperWork", attr); return cache.getDistributedSystem().getDistributedMember(); } catch (CacheException ex){ @@ -127,7 +130,7 @@ public class ClearDAckDUnitTest extends DistributedTestCase { try{ // props.setProperty("mcast-port", "1234"); // ds = DistributedSystem.connect(props); - getLogWriter().info("I am vm1"); + LogWriterUtils.getLogWriter().info("I am vm1"); ds = (new ClearDAckDUnitTest("temp")).getSystem(props); //DistributedSystem.setThreadsSocketPolicy(false); CacheObserverImpl observer = new CacheObserverImpl(); @@ -143,7 +146,7 @@ public class ClearDAckDUnitTest extends DistributedTestCase { RegionAttributes attr = factory.create(); region = cache.createRegion("map", attr); - getLogWriter().info("vm1 map region: " + region); + LogWriterUtils.getLogWriter().info("vm1 map region: " + region); paperWork = cache.createRegion("paperWork", attr); return cache.getDistributedSystem().getDistributedMember(); @@ -156,7 +159,7 @@ public class ClearDAckDUnitTest extends DistributedTestCase { try{ // props.setProperty("mcast-port", "1234"); // ds = DistributedSystem.connect(props); - getLogWriter().info("I am vm2"); + LogWriterUtils.getLogWriter().info("I am vm2"); ds = (new ClearDAckDUnitTest("temp")).getSystem(props); //DistributedSystem.setThreadsSocketPolicy(false); CacheObserverImpl observer = new CacheObserverImpl(); @@ -172,7 +175,7 @@ public class ClearDAckDUnitTest extends DistributedTestCase { RegionAttributes attr = factory.create(); region = cache.createRegion("map", attr); - getLogWriter().info("vm2 map region: " + region); + LogWriterUtils.getLogWriter().info("vm2 map region: " + region); paperWork = cache.createRegion("paperWork", attr); region.put("vm2Key", "vm2Value"); @@ -207,14 +210,14 @@ public class ClearDAckDUnitTest extends DistributedTestCase { vm0.invoke(ClearDAckDUnitTest.class, "putMethod", objArr); } - getLogWriter().info("Did all puts successfully"); + LogWriterUtils.getLogWriter().info("Did all puts successfully"); long regionVersion = (Long)vm1.invoke(ClearDAckDUnitTest.class, "getRegionVersion", new Object[]{vm0ID}); vm0.invoke(ClearDAckDUnitTest.class,"clearMethod"); boolean flag = vm1.invokeBoolean(ClearDAckDUnitTest.class,"getVM1Flag"); - getLogWriter().fine("Flag in VM1="+ flag); + LogWriterUtils.getLogWriter().fine("Flag in VM1="+ flag); assertTrue(flag); @@ -226,7 +229,7 @@ public class ClearDAckDUnitTest extends DistributedTestCase { vm2.invoke(ClearDAckDUnitTest.class, "createCacheVM2AndLocalClear"); flag = vm1.invokeBoolean(ClearDAckDUnitTest.class,"getVM1Flag"); - getLogWriter().fine("Flag in VM1="+ flag); + LogWriterUtils.getLogWriter().fine("Flag in VM1="+ flag); assertFalse(flag); }//end of test case @@ -255,7 +258,7 @@ public class ClearDAckDUnitTest extends DistributedTestCase { long end = System.currentTimeMillis(); long diff = end - start; - getLogWriter().info("Clear Thread proceeded before receiving the ack message in (milli seconds): "+diff); + LogWriterUtils.getLogWriter().info("Clear Thread proceeded before receiving the ack message in (milli seconds): "+diff); }catch (Exception e){ e.printStackTrace(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ClearGlobalDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ClearGlobalDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ClearGlobalDUnitTest.java index 29b54df..54df822 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ClearGlobalDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ClearGlobalDUnitTest.java @@ -35,6 +35,8 @@ import com.gemstone.gemfire.internal.cache.CacheObserverAdapter; import com.gemstone.gemfire.internal.cache.CacheObserverHolder; 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.ThreadUtils; import com.gemstone.gemfire.test.dunit.VM; import java.util.Properties; @@ -80,11 +82,11 @@ public class ClearGlobalDUnitTest extends DistributedTestCase server1 = host.getVM(0); server1.invoke(ClearGlobalDUnitTest.class, "createCacheServer1"); createCacheServer2(); - getLogWriter().fine("Cache created in successfully"); + LogWriterUtils.getLogWriter().fine("Cache created in successfully"); } - public void tearDown2() - { + @Override + protected final void preTearDown() throws Exception { server1.invoke(ClearGlobalDUnitTest.class, "closeCache"); resetClearCallBack(); closeCache(); @@ -172,7 +174,7 @@ public class ClearGlobalDUnitTest extends DistributedTestCase throw new Exception("Test Failed: " + exceptionMsg); } else{ - getLogWriter().info("Test Passed Successfully "); + LogWriterUtils.getLogWriter().info("Test Passed Successfully "); } } @@ -182,7 +184,7 @@ public class ClearGlobalDUnitTest extends DistributedTestCase { Thread th = new PutThread(); th.start(); - DistributedTestCase.join(th, 5 * 60 * 1000, getLogWriter()); + ThreadUtils.join(th, 5 * 60 * 1000); synchronized (lock) { testComplete = true; lock.notify(); @@ -202,7 +204,7 @@ public class ClearGlobalDUnitTest extends DistributedTestCase catch (TimeoutException ex) { //pass testFailed = false; - getLogWriter().info("Expected TimeoutException in thread "); + LogWriterUtils.getLogWriter().info("Expected TimeoutException in thread "); } catch (Exception ex) { exceptionMsg.append(" Exception occurred while region.put(key,value)");