Return-Path: X-Original-To: apmail-geode-commits-archive@minotaur.apache.org Delivered-To: apmail-geode-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 44B1B18628 for ; Tue, 2 Feb 2016 20:21:29 +0000 (UTC) Received: (qmail 70827 invoked by uid 500); 2 Feb 2016 20:21:26 -0000 Delivered-To: apmail-geode-commits-archive@geode.apache.org Received: (qmail 70797 invoked by uid 500); 2 Feb 2016 20:21:26 -0000 Mailing-List: contact commits-help@geode.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.incubator.apache.org Delivered-To: mailing list commits@geode.incubator.apache.org Received: (qmail 70788 invoked by uid 99); 2 Feb 2016 20:21:26 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Feb 2016 20:21:26 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 91673C0179 for ; Tue, 2 Feb 2016 20:21:25 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.227 X-Spam-Level: * X-Spam-Status: No, score=1.227 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.553] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id lZg1Wy_utJGr for ; Tue, 2 Feb 2016 20:21:12 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with SMTP id AD19B31ADD for ; Tue, 2 Feb 2016 20:21:09 +0000 (UTC) Received: (qmail 68865 invoked by uid 99); 2 Feb 2016 20:21:08 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Feb 2016 20:21:08 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A6949DFDEC; Tue, 2 Feb 2016 20:21:08 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: klund@apache.org To: commits@geode.incubator.apache.org Date: Tue, 02 Feb 2016 20:21:11 -0000 Message-Id: In-Reply-To: <8084d27559034992a68abed5afa94685@git.apache.org> References: <8084d27559034992a68abed5afa94685@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [04/44] incubator-geode git commit: Refactor dunit http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderDUnitTest.java b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderDUnitTest.java index c14af54..ad80a7e 100644 --- a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderDUnitTest.java +++ b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderDUnitTest.java @@ -25,6 +25,9 @@ import com.gemstone.gemfire.internal.cache.wan.BatchException70; import com.gemstone.gemfire.internal.cache.wan.WANTestBase; import com.gemstone.gemfire.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderEventProcessor; import com.gemstone.gemfire.test.dunit.AsyncInvocation; +import com.gemstone.gemfire.test.dunit.IgnoredException; +import com.gemstone.gemfire.test.dunit.LogWriterSupport; +import com.gemstone.gemfire.test.dunit.Wait; import java.net.SocketException; import java.util.Set; @@ -509,7 +512,7 @@ public class ConcurrentParallelGatewaySenderDUnitTest extends WANTestBase { Integer regionSize = (Integer) vm2.invoke(WANTestBase.class, "getRegionSize", new Object[] {testName + "_PR" }); - getLogWriter().info("Region size on remote is: " + regionSize); + LogWriterSupport.getLogWriter().info("Region size on remote is: " + regionSize); vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort }); vm5.invoke(WANTestBase.class, "createCache", new Object[] { lnPort }); @@ -550,9 +553,9 @@ public class ConcurrentParallelGatewaySenderDUnitTest extends WANTestBase { vm7.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); //------------------------------------------------------------------------------------ - addExpectedException(EntryExistsException.class.getName()); - addExpectedException(BatchException70.class.getName()); - addExpectedException(ServerOperationException.class.getName()); + IgnoredException.addIgnoredException(EntryExistsException.class.getName()); + IgnoredException.addIgnoredException(BatchException70.class.getName()); + IgnoredException.addIgnoredException(ServerOperationException.class.getName()); vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_PR", 10000 }); @@ -688,7 +691,7 @@ public class ConcurrentParallelGatewaySenderDUnitTest extends WANTestBase { } public void testPartitionedParallelPropagationHA() throws Exception { - addExpectedException(SocketException.class.getName()); // for Connection reset + IgnoredException.addIgnoredException(SocketException.class.getName()); // for Connection reset Integer lnPort = (Integer)vm0.invoke(WANTestBase.class, "createFirstLocatorWithDSId", new Object[] { 1 }); Integer nyPort = (Integer)vm1.invoke(WANTestBase.class, @@ -737,11 +740,11 @@ public class ConcurrentParallelGatewaySenderDUnitTest extends WANTestBase { AsyncInvocation inv1 = vm7.invokeAsync(WANTestBase.class, "doPuts", new Object[] { testName + "_PR", 5000 }); - pause(500); + Wait.pause(500); AsyncInvocation inv2 = vm4.invokeAsync(WANTestBase.class, "killSender"); AsyncInvocation inv3 = vm6.invokeAsync(WANTestBase.class, "doPuts", new Object[] { testName + "_PR", 10000 }); - pause(1500); + Wait.pause(1500); AsyncInvocation inv4 = vm5.invokeAsync(WANTestBase.class, "killSender"); inv1.join(); inv2.join(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_1_DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_1_DUnitTest.java b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_1_DUnitTest.java index e0775b7..43d7c75 100644 --- a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_1_DUnitTest.java +++ b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_1_DUnitTest.java @@ -19,6 +19,9 @@ package com.gemstone.gemfire.internal.cache.wan.concurrent; import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy; import com.gemstone.gemfire.internal.cache.wan.WANTestBase; import com.gemstone.gemfire.test.dunit.AsyncInvocation; +import com.gemstone.gemfire.test.dunit.IgnoredException; +import com.gemstone.gemfire.test.dunit.LogWriterSupport; +import com.gemstone.gemfire.test.dunit.Wait; /** * @author skumar @@ -33,9 +36,9 @@ public class ConcurrentParallelGatewaySenderOperation_1_DUnitTest extends WANTes public void setUp() throws Exception { super.setUp(); - addExpectedException("Broken pipe"); - addExpectedException("Connection reset"); - addExpectedException("Unexpected IOException"); + IgnoredException.addIgnoredException("Broken pipe"); + IgnoredException.addIgnoredException("Connection reset"); + IgnoredException.addIgnoredException("Unexpected IOException"); } public void testParallelGatewaySenderWithoutStarting() { @@ -132,7 +135,7 @@ public class ConcurrentParallelGatewaySenderOperation_1_DUnitTest extends WANTes vm6.invoke(WANTestBase.class, "startSender", new Object[] { "ln" }); vm7.invoke(WANTestBase.class, "startSender", new Object[] { "ln" }); - pause(2000); + Wait.pause(2000); vm6.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); vm7.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); @@ -207,7 +210,7 @@ public class ConcurrentParallelGatewaySenderOperation_1_DUnitTest extends WANTes vm5.invoke(WANTestBase.class, "pauseSender", new Object[] { "ln" }); vm6.invoke(WANTestBase.class, "pauseSender", new Object[] { "ln" }); vm7.invoke(WANTestBase.class, "pauseSender", new Object[] { "ln" }); - pause(2000); + Wait.pause(2000); //SECOND RUN: keep one thread doing puts to the region vm4.invokeAsync(WANTestBase.class, "doPuts", new Object[] { testName + "_PR", 1000 }); @@ -277,7 +280,7 @@ public class ConcurrentParallelGatewaySenderOperation_1_DUnitTest extends WANTes vm7.invoke(WANTestBase.class, "pauseSender", new Object[] { "ln" }); //sleep for a second or two - pause(2000); + Wait.pause(2000); //resume the senders vm4.invoke(WANTestBase.class, "resumeSender", new Object[] { "ln" }); @@ -285,7 +288,7 @@ public class ConcurrentParallelGatewaySenderOperation_1_DUnitTest extends WANTes vm6.invoke(WANTestBase.class, "resumeSender", new Object[] { "ln" }); vm7.invoke(WANTestBase.class, "resumeSender", new Object[] { "ln" }); - pause(2000); + Wait.pause(2000); vm4.invoke(WANTestBase.class, "validateParallelSenderQueueAllBucketsDrained", new Object[] {"ln"}); vm5.invoke(WANTestBase.class, "validateParallelSenderQueueAllBucketsDrained", new Object[] {"ln"}); @@ -488,7 +491,7 @@ public class ConcurrentParallelGatewaySenderOperation_1_DUnitTest extends WANTes vm6.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" }); vm7.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" }); - pause(2000); + Wait.pause(2000); //SECOND RUN: do some of the puts after the senders are stopped vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_PR", 1000 }); @@ -583,12 +586,12 @@ public class ConcurrentParallelGatewaySenderOperation_1_DUnitTest extends WANTes vm6.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); vm7.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); - getLogWriter().info("All the senders are now started"); + LogWriterSupport.getLogWriter().info("All the senders are now started"); //FIRST RUN: now, the senders are started. So, do some of the puts vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_PR", 200 }); - getLogWriter().info("Done few puts"); + LogWriterSupport.getLogWriter().info("Done few puts"); //now, stop all of the senders vm4.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" }); @@ -596,32 +599,32 @@ public class ConcurrentParallelGatewaySenderOperation_1_DUnitTest extends WANTes vm6.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" }); vm7.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" }); - getLogWriter().info("All the senders are stopped"); - pause(2000); + LogWriterSupport.getLogWriter().info("All the senders are stopped"); + Wait.pause(2000); //SECOND RUN: do some of the puts after the senders are stopped vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_PR", 1000 }); - getLogWriter().info("Done some more puts in second run"); + LogWriterSupport.getLogWriter().info("Done some more puts in second run"); //Region size on remote site should remain same and below the number of puts done in the FIRST RUN vm2.invoke(WANTestBase.class, "validateRegionSizeRemainsSame", new Object[] {testName + "_PR", 200 }); //SECOND RUN: start async puts on region AsyncInvocation async = vm4.invokeAsync(WANTestBase.class, "doPuts", new Object[] { testName + "_PR", 5000 }); - getLogWriter().info("Started high number of puts by async thread"); + LogWriterSupport.getLogWriter().info("Started high number of puts by async thread"); - getLogWriter().info("Starting the senders at the same time"); + LogWriterSupport.getLogWriter().info("Starting the senders at the same time"); //when puts are happening by another thread, start the senders vm4.invokeAsync(WANTestBase.class, "startSender", new Object[] { "ln" }); vm5.invokeAsync(WANTestBase.class, "startSender", new Object[] { "ln" }); vm6.invokeAsync(WANTestBase.class, "startSender", new Object[] { "ln" }); vm7.invokeAsync(WANTestBase.class, "startSender", new Object[] { "ln" }); - getLogWriter().info("All the senders are started"); + LogWriterSupport.getLogWriter().info("All the senders are started"); async.join(); - pause(2000); + Wait.pause(2000); //verify all the buckets on all the sender nodes are drained vm4.invoke(WANTestBase.class, "validateParallelSenderQueueAllBucketsDrained", new Object[] {"ln"}); @@ -695,7 +698,7 @@ public class ConcurrentParallelGatewaySenderOperation_1_DUnitTest extends WANTes vm6.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" }); vm7.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" }); - pause(2000); + Wait.pause(2000); //SECOND RUN: do some of the puts after the senders are stopped vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_PR", 1000 }); @@ -720,7 +723,7 @@ public class ConcurrentParallelGatewaySenderOperation_1_DUnitTest extends WANTes //SECOND RUN: do some more puts AsyncInvocation async = vm4.invokeAsync(WANTestBase.class, "doPuts", new Object[] { testName + "_PR", 1000 }); async.join(); - pause(5000); + Wait.pause(5000); //verify all buckets drained only on non-accessor nodes. vm4.invoke(WANTestBase.class, "validateParallelSenderQueueAllBucketsDrained", new Object[] {"ln"}); @@ -749,7 +752,7 @@ public class ConcurrentParallelGatewaySenderOperation_1_DUnitTest extends WANTes vm6.invoke(WANTestBase.class, "createCache", new Object[] { lnPort }); vm7.invoke(WANTestBase.class, "createCache", new Object[] { lnPort }); - getLogWriter().info("Created cache on local site"); + LogWriterSupport.getLogWriter().info("Created cache on local site"); vm4.invoke(WANTestBase.class, "createConcurrentSender", new Object[] { "ln", 2, true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY }); @@ -760,7 +763,7 @@ public class ConcurrentParallelGatewaySenderOperation_1_DUnitTest extends WANTes vm7.invoke(WANTestBase.class, "createConcurrentSender", new Object[] { "ln", 2, true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY }); - getLogWriter().info("Created senders on local site"); + LogWriterSupport.getLogWriter().info("Created senders on local site"); vm4.invoke(WANTestBase.class, "createPartitionedRegion", new Object[] { testName + "_PR", "ln", 1, 100, isOffHeap() }); @@ -771,16 +774,16 @@ public class ConcurrentParallelGatewaySenderOperation_1_DUnitTest extends WANTes vm7.invoke(WANTestBase.class, "createPartitionedRegion", new Object[] { testName + "_PR", "ln", 1, 100, isOffHeap() }); - getLogWriter().info("Created PRs on local site"); + LogWriterSupport.getLogWriter().info("Created PRs on local site"); vm2.invoke(WANTestBase.class, "createPartitionedRegion", new Object[] { testName + "_PR", null, 1, 100, isOffHeap() }); vm3.invoke(WANTestBase.class, "createPartitionedRegion", new Object[] { testName + "_PR", null, 1, 100, isOffHeap() }); - getLogWriter().info("Created PRs on remote site"); + LogWriterSupport.getLogWriter().info("Created PRs on remote site"); vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_PR", 1000 }); - getLogWriter().info("Done 1000 puts on local site"); + LogWriterSupport.getLogWriter().info("Done 1000 puts on local site"); //Since puts are already done on userPR, it will have the buckets created. //During sender start, it will wait until those buckets are created for shadowPR as well. @@ -796,16 +799,16 @@ public class ConcurrentParallelGatewaySenderOperation_1_DUnitTest extends WANTes vm6.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); vm7.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); - getLogWriter().info("Started senders on local site"); + LogWriterSupport.getLogWriter().info("Started senders on local site"); vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_PR", 5000 }); - getLogWriter().info("Done 5000 puts on local site"); + LogWriterSupport.getLogWriter().info("Done 5000 puts on local site"); vm4.invoke(WANTestBase.class, "pauseSender", new Object[] { "ln" }); vm5.invoke(WANTestBase.class, "pauseSender", new Object[] { "ln" }); vm6.invoke(WANTestBase.class, "pauseSender", new Object[] { "ln" }); vm7.invoke(WANTestBase.class, "pauseSender", new Object[] { "ln" }); - getLogWriter().info("Paused senders on local site"); + LogWriterSupport.getLogWriter().info("Paused senders on local site"); vm4.invoke(WANTestBase.class, "verifySenderPausedState", new Object[] { "ln" }); vm5.invoke(WANTestBase.class, "verifySenderPausedState", new Object[] { "ln" }); @@ -814,13 +817,13 @@ public class ConcurrentParallelGatewaySenderOperation_1_DUnitTest extends WANTes AsyncInvocation inv1 = vm4.invokeAsync(WANTestBase.class, "doPuts", new Object[] { testName + "_PR", 1000 }); - getLogWriter().info("Started 1000 async puts on local site"); + LogWriterSupport.getLogWriter().info("Started 1000 async puts on local site"); vm4.invoke(WANTestBase.class, "resumeSender", new Object[] { "ln" }); vm5.invoke(WANTestBase.class, "resumeSender", new Object[] { "ln" }); vm6.invoke(WANTestBase.class, "resumeSender", new Object[] { "ln" }); vm7.invoke(WANTestBase.class, "resumeSender", new Object[] { "ln" }); - getLogWriter().info("Resumed senders on local site"); + LogWriterSupport.getLogWriter().info("Resumed senders on local site"); vm4.invoke(WANTestBase.class, "verifySenderResumedState", new Object[] { "ln" }); vm5.invoke(WANTestBase.class, "verifySenderResumedState", new Object[] { "ln" }); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_2_DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_2_DUnitTest.java b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_2_DUnitTest.java index 5533dc3..60b929c 100644 --- a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_2_DUnitTest.java +++ b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentParallelGatewaySenderOperation_2_DUnitTest.java @@ -21,9 +21,13 @@ import com.gemstone.gemfire.cache.RegionDestroyedException; import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy; import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender; import com.gemstone.gemfire.internal.cache.wan.WANTestBase; +import com.gemstone.gemfire.test.dunit.Assert; import com.gemstone.gemfire.test.dunit.AsyncInvocation; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; +import com.gemstone.gemfire.test.dunit.IgnoredException; +import com.gemstone.gemfire.test.dunit.LogWriterSupport; import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.Wait; +import com.gemstone.gemfire.test.dunit.WaitCriterion; /** * @author skumar @@ -39,10 +43,10 @@ public class ConcurrentParallelGatewaySenderOperation_2_DUnitTest extends WANTes public void setUp() throws Exception { super.setUp(); - addExpectedException("RegionDestroyedException"); - addExpectedException("Broken pipe"); - addExpectedException("Connection reset"); - addExpectedException("Unexpected IOException"); + IgnoredException.addIgnoredException("RegionDestroyedException"); + IgnoredException.addIgnoredException("Broken pipe"); + IgnoredException.addIgnoredException("Connection reset"); + IgnoredException.addIgnoredException("Unexpected IOException"); } // to test that when userPR is locally destroyed, shadow Pr is also locally @@ -100,7 +104,7 @@ public class ConcurrentParallelGatewaySenderOperation_2_DUnitTest extends WANTes vm4.invoke(() -> resumeSender("ln")); - pause(500); //paused if there is any element which is received on remote site + Wait.pause(500); //paused if there is any element which is received on remote site recreatePRDoPutsAndValidateRegionSizes(0, false); @@ -132,7 +136,7 @@ public class ConcurrentParallelGatewaySenderOperation_2_DUnitTest extends WANTes if (putAsync.getException() != null && !(putAsync.getException() instanceof RegionDestroyedException)) { - fail("Expected RegionDestroyedException but got", + Assert.fail("Expected RegionDestroyedException but got", putAsync.getException()); } @@ -154,9 +158,9 @@ public class ConcurrentParallelGatewaySenderOperation_2_DUnitTest extends WANTes public void testParallelGatewaySender_SingleNode_UserPR_Destroy_NodeDown() throws Exception { - addExpectedException("Broken pipe"); - addExpectedException("Connection reset"); - addExpectedException("Unexpected IOException"); + IgnoredException.addIgnoredException("Broken pipe"); + IgnoredException.addIgnoredException("Connection reset"); + IgnoredException.addIgnoredException("Unexpected IOException"); Integer[] locatorPorts = createLNAndNYLocators(); Integer lnPort = locatorPorts[0]; Integer nyPort = locatorPorts[1]; @@ -172,7 +176,7 @@ public class ConcurrentParallelGatewaySenderOperation_2_DUnitTest extends WANTes vm5.invoke(WANTestBase.class, "resumeSender", new Object[] { "ln" }); vm6.invoke(WANTestBase.class, "resumeSender", new Object[] { "ln" }); - pause(200); + Wait.pause(200); AsyncInvocation localDestroyAsync = vm4.invokeAsync(WANTestBase.class, "destroyRegion", new Object[] { testName + "_PR" }); @@ -238,7 +242,7 @@ public class ConcurrentParallelGatewaySenderOperation_2_DUnitTest extends WANTes try { vm7.invoke(() -> createCache_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME(lnPort)); - getLogWriter().info("Created cache on local site"); + LogWriterSupport.getLogWriter().info("Created cache on local site"); vm7.invoke(() -> createConcurrentSender("ln1", 2, true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY)); vm7.invoke(() -> createConcurrentSender("ln2", 3, true, 100, 10, false, false, null, true, 5, OrderPolicy.KEY)); @@ -251,7 +255,7 @@ public class ConcurrentParallelGatewaySenderOperation_2_DUnitTest extends WANTes String regionName = testName + "_PR"; vm7.invoke(() -> createPartitionedRegion(regionName, "ln1,ln2,ln3", 1, 10, isOffHeap())); - getLogWriter().info("Created PRs on local site"); + LogWriterSupport.getLogWriter().info("Created PRs on local site"); vm4.invoke(() -> createPartitionedRegion(regionName, null, 1, 10, isOffHeap())); vm5.invoke(() -> createPartitionedRegion(regionName, null, 1, 10, isOffHeap())); @@ -293,7 +297,7 @@ public class ConcurrentParallelGatewaySenderOperation_2_DUnitTest extends WANTes AsyncInvocation inv1 = vm4.invokeAsync(WANTestBase.class, "doPuts", new Object[] { regionName, 10 }); - pause(1000); + Wait.pause(1000); vm5.invoke(() -> localDestroyRegion(regionName)); try { @@ -339,7 +343,7 @@ public class ConcurrentParallelGatewaySenderOperation_2_DUnitTest extends WANTes AsyncInvocation inv1 = vm4.invokeAsync(WANTestBase.class, "doPuts", new Object[] { regionName, 10 }); - pause(1000); + Wait.pause(1000); vm5.invoke(WANTestBase.class, "localDestroyRegion", new Object[] { regionName }); @@ -376,13 +380,13 @@ public class ConcurrentParallelGatewaySenderOperation_2_DUnitTest extends WANTes createAndStartSenderWithCustomerOrderShipmentRegion(vm4, lnPort, 5, true); createAndStartSenderWithCustomerOrderShipmentRegion(vm5, lnPort, 5, true); - getLogWriter().info("Created PRs on local site"); + LogWriterSupport.getLogWriter().info("Created PRs on local site"); vm2.invoke(() -> createCustomerOrderShipmentPartitionedRegion(null, null, 1, 100, isOffHeap())); AsyncInvocation inv1 = vm4.invokeAsync(WANTestBase.class, "putcolocatedPartitionedRegion", new Object[] { 10 }); - pause(1000); + Wait.pause(1000); try { vm5.invoke(() -> localDestroyRegion(customerRegionName)); @@ -393,7 +397,7 @@ public class ConcurrentParallelGatewaySenderOperation_2_DUnitTest extends WANTes try { inv1.join(); } catch (Exception e) { - fail("Unexpected exception", e); + Assert.fail("Unexpected exception", e); } validateRegionSizes(customerRegionName, 10, vm4, vm5, vm2); @@ -414,7 +418,7 @@ public class ConcurrentParallelGatewaySenderOperation_2_DUnitTest extends WANTes createAndStartSenderWithCustomerOrderShipmentRegion(vm4, lnPort, 6, true); createAndStartSenderWithCustomerOrderShipmentRegion(vm5, lnPort, 6, true); - getLogWriter().info("Created PRs on local site"); + LogWriterSupport.getLogWriter().info("Created PRs on local site"); vm2.invoke(WANTestBase.class, "createCustomerOrderShipmentPartitionedRegion", new Object[] { null, @@ -422,7 +426,7 @@ public class ConcurrentParallelGatewaySenderOperation_2_DUnitTest extends WANTes AsyncInvocation inv1 = vm4.invokeAsync(WANTestBase.class, "putcolocatedPartitionedRegion", new Object[] { 2000 }); - pause(1000); + Wait.pause(1000); try { vm5.invoke(WANTestBase.class, "destroyRegion", @@ -465,7 +469,7 @@ public class ConcurrentParallelGatewaySenderOperation_2_DUnitTest extends WANTes + max + " but actual entries: " + r.keySet().size(); } }; - DistributedTestCase.waitForCriterion(wc, 120000, 500, true); + Wait.waitForCriterion(wc, 120000, 500, true); } protected static void createCache_INFINITE_MAXIMUM_SHUTDOWN_WAIT_TIME( @@ -482,7 +486,7 @@ public class ConcurrentParallelGatewaySenderOperation_2_DUnitTest extends WANTes vm.invoke(() -> pauseSender("ln")); } vm.invoke(() -> createPartitionedRegion(testName + "_PR", "ln", 1, 10, isOffHeap())); - getLogWriter().info("Created PRs on local site"); + LogWriterSupport.getLogWriter().info("Created PRs on local site"); } protected void createReceiverAndDoPutsInPausedSender(int port) { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentWANPropogation_1_DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentWANPropogation_1_DUnitTest.java b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentWANPropogation_1_DUnitTest.java index 804c3ed..2044c75 100644 --- a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentWANPropogation_1_DUnitTest.java +++ b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentWANPropogation_1_DUnitTest.java @@ -24,6 +24,8 @@ import com.gemstone.gemfire.cache30.CacheSerializableRunnable; import com.gemstone.gemfire.internal.cache.wan.BatchException70; import com.gemstone.gemfire.internal.cache.wan.WANTestBase; import com.gemstone.gemfire.test.dunit.AsyncInvocation; +import com.gemstone.gemfire.test.dunit.IgnoredException; +import com.gemstone.gemfire.test.dunit.LogWriterSupport; /** * All the test cases are similar to SerialWANPropogationDUnitTest except that @@ -77,8 +79,8 @@ public class ConcurrentWANPropogation_1_DUnitTest extends WANTestBase { vm7.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] { testName + "_RR", "ln", isOffHeap() }); - addExpectedException(BatchException70.class.getName()); - addExpectedException(ServerOperationException.class.getName()); + IgnoredException.addIgnoredException(BatchException70.class.getName()); + IgnoredException.addIgnoredException(ServerOperationException.class.getName()); vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR", 1000 }); @@ -151,9 +153,9 @@ public class ConcurrentWANPropogation_1_DUnitTest extends WANTestBase { public void testReplicatedSerialPropagationWithLocalSiteClosedAndRebuilt() throws Exception { - addExpectedException("Broken pipe"); - addExpectedException("Connection reset"); - addExpectedException("Unexpected IOException"); + IgnoredException.addIgnoredException("Broken pipe"); + IgnoredException.addIgnoredException("Connection reset"); + IgnoredException.addIgnoredException("Unexpected IOException"); Integer lnPort = (Integer)vm0.invoke(WANTestBase.class, "createFirstLocatorWithDSId", new Object[] { 1 }); Integer nyPort = (Integer)vm1.invoke(WANTestBase.class, @@ -200,7 +202,7 @@ public class ConcurrentWANPropogation_1_DUnitTest extends WANTestBase { Integer regionSize = (Integer) vm2.invoke(WANTestBase.class, "getRegionSize", new Object[] {testName + "_RR" }); - getLogWriter().info("Region size on remote is: " + regionSize); + LogWriterSupport.getLogWriter().info("Region size on remote is: " + regionSize); vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort }); vm5.invoke(WANTestBase.class, "createCache", new Object[] { lnPort }); @@ -230,9 +232,9 @@ public class ConcurrentWANPropogation_1_DUnitTest extends WANTestBase { vm4.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); vm5.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); - addExpectedException(EntryExistsException.class.getName()); - addExpectedException(BatchException70.class.getName()); - addExpectedException(ServerOperationException.class.getName()); + IgnoredException.addIgnoredException(EntryExistsException.class.getName()); + IgnoredException.addIgnoredException(BatchException70.class.getName()); + IgnoredException.addIgnoredException(ServerOperationException.class.getName()); vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR", 1000 }); @@ -381,8 +383,8 @@ public class ConcurrentWANPropogation_1_DUnitTest extends WANTestBase { vm7.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] { testName + "_RR_1", "ln", isOffHeap() }); - addExpectedException(BatchException70.class.getName()); - addExpectedException(ServerOperationException.class.getName()); + IgnoredException.addIgnoredException(BatchException70.class.getName()); + IgnoredException.addIgnoredException(ServerOperationException.class.getName()); //start puts in RR_1 in another thread AsyncInvocation inv1 = vm4.invokeAsync(WANTestBase.class, "doPuts", new Object[] { testName + "_RR_1", 10000 }); @@ -474,8 +476,8 @@ public class ConcurrentWANPropogation_1_DUnitTest extends WANTestBase { vm2.invoke(WANTestBase.class, "destroyRegion", new Object[] { testName + "_RR_2"}); //expected exceptions in the logs - addExpectedException(BatchException70.class.getName()); - addExpectedException(ServerOperationException.class.getName()); + IgnoredException.addIgnoredException(BatchException70.class.getName()); + IgnoredException.addIgnoredException(ServerOperationException.class.getName()); //start puts in RR_2 in another thread vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR_2", 1000 }); @@ -560,8 +562,8 @@ public class ConcurrentWANPropogation_1_DUnitTest extends WANTestBase { vm7.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] { testName + "_RR_2", "ln", isOffHeap() }); - addExpectedException(BatchException70.class.getName()); - addExpectedException(ServerOperationException.class.getName()); + IgnoredException.addIgnoredException(BatchException70.class.getName()); + IgnoredException.addIgnoredException(ServerOperationException.class.getName()); // start puts in RR_1 in another thread AsyncInvocation inv1 = vm4.invokeAsync(WANTestBase.class, "doPuts", http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentWANPropogation_2_DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentWANPropogation_2_DUnitTest.java b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentWANPropogation_2_DUnitTest.java index 9bcc72b..dda86ce 100644 --- a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentWANPropogation_2_DUnitTest.java +++ b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentWANPropogation_2_DUnitTest.java @@ -24,6 +24,8 @@ import com.gemstone.gemfire.cache30.CacheSerializableRunnable; import com.gemstone.gemfire.internal.cache.wan.WANTestBase; import com.gemstone.gemfire.internal.cache.wan.WANTestBase.MyGatewayEventFilter; import com.gemstone.gemfire.test.dunit.AsyncInvocation; +import com.gemstone.gemfire.test.dunit.IgnoredException; +import com.gemstone.gemfire.test.dunit.Wait; /** * All the test cases are similar to SerialWANPropogationDUnitTest except that @@ -194,9 +196,9 @@ public class ConcurrentWANPropogation_2_DUnitTest extends WANTestBase { } public void testReplicatedSerialPropagationHA() throws Exception { - addExpectedException("Broken pipe"); - addExpectedException("Connection reset"); - addExpectedException("Unexpected IOException"); + IgnoredException.addIgnoredException("Broken pipe"); + IgnoredException.addIgnoredException("Connection reset"); + IgnoredException.addIgnoredException("Unexpected IOException"); Integer lnPort = (Integer)vm0.invoke(WANTestBase.class, "createFirstLocatorWithDSId", new Object[] { 1 }); @@ -235,7 +237,7 @@ public class ConcurrentWANPropogation_2_DUnitTest extends WANTestBase { AsyncInvocation inv1 = vm5.invokeAsync(WANTestBase.class, "doPuts", new Object[] { testName + "_RR", 10000 }); - pause(2000); + Wait.pause(2000); AsyncInvocation inv2 = vm4.invokeAsync(WANTestBase.class, "killSender"); inv1.join(); @@ -452,7 +454,7 @@ public class ConcurrentWANPropogation_2_DUnitTest extends WANTestBase { testName + "_RR", null, isOffHeap() }); vm4.invoke(WANTestBase.class, "startSender", new Object[] { "ln" }); - pause(500); + Wait.pause(500); vm5.invoke(WANTestBase.class, "startSender", new Object[] { "ln" }); vm4.invoke(WANTestBase.class, "createNormalRegion", new Object[] { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/disttx/DistTXWANDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/disttx/DistTXWANDUnitTest.java b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/disttx/DistTXWANDUnitTest.java index ca68454..3d868c9 100644 --- a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/disttx/DistTXWANDUnitTest.java +++ b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/disttx/DistTXWANDUnitTest.java @@ -21,6 +21,8 @@ import com.gemstone.gemfire.cache.CacheClosedException; import com.gemstone.gemfire.internal.cache.ForceReattemptException; import com.gemstone.gemfire.internal.cache.wan.WANTestBase; import com.gemstone.gemfire.test.dunit.AsyncInvocation; +import com.gemstone.gemfire.test.dunit.Invoke; +import com.gemstone.gemfire.test.dunit.LogWriterSupport; import com.gemstone.gemfire.test.dunit.SerializableCallable; public class DistTXWANDUnitTest extends WANTestBase { @@ -34,10 +36,10 @@ public class DistTXWANDUnitTest extends WANTestBase { public void setUp() throws Exception { super.setUp(); - this.invokeInEveryVM(new SerializableCallable() { + Invoke.invokeInEveryVM(new SerializableCallable() { @Override public Object call() throws Exception { - System.setProperty("gemfire.log-level", getDUnitLogLevel()); + System.setProperty("gemfire.log-level", LogWriterSupport.getDUnitLogLevel()); return null; } }); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelGatewaySenderDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelGatewaySenderDUnitTest.java b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelGatewaySenderDUnitTest.java index 39e3fed..ac19679 100644 --- a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelGatewaySenderDUnitTest.java +++ b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelGatewaySenderDUnitTest.java @@ -25,8 +25,12 @@ import com.gemstone.gemfire.internal.cache.wan.WANTestBase; import com.gemstone.gemfire.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderEventProcessor; import com.gemstone.gemfire.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderQueue; import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelGatewaySenderQueue; +import com.gemstone.gemfire.test.dunit.Assert; import com.gemstone.gemfire.test.dunit.AsyncInvocation; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; +import com.gemstone.gemfire.test.dunit.IgnoredException; +import com.gemstone.gemfire.test.dunit.LogWriterSupport; +import com.gemstone.gemfire.test.dunit.Wait; +import com.gemstone.gemfire.test.dunit.WaitCriterion; import java.util.Set; @@ -41,7 +45,7 @@ public class CommonParallelGatewaySenderDUnitTest extends WANTestBase { } public void testSameSenderWithNonColocatedRegions() throws Exception { - addExpectedException("cannot have the same parallel"); + IgnoredException.addIgnoredException("cannot have the same parallel"); Integer lnPort = (Integer)vm0.invoke(WANTestBase.class, "createFirstLocatorWithDSId", new Object[] { 1 }); vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort }); @@ -58,7 +62,7 @@ public class CommonParallelGatewaySenderDUnitTest extends WANTestBase { if (!(e.getCause() instanceof IllegalStateException) || !(e.getCause().getMessage() .contains("cannot have the same parallel gateway sender id"))) { - fail("Expected IllegalStateException", e); + Assert.fail("Expected IllegalStateException", e); } } } @@ -283,7 +287,7 @@ public class CommonParallelGatewaySenderDUnitTest extends WANTestBase { String diskStore4 = (String) vm7.invoke(WANTestBase.class, "createSenderWithDiskStore", new Object[] { "ln", 2, true, 100, 10, false, true, null, null, true }); - getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4); + LogWriterSupport.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4); //create PR on remote site vm2.invoke(WANTestBase.class, "createPartitionedRegion", new Object[] { @@ -339,7 +343,7 @@ public class CommonParallelGatewaySenderDUnitTest extends WANTestBase { //start puts in region on local site vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName+"PR1", 3000 }); vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName+"PR2", 5000 }); - getLogWriter().info("Completed puts in the region"); + LogWriterSupport.getLogWriter().info("Completed puts in the region"); //--------------------close and rebuild local site ------------------------------------------------- //kill the senders @@ -348,7 +352,7 @@ public class CommonParallelGatewaySenderDUnitTest extends WANTestBase { vm6.invoke(WANTestBase.class, "killSender", new Object[] {}); vm7.invoke(WANTestBase.class, "killSender", new Object[] {}); - getLogWriter().info("Killed all the senders."); + LogWriterSupport.getLogWriter().info("Killed all the senders."); //restart the vm vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort }); @@ -356,7 +360,7 @@ public class CommonParallelGatewaySenderDUnitTest extends WANTestBase { vm6.invoke(WANTestBase.class, "createCache", new Object[] { lnPort }); vm7.invoke(WANTestBase.class, "createCache", new Object[] { lnPort }); - getLogWriter().info("Created back the cache"); + LogWriterSupport.getLogWriter().info("Created back the cache"); //create senders with disk store vm4.invoke(WANTestBase.class, "createSenderWithDiskStore", @@ -368,7 +372,7 @@ public class CommonParallelGatewaySenderDUnitTest extends WANTestBase { vm7.invoke(WANTestBase.class, "createSenderWithDiskStore", new Object[] { "ln", 2, true, 100, 10, false, true, null, diskStore4, true }); - getLogWriter().info("Created the senders back from the disk store."); + LogWriterSupport.getLogWriter().info("Created the senders back from the disk store."); //create PR on local site AsyncInvocation inv1 = vm4.invokeAsync(WANTestBase.class, "createPartitionedRegion", new Object[] { testName+"PR1", "ln", 1, 100, isOffHeap() }); @@ -408,7 +412,7 @@ public class CommonParallelGatewaySenderDUnitTest extends WANTestBase { fail(); } - getLogWriter().info("Created back the partitioned regions"); + LogWriterSupport.getLogWriter().info("Created back the partitioned regions"); //start the senders in async mode. This will ensure that the //node of shadow PR that went down last will come up first @@ -417,14 +421,14 @@ public class CommonParallelGatewaySenderDUnitTest extends WANTestBase { vm6.invokeAsync(WANTestBase.class, "startSender", new Object[] { "ln" }); vm7.invokeAsync(WANTestBase.class, "startSender", new Object[] { "ln" }); - getLogWriter().info("Waiting for senders running."); + LogWriterSupport.getLogWriter().info("Waiting for senders running."); //wait for senders running vm4.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); vm5.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); vm6.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); vm7.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); - getLogWriter().info("All the senders are now running..."); + LogWriterSupport.getLogWriter().info("All the senders are now running..."); //---------------------------------------------------------------------------------------------------- @@ -459,7 +463,7 @@ public class CommonParallelGatewaySenderDUnitTest extends WANTestBase { WaitCriterion wc = new WaitCriterion() { public boolean done() { if (bucket.keySet().size() == 0) { - getLogWriter().info("Bucket " + bucket.getId() + " is empty"); + LogWriterSupport.getLogWriter().info("Bucket " + bucket.getId() + " is empty"); return true; } return false; @@ -470,7 +474,7 @@ public class CommonParallelGatewaySenderDUnitTest extends WANTestBase { + bucket.keySet().size() + " This bucket isPrimary: " + bucket.getBucketAdvisor().isPrimary() + " KEYSET: " + bucket.keySet(); } }; - DistributedTestCase.waitForCriterion(wc, 180000, 50, true); + Wait.waitForCriterion(wc, 180000, 50, true); }//for loop ends } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/NewWANConcurrencyCheckForDestroyDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/NewWANConcurrencyCheckForDestroyDUnitTest.java b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/NewWANConcurrencyCheckForDestroyDUnitTest.java index 62ed047..eab7004 100644 --- a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/NewWANConcurrencyCheckForDestroyDUnitTest.java +++ b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/NewWANConcurrencyCheckForDestroyDUnitTest.java @@ -31,6 +31,8 @@ import com.gemstone.gemfire.internal.cache.Token.Tombstone; import com.gemstone.gemfire.internal.cache.versions.VersionTag; import com.gemstone.gemfire.internal.cache.wan.WANTestBase; import com.gemstone.gemfire.test.dunit.AsyncInvocation; +import com.gemstone.gemfire.test.dunit.LogWriterSupport; +import com.gemstone.gemfire.test.dunit.Wait; /** * @author shobhit @@ -80,7 +82,7 @@ public class NewWANConcurrencyCheckForDestroyDUnitTest extends WANTestBase { "createFirstRemoteLocator", new Object[] { 3, lnPort }); Integer tkRecPort = (Integer) vm5.invoke(WANTestBase.class, "createReceiver", new Object[] { tkPort }); - getLogWriter().info("Created locators and receivers in 3 distributed systems"); + LogWriterSupport.getLogWriter().info("Created locators and receivers in 3 distributed systems"); //Site 1 vm1.invoke(WANTestBase.class, "createSender", new Object[] { "ln1", 2, @@ -110,7 +112,7 @@ public class NewWANConcurrencyCheckForDestroyDUnitTest extends WANTestBase { vm5.invoke(WANTestBase.class, "startSender", new Object[] { "tk1" }); vm5.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "tk1" }); - pause(2000); + Wait.pause(2000); // Perform a put in vm1 vm1.invoke(new CacheSerializableRunnable("Putting an entry in ds1") { @@ -127,12 +129,12 @@ public class NewWANConcurrencyCheckForDestroyDUnitTest extends WANTestBase { }); //wait for vm1 to propagate put to vm3 and vm5 - pause(2000); + Wait.pause(2000); destroyTimeStamp = (Long) vm3.invoke(NewWANConcurrencyCheckForDestroyDUnitTest.class, "getVersionTimestampAfterOp"); //wait for vm1 to propagate destroyed entry's new version tag to vm5 - pause(2000); + Wait.pause(2000); vm5.invoke(NewWANConcurrencyCheckForDestroyDUnitTest.class, "verifyTimestampAfterOp", new Object[] {destroyTimeStamp, 1 /* ds 3 receives gatway event only from ds 1*/}); @@ -160,7 +162,7 @@ public class NewWANConcurrencyCheckForDestroyDUnitTest extends WANTestBase { "createFirstRemoteLocator", new Object[] { 2, lnPort }); Integer nyRecPort = (Integer) vm3.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort }); - getLogWriter().info("Created locators and receivers in 2 distributed systems"); + LogWriterSupport.getLogWriter().info("Created locators and receivers in 2 distributed systems"); //Site 1 vm1.invoke(WANTestBase.class, "createSender", new Object[] { "ln1", 2, @@ -178,7 +180,7 @@ public class NewWANConcurrencyCheckForDestroyDUnitTest extends WANTestBase { vm3.invoke(WANTestBase.class, "startSender", new Object[] { "ny1" }); vm3.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ny1" }); - pause(2000); + Wait.pause(2000); // Perform a put in vm1 AsyncInvocation asynch1 = vm1.invokeAsync(new CacheSerializableRunnable("Putting an entry in ds1") { @@ -200,7 +202,7 @@ public class NewWANConcurrencyCheckForDestroyDUnitTest extends WANTestBase { }); //wait for vm1 to propagate put to vm3 - pause(1000); + Wait.pause(1000); AsyncInvocation asynch2 = vm1.invokeAsync(new CacheSerializableRunnable("Putting an entry in ds1") { @@ -210,7 +212,7 @@ public class NewWANConcurrencyCheckForDestroyDUnitTest extends WANTestBase { Region region = cache.getRegion("/repRegion"); while (!region.containsKey("testKey")) { - pause(10); + Wait.pause(10); } // Test hook to make put wait after RE lock is released but before Gateway events are sent. DistributedCacheOperation.SLOW_DISTRIBUTION_MS = 0; @@ -238,7 +240,7 @@ public class NewWANConcurrencyCheckForDestroyDUnitTest extends WANTestBase { } //Wait for all Gateway events be received by vm3. - pause(1000); + Wait.pause(1000); long putAllTimeStampVm1 = (Long) vm1.invoke(NewWANConcurrencyCheckForDestroyDUnitTest.class, "getVersionTimestampAfterPutAllOp"); @@ -265,7 +267,7 @@ public void testPutAllEventSequenceOnSerialGatewaySenderWithPR() { "createFirstRemoteLocator", new Object[] { 2, lnPort }); Integer nyRecPort = (Integer) vm3.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort }); - getLogWriter().info("Created locators and receivers in 2 distributed systems"); + LogWriterSupport.getLogWriter().info("Created locators and receivers in 2 distributed systems"); //Site 1 vm1.invoke(WANTestBase.class, "createSender", new Object[] { "ln1", 2, @@ -283,7 +285,7 @@ public void testPutAllEventSequenceOnSerialGatewaySenderWithPR() { vm3.invoke(WANTestBase.class, "startSender", new Object[] { "ny1" }); vm3.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ny1" }); - pause(2000); + Wait.pause(2000); // Perform a put in vm1 AsyncInvocation asynch1 = vm1.invokeAsync(new CacheSerializableRunnable("Putting an entry in ds1") { @@ -305,7 +307,7 @@ public void testPutAllEventSequenceOnSerialGatewaySenderWithPR() { }); //wait for vm1 to propagate put to vm3 - pause(1000); + Wait.pause(1000); AsyncInvocation asynch2 = vm1.invokeAsync(new CacheSerializableRunnable("Putting an entry in ds1") { @@ -315,7 +317,7 @@ public void testPutAllEventSequenceOnSerialGatewaySenderWithPR() { Region region = cache.getRegion("/repRegion"); while (!region.containsKey("testKey")) { - pause(10); + Wait.pause(10); } // Test hook to make put wait after RE lock is released but before Gateway events are sent. DistributedCacheOperation.SLOW_DISTRIBUTION_MS = 0; @@ -343,7 +345,7 @@ public void testPutAllEventSequenceOnSerialGatewaySenderWithPR() { } //Wait for all Gateway events be received by vm3. - pause(1000); + Wait.pause(1000); long putAllTimeStampVm1 = (Long) vm1.invoke(NewWANConcurrencyCheckForDestroyDUnitTest.class, "getVersionTimestampAfterPutAllOp"); @@ -372,7 +374,7 @@ public void testPutAllEventSequenceOnSerialGatewaySenderWithPR() { "createFirstRemoteLocator", new Object[] { 2, lnPort }); Integer nyRecPort = (Integer) vm3.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort }); - getLogWriter().info("Created locators and receivers in 2 distributed systems"); + LogWriterSupport.getLogWriter().info("Created locators and receivers in 2 distributed systems"); //Site 1 vm1.invoke(WANTestBase.class, "createSender", new Object[] { "ln1", 2, @@ -393,7 +395,7 @@ public void testPutAllEventSequenceOnSerialGatewaySenderWithPR() { vm4.invoke(WANTestBase.class, "startSender", new Object[] { "ny1" }); vm4.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ny1" }); - pause(2000); + Wait.pause(2000); // Perform a put in vm1 vm1.invoke(new CacheSerializableRunnable("Putting an entry in ds1") { @@ -410,7 +412,7 @@ public void testPutAllEventSequenceOnSerialGatewaySenderWithPR() { }); //wait for vm4 to have later timestamp before sending operation to vm1 - pause(300); + Wait.pause(300); AsyncInvocation asynch = vm4.invokeAsync(new CacheSerializableRunnable("Putting an entry in ds2 in vm4") { @@ -433,7 +435,7 @@ public void testPutAllEventSequenceOnSerialGatewaySenderWithPR() { } //Wait for all local ds events be received by vm3. - pause(1000); + Wait.pause(1000); vm3.invoke(new CacheSerializableRunnable("Check dsid") { @@ -469,7 +471,7 @@ public void testPutAllEventSequenceOnSerialGatewaySenderWithPR() { Region region = cache.getRegion("repRegion"); while (!(region.containsKey("testKey") /*&& region.get("testKey").equals("testValue2") */)) { - pause(10); + Wait.pause(10); } assertEquals(1, region.size()); @@ -481,7 +483,7 @@ public void testPutAllEventSequenceOnSerialGatewaySenderWithPR() { re = ((NonTXEntry)entry).getRegionEntry(); } if (re != null) { - getLogWriter().fine("RegionEntry for testKey: " + re.getKey() + " " + re.getValueInVM((LocalRegion) region)); + LogWriterSupport.getLogWriter().fine("RegionEntry for testKey: " + re.getKey() + " " + re.getValueInVM((LocalRegion) region)); VersionTag tag = re.getVersionStamp().asVersionTag(); return tag.getVersionTimeStamp(); @@ -501,7 +503,7 @@ public void testPutAllEventSequenceOnSerialGatewaySenderWithPR() { Region.Entry entry = ((LocalRegion)region).getEntry("testKey", /*null,*/ true); RegionEntry re = ((EntrySnapshot)entry).getRegionEntry(); - getLogWriter().fine("RegionEntry for testKey: " + re.getKey() + " " + re.getValueInVM((LocalRegion) region)); + LogWriterSupport.getLogWriter().fine("RegionEntry for testKey: " + re.getKey() + " " + re.getValueInVM((LocalRegion) region)); assertTrue(re.getValueInVM((LocalRegion) region) instanceof Tombstone); VersionTag tag = re.getVersionStamp().asVersionTag(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/PDXNewWanDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/PDXNewWanDUnitTest.java b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/PDXNewWanDUnitTest.java index 0393e82..413b74c 100644 --- a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/PDXNewWanDUnitTest.java +++ b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/PDXNewWanDUnitTest.java @@ -20,6 +20,8 @@ import com.gemstone.gemfire.cache.CacheWriterException; import com.gemstone.gemfire.cache.client.ServerOperationException; import com.gemstone.gemfire.internal.cache.wan.WANTestBase; import com.gemstone.gemfire.test.dunit.AsyncInvocation; +import com.gemstone.gemfire.test.dunit.IgnoredException; +import com.gemstone.gemfire.test.dunit.Wait; public class PDXNewWanDUnitTest extends WANTestBase{ @@ -172,11 +174,11 @@ public class PDXNewWanDUnitTest extends WANTestBase{ //bounce vm3 vm3.invoke(WANTestBase.class, "closeCache"); - ExpectedException ex1 = addExpectedException("Trying to add a PDXType with the same id"); - ExpectedException ex2 = addExpectedException("CacheWriterException"); - ExpectedException ex3 = addExpectedException("does match the existing PDX type"); - ExpectedException ex4 = addExpectedException("ServerOperationException"); - ExpectedException ex5 = addExpectedException("Stopping the processor"); + IgnoredException ex1 = IgnoredException.addIgnoredException("Trying to add a PDXType with the same id"); + IgnoredException ex2 = IgnoredException.addIgnoredException("CacheWriterException"); + IgnoredException ex3 = IgnoredException.addIgnoredException("does match the existing PDX type"); + IgnoredException ex4 = IgnoredException.addIgnoredException("ServerOperationException"); + IgnoredException ex5 = IgnoredException.addIgnoredException("Stopping the processor"); try { //blow away vm3's PDX data @@ -197,7 +199,7 @@ public class PDXNewWanDUnitTest extends WANTestBase{ 2 }); //Give the updates some time to make it over the WAN - pause(10000); + Wait.pause(10000); vm2.invoke(WANTestBase.class, "validateRegionSize_PDX", new Object[] { testName + "_RR", 1 }); @@ -269,7 +271,7 @@ public class PDXNewWanDUnitTest extends WANTestBase{ //to ny from ln vm3.invoke(WANTestBase.class, "pauseSender", new Object[] { "ny" }); - pause(5000); + Wait.pause(5000); //Do some puts that define a PDX type in ln vm3.invoke(WANTestBase.class, "doPutsPDXSerializable", new Object[] { testName + "_RR", http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPersistenceDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPersistenceDUnitTest.java b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPersistenceDUnitTest.java index 7d3da8b..2bb728f 100644 --- a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPersistenceDUnitTest.java +++ b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPersistenceDUnitTest.java @@ -20,8 +20,9 @@ import com.gemstone.gemfire.cache.CacheClosedException; import com.gemstone.gemfire.cache.DataPolicy; import com.gemstone.gemfire.cache.Scope; import com.gemstone.gemfire.internal.cache.wan.WANTestBase; +import com.gemstone.gemfire.test.dunit.Assert; import com.gemstone.gemfire.test.dunit.AsyncInvocation; -import com.gemstone.gemfire.test.dunit.DistributedTestCase.ExpectedException; +import com.gemstone.gemfire.test.dunit.LogWriterSupport; public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBase { @@ -76,7 +77,7 @@ public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBas String diskStore4 = (String) vm7.invoke(WANTestBase.class, "createSenderWithDiskStore", new Object[] { "ln", 2, true, 100, 10, false, true, null, null, true }); - getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4); + LogWriterSupport.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4); vm4.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] { testName + "_RR", "ln", isOffHeap() }); @@ -104,7 +105,7 @@ public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBas //start puts in region on local site vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR", 3000 }); - getLogWriter().info("Completed puts in the region"); + LogWriterSupport.getLogWriter().info("Completed puts in the region"); //--------------------close and rebuild local site ------------------------------------------------- //kill the senders @@ -120,7 +121,7 @@ public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBas exp1.remove(); } */ - getLogWriter().info("Killed all the senders."); + LogWriterSupport.getLogWriter().info("Killed all the senders."); //restart the vm vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort }); @@ -128,7 +129,7 @@ public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBas vm6.invoke(WANTestBase.class, "createCache", new Object[] { lnPort }); vm7.invoke(WANTestBase.class, "createCache", new Object[] { lnPort }); - getLogWriter().info("Created back the cache"); + LogWriterSupport.getLogWriter().info("Created back the cache"); //create senders with disk store vm4.invoke(WANTestBase.class, "createSenderWithDiskStore", @@ -140,7 +141,7 @@ public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBas vm7.invoke(WANTestBase.class, "createSenderWithDiskStore", new Object[] { "ln", 2, true, 100, 10, false, true, null, diskStore4, true }); - getLogWriter().info("Created the senders back from the disk store."); + LogWriterSupport.getLogWriter().info("Created the senders back from the disk store."); //create PR on local site AsyncInvocation inv1 = vm4.invokeAsync(WANTestBase.class, "createReplicatedRegion", new Object[] { @@ -168,14 +169,14 @@ public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBas vm6.invokeAsync(WANTestBase.class, "startSender", new Object[] { "ln" }); vm7.invokeAsync(WANTestBase.class, "startSender", new Object[] { "ln" }); - getLogWriter().info("Waiting for senders running."); + LogWriterSupport.getLogWriter().info("Waiting for senders running."); //wait for senders running vm4.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); vm5.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); vm6.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); vm7.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); - getLogWriter().info("All the senders are now running..."); + LogWriterSupport.getLogWriter().info("All the senders are now running..."); vm2.invoke(WANTestBase.class, "validateRegionSize", new Object[] { testName + "_RR", 3000 }); @@ -233,7 +234,7 @@ public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBas String diskStore4 = (String) vm7.invoke(WANTestBase.class, "createSenderWithDiskStore", new Object[] { "ln", 2, true, 100, 10, false, true, null, null, true }); - getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4); + LogWriterSupport.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4); vm4.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] { testName + "_RR", "ln", @@ -265,7 +266,7 @@ public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBas //start puts in region on local site vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR", 3000 }); - getLogWriter().info("Completed puts in the region"); + LogWriterSupport.getLogWriter().info("Completed puts in the region"); //--------------------close and rebuild local site ------------------------------------------------- //kill the senders @@ -287,7 +288,7 @@ public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBas vm6.invoke(WANTestBase.class, "createCache", new Object[] { lnPort }); vm7.invoke(WANTestBase.class, "createCache", new Object[] { lnPort }); - getLogWriter().info("Created back the cache"); + LogWriterSupport.getLogWriter().info("Created back the cache"); //create senders with disk store vm4.invoke(WANTestBase.class, "createSenderWithDiskStore", @@ -299,7 +300,7 @@ public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBas vm7.invoke(WANTestBase.class, "createSenderWithDiskStore", new Object[] { "ln", 2, true, 100, 10, false, true, null, diskStore4, true }); - getLogWriter().info("Created the senders back from the disk store."); + LogWriterSupport.getLogWriter().info("Created the senders back from the disk store."); //create PR on local site AsyncInvocation inv1 = vm4.invokeAsync(WANTestBase.class, "createReplicatedRegion", new Object[] { @@ -328,14 +329,14 @@ public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBas vm6.invokeAsync(WANTestBase.class, "startSender", new Object[] { "ln" }); vm7.invokeAsync(WANTestBase.class, "startSender", new Object[] { "ln" }); - getLogWriter().info("Waiting for senders running."); + LogWriterSupport.getLogWriter().info("Waiting for senders running."); //wait for senders running vm4.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); vm5.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); vm6.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); vm7.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); - getLogWriter().info("All the senders are now running..."); + LogWriterSupport.getLogWriter().info("All the senders are now running..."); //---------------------------------------------------------------------------------------------------- @@ -413,7 +414,7 @@ public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBas String diskStore4 = (String) vm7.invoke(WANTestBase.class, "createSenderWithDiskStore", new Object[] { "ln", 2, true, 100, 10, false, true, null, null, true }); - getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4); + LogWriterSupport.getLogWriter().info("The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4); vm4.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] { testName + "_RR", "ln", Scope.DISTRIBUTED_ACK, @@ -455,7 +456,7 @@ public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBas //start puts in region on local site vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR", 3000 }); vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_PR", 3000 }); - getLogWriter().info("Completed puts in the region"); + LogWriterSupport.getLogWriter().info("Completed puts in the region"); //--------------------close and rebuild local site ------------------------------------------------- //kill the senders @@ -471,7 +472,7 @@ public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBas exp1.remove(); } */ - getLogWriter().info("Killed all the senders."); + LogWriterSupport.getLogWriter().info("Killed all the senders."); //restart the vm vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort }); @@ -479,7 +480,7 @@ public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBas vm6.invoke(WANTestBase.class, "createCache", new Object[] { lnPort }); vm7.invoke(WANTestBase.class, "createCache", new Object[] { lnPort }); - getLogWriter().info("Created back the cache"); + LogWriterSupport.getLogWriter().info("Created back the cache"); //create senders with disk store vm4.invoke(WANTestBase.class, "createSenderWithDiskStore", @@ -491,7 +492,7 @@ public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBas vm7.invoke(WANTestBase.class, "createSenderWithDiskStore", new Object[] { "ln", 2, true, 100, 10, false, true, null, diskStore4, true }); - getLogWriter().info("Created the senders back from the disk store."); + LogWriterSupport.getLogWriter().info("Created the senders back from the disk store."); //create PR on local site AsyncInvocation inv1 = vm4.invokeAsync(WANTestBase.class, "createReplicatedRegion", new Object[] { @@ -544,14 +545,14 @@ public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBas vm6.invokeAsync(WANTestBase.class, "startSender", new Object[] { "ln" }); vm7.invokeAsync(WANTestBase.class, "startSender", new Object[] { "ln" }); - getLogWriter().info("Waiting for senders running."); + LogWriterSupport.getLogWriter().info("Waiting for senders running."); //wait for senders running vm4.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); vm5.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); vm6.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); vm7.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); - getLogWriter().info("All the senders are now running..."); + LogWriterSupport.getLogWriter().info("All the senders are now running..."); //---------------------------------------------------------------------------------------------------- @@ -641,7 +642,7 @@ public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBas "createSenderWithDiskStore", new Object[] { "ln", 2, true, 100, 10, false, true, null, null, true }); - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "The DS are: " + diskStore1 + "," + diskStore2 + "," + diskStore3 + "," + diskStore4); @@ -696,14 +697,14 @@ public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBas inv3.join(); inv4.join(); } catch (Exception e) { - fail("UnExpected Exception", e); + Assert.fail("UnExpected Exception", e); } } vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort }); vm5.invoke(WANTestBase.class, "createCache", new Object[] { lnPort }); - getLogWriter().info("Created back the cache"); + LogWriterSupport.getLogWriter().info("Created back the cache"); // create senders with disk store vm4.invoke(WANTestBase.class, "createSenderWithDiskStore", new Object[] { @@ -711,7 +712,7 @@ public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBas vm5.invoke(WANTestBase.class, "createSenderWithDiskStore", new Object[] { "ln", 2, true, 100, 10, false, true, null, diskStore2, true }); - getLogWriter().info("Created the senders back from the disk store."); + LogWriterSupport.getLogWriter().info("Created the senders back from the disk store."); AsyncInvocation inv1 = vm4.invokeAsync(WANTestBase.class, "createReplicatedRegion", @@ -736,7 +737,7 @@ public class ReplicatedRegion_ParallelWANPersistenceDUnitTest extends WANTestBas vm4.invokeAsync(WANTestBase.class, "startSender", new Object[] { "ln" }); vm5.invokeAsync(WANTestBase.class, "startSender", new Object[] { "ln" }); - getLogWriter().info("Waiting for senders running."); + LogWriterSupport.getLogWriter().info("Waiting for senders running."); // wait for senders running vm4.invoke(WANTestBase.class, "waitForSenderRunningState", new Object[] { "ln" }); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPropogationDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPropogationDUnitTest.java b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPropogationDUnitTest.java index 4cb03ae..b8740b1 100644 --- a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPropogationDUnitTest.java +++ b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ReplicatedRegion_ParallelWANPropogationDUnitTest.java @@ -40,10 +40,12 @@ import com.gemstone.gemfire.internal.cache.PrimaryBucketException; import com.gemstone.gemfire.internal.cache.PutAllPartialResultException; import com.gemstone.gemfire.internal.cache.RegionQueue; import com.gemstone.gemfire.internal.cache.wan.WANTestBase; +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.DistributedTestCase.ExpectedException; -import com.gemstone.gemfire.test.dunit.DistributedTestCase.WaitCriterion; +import com.gemstone.gemfire.test.dunit.IgnoredException; +import com.gemstone.gemfire.test.dunit.LogWriterSupport; +import com.gemstone.gemfire.test.dunit.Wait; public class ReplicatedRegion_ParallelWANPropogationDUnitTest extends WANTestBase{ @@ -154,7 +156,7 @@ public class ReplicatedRegion_ParallelWANPropogationDUnitTest extends WANTestBas } */ } catch (Exception e) { - fail("Unexpected exception", e); + Assert.fail("Unexpected exception", e); } } @@ -198,7 +200,7 @@ public class ReplicatedRegion_ParallelWANPropogationDUnitTest extends WANTestBas } */ } catch (Exception e) { - fail("Unexpected exception", e); + Assert.fail("Unexpected exception", e); } } @@ -245,7 +247,7 @@ public class ReplicatedRegion_ParallelWANPropogationDUnitTest extends WANTestBas */ } catch (Exception e) { - fail("Unexpected exception", e); + Assert.fail("Unexpected exception", e); } } @@ -308,7 +310,7 @@ public class ReplicatedRegion_ParallelWANPropogationDUnitTest extends WANTestBas */ } catch (Exception e) { - fail("Unexpected exception", e); + Assert.fail("Unexpected exception", e); } } @@ -379,7 +381,7 @@ public class ReplicatedRegion_ParallelWANPropogationDUnitTest extends WANTestBas testName + "_RR", 1000}); } catch (Exception e) { - fail("Unexpected exception", e); + Assert.fail("Unexpected exception", e); } } @@ -434,7 +436,7 @@ public class ReplicatedRegion_ParallelWANPropogationDUnitTest extends WANTestBas testName + "_RR", 1000 }); } catch (Exception e) { - fail("Unexpected exception", e); + Assert.fail("Unexpected exception", e); } } @@ -489,7 +491,7 @@ public class ReplicatedRegion_ParallelWANPropogationDUnitTest extends WANTestBas testName + "_RR", 1000 }); } catch (Exception e) { - fail("Unexpected exception", e); + Assert.fail("Unexpected exception", e); } } @@ -598,7 +600,7 @@ public class ReplicatedRegion_ParallelWANPropogationDUnitTest extends WANTestBas } */ } catch (Exception e) { - fail("Unexpected exception", e); + Assert.fail("Unexpected exception", e); } } @@ -676,7 +678,7 @@ public class ReplicatedRegion_ParallelWANPropogationDUnitTest extends WANTestBas }*/ } catch (Exception e) { - fail("Unexpected exception", e); + Assert.fail("Unexpected exception", e); } } @@ -823,7 +825,7 @@ public class ReplicatedRegion_ParallelWANPropogationDUnitTest extends WANTestBas }*/ } catch (Exception e) { - fail("Unexpected exception", e); + Assert.fail("Unexpected exception", e); } } @@ -881,7 +883,7 @@ public class ReplicatedRegion_ParallelWANPropogationDUnitTest extends WANTestBas testName + "_RR", 1000 }); } catch (Exception e) { - fail("Unexpected exception", e); + Assert.fail("Unexpected exception", e); } } @@ -936,14 +938,14 @@ public class ReplicatedRegion_ParallelWANPropogationDUnitTest extends WANTestBas AsyncInvocation inv1 = vm4.invokeAsync( ReplicatedRegion_ParallelWANPropogationDUnitTest.class, "doPuts0", new Object[] { testName + "_RR", 1000 }); - pause(1000); + Wait.pause(1000); AsyncInvocation inv2 = vm5.invokeAsync(WANTestBase.class, "killSender"); try { inv1.join(); inv2.join(); } catch (Exception e) { - fail("UnExpected Exception", e); + Assert.fail("UnExpected Exception", e); } /* } finally { @@ -952,7 +954,7 @@ public class ReplicatedRegion_ParallelWANPropogationDUnitTest extends WANTestBas Integer size = (Integer)vm4.invoke(WANTestBase.class, "getQueueContentSize", new Object[] { "ln" }); - getLogWriter().info("The size of the queue is in vm4 " + size); + LogWriterSupport.getLogWriter().info("The size of the queue is in vm4 " + size); vm4.invoke(WANTestBase.class, @@ -960,7 +962,7 @@ public class ReplicatedRegion_ParallelWANPropogationDUnitTest extends WANTestBas size = (Integer)vm4.invoke(WANTestBase.class, "getQueueContentSize", new Object[] { "ln" }); - getLogWriter().info("The size of the queue is in vm4 " + size); + LogWriterSupport.getLogWriter().info("The size of the queue is in vm4 " + size); vm2.invoke(WANTestBase.class, "validateRegionSize", new Object[] { testName + "_RR", 1000 }); @@ -1047,7 +1049,7 @@ public class ReplicatedRegion_ParallelWANPropogationDUnitTest extends WANTestBas inv4.join(); } catch (Exception e) { - fail("UnExpected Exception", e); + Assert.fail("UnExpected Exception", e); } }/* finally { @@ -1065,16 +1067,16 @@ public class ReplicatedRegion_ParallelWANPropogationDUnitTest extends WANTestBas } public static void doPuts0(String regionName, int numPuts) { - ExpectedException exp = addExpectedException(ForceReattemptException.class + IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); - ExpectedException exp1 = addExpectedException(CacheClosedException.class + IgnoredException exp1 = IgnoredException.addIgnoredException(CacheClosedException.class .getName()); try { Region r = cache.getRegion(Region.SEPARATOR + regionName); assertNotNull(r); for (long i = 0; i < numPuts; i++) { - getLogWriter().info("Put : key : " + i); + LogWriterSupport.getLogWriter().info("Put : key : " + i); r.put(i, "0_" + i); } } finally { @@ -1084,16 +1086,16 @@ public class ReplicatedRegion_ParallelWANPropogationDUnitTest extends WANTestBas } public static void doPuts1(String regionName, int numPuts){ - ExpectedException exp = addExpectedException(ForceReattemptException.class + IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); - ExpectedException exp1 = addExpectedException(CacheClosedException.class + IgnoredException exp1 = IgnoredException.addIgnoredException(CacheClosedException.class .getName()); try { Region r = cache.getRegion(Region.SEPARATOR + regionName); assertNotNull(r); for (long i = 0; i < numPuts; i++) { - getLogWriter().info("Put : key : " + i); + LogWriterSupport.getLogWriter().info("Put : key : " + i); r.put(i, "1_" + i); } } finally { @@ -1103,15 +1105,15 @@ public class ReplicatedRegion_ParallelWANPropogationDUnitTest extends WANTestBas } public static void doPuts2(String regionName, int numPuts){ - ExpectedException exp = addExpectedException(ForceReattemptException.class + IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); - ExpectedException exp1 = addExpectedException(CacheClosedException.class + IgnoredException exp1 = IgnoredException.addIgnoredException(CacheClosedException.class .getName()); try { Region r = cache.getRegion(Region.SEPARATOR + regionName); assertNotNull(r); for (long i = 0; i < numPuts; i++) { - getLogWriter().info("Put : key : " + i); + LogWriterSupport.getLogWriter().info("Put : key : " + i); r.put(i, "2_" + i); } } finally { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ShutdownAllPersistentGatewaySenderDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ShutdownAllPersistentGatewaySenderDUnitTest.java b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ShutdownAllPersistentGatewaySenderDUnitTest.java index 647dded..34734d7 100644 --- a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ShutdownAllPersistentGatewaySenderDUnitTest.java +++ b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/ShutdownAllPersistentGatewaySenderDUnitTest.java @@ -29,8 +29,12 @@ import com.gemstone.gemfire.internal.cache.LocalRegion; import com.gemstone.gemfire.internal.cache.wan.WANTestBase; import com.gemstone.gemfire.test.dunit.AsyncInvocation; import com.gemstone.gemfire.test.dunit.DistributedTestCase; +import com.gemstone.gemfire.test.dunit.IgnoredException; +import com.gemstone.gemfire.test.dunit.LogWriterSupport; import com.gemstone.gemfire.test.dunit.SerializableRunnable; import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.Wait; +import com.gemstone.gemfire.test.dunit.WaitCriterion; public class ShutdownAllPersistentGatewaySenderDUnitTest extends WANTestBase { private static final long MAX_WAIT = 70000; @@ -44,13 +48,13 @@ public class ShutdownAllPersistentGatewaySenderDUnitTest extends WANTestBase { @Override public void setUp() throws Exception { super.setUp(); - addExpectedException("Cache is being closed by ShutdownAll"); + IgnoredException.addIgnoredException("Cache is being closed by ShutdownAll"); } private static final long serialVersionUID = 1L; public void testGatewaySender() throws Exception { - addExpectedException("Cache is shutting down"); + IgnoredException.addIgnoredException("Cache is shutting down"); Integer lnPort = (Integer)vm0.invoke(WANTestBase.class, "createFirstLocatorWithDSId", new Object[] { 1 }); @@ -87,7 +91,7 @@ public class ShutdownAllPersistentGatewaySenderDUnitTest extends WANTestBase { @Override public void beforeShutdownAll() { final Region region = cache.getRegion(testName + "_PR"); - waitForCriterion(new WaitCriterion() { + Wait.waitForCriterion(new WaitCriterion() { @Override public boolean done() { return region.size() >= 2; @@ -113,7 +117,7 @@ public class ShutdownAllPersistentGatewaySenderDUnitTest extends WANTestBase { future.join(MAX_WAIT); // now restart vm1 with gatewayHub - getLogWriter().info("restart in VM2"); + LogWriterSupport.getLogWriter().info("restart in VM2"); vm2.invoke(WANTestBase.class, "createCache", new Object[] { nyPort }); vm3.invoke(WANTestBase.class, "createCache", new Object[] { nyPort }); AsyncInvocation vm3_future = vm3.invokeAsync(WANTestBase.class, @@ -149,7 +153,7 @@ public class ShutdownAllPersistentGatewaySenderDUnitTest extends WANTestBase { cache.getLogger().info( "vm1's region size after restart gatewayhub is " + region.size()); - waitForCriterion(new WaitCriterion() { + Wait.waitForCriterion(new WaitCriterion() { public boolean done() { Object lastvalue = region.get(NUM_KEYS - 1); if (lastvalue != null && lastvalue.equals(NUM_KEYS - 1)) { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANLocatorServerDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANLocatorServerDUnitTest.java b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANLocatorServerDUnitTest.java index 50bb4b9..6cf4811 100644 --- a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANLocatorServerDUnitTest.java +++ b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANLocatorServerDUnitTest.java @@ -35,7 +35,9 @@ import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; import com.gemstone.gemfire.internal.AvailablePortHelper; import com.gemstone.gemfire.internal.cache.PoolFactoryImpl; import com.gemstone.gemfire.internal.cache.wan.WANTestBase; +import com.gemstone.gemfire.test.dunit.Assert; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.LogWriterSupport; public class WANLocatorServerDUnitTest extends WANTestBase { @@ -149,7 +151,7 @@ public class WANLocatorServerDUnitTest extends WANTestBase { fail("Test " + test.getName() + " failed to start CacheServer on port " + port); } - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "Server Started on port : " + port + " : server : " + server); } @@ -186,7 +188,7 @@ public class WANLocatorServerDUnitTest extends WANTestBase { con1 = proxy.acquireConnection(); } catch (Exception e) { - fail("No Exception expected", e); + Assert.fail("No Exception expected", e); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANSSLDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANSSLDUnitTest.java b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANSSLDUnitTest.java index c80a447..9800d68 100644 --- a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANSSLDUnitTest.java +++ b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WANSSLDUnitTest.java @@ -18,7 +18,9 @@ package com.gemstone.gemfire.internal.cache.wan.misc; import com.gemstone.gemfire.cache.Region; import com.gemstone.gemfire.internal.cache.wan.WANTestBase; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; +import com.gemstone.gemfire.test.dunit.IgnoredException; +import com.gemstone.gemfire.test.dunit.Wait; +import com.gemstone.gemfire.test.dunit.WaitCriterion; public class WANSSLDUnitTest extends WANTestBase{ @@ -59,9 +61,9 @@ public class WANSSLDUnitTest extends WANTestBase{ } public void testSenderNoSSLReceiverSSL() { - addExpectedException("Unexpected IOException"); - addExpectedException("SSL Error"); - addExpectedException("Unrecognized SSL message"); + IgnoredException.addIgnoredException("Unexpected IOException"); + IgnoredException.addIgnoredException("SSL Error"); + IgnoredException.addIgnoredException("Unrecognized SSL message"); try { Integer lnPort = (Integer)vm0.invoke(WANTestBase.class, "createFirstLocatorWithDSId", new Object[] { 1 }); @@ -97,8 +99,8 @@ public class WANSSLDUnitTest extends WANTestBase{ } public void testSenderSSLReceiverNoSSL(){ - addExpectedException("Acceptor received unknown"); - addExpectedException("failed accepting client"); + IgnoredException.addIgnoredException("Acceptor received unknown"); + IgnoredException.addIgnoredException("failed accepting client"); Integer lnPort = (Integer)vm0.invoke(WANTestBase.class, "createFirstLocatorWithDSId", new Object[] { 1 }); Integer nyPort = (Integer)vm1.invoke(WANTestBase.class, @@ -141,7 +143,7 @@ public class WANSSLDUnitTest extends WANTestBase{ return null; } }; - DistributedTestCase.waitForCriterion(wc, 2000, 500, false); + Wait.waitForCriterion(wc, 2000, 500, false); if(r.size() == regionSize){ return true; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WanAutoDiscoveryDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WanAutoDiscoveryDUnitTest.java b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WanAutoDiscoveryDUnitTest.java index 19e42c1..216641f 100644 --- a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WanAutoDiscoveryDUnitTest.java +++ b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/WanAutoDiscoveryDUnitTest.java @@ -27,8 +27,10 @@ import com.gemstone.gemfire.GemFireConfigException; import com.gemstone.gemfire.IncompatibleSystemException; import com.gemstone.gemfire.internal.AvailablePortHelper; import com.gemstone.gemfire.internal.cache.wan.WANTestBase; +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.LogWriterSupport; public class WanAutoDiscoveryDUnitTest extends WANTestBase { @@ -56,7 +58,7 @@ public class WanAutoDiscoveryDUnitTest extends WANTestBase { } catch (Exception e) { if (!(e.getCause() instanceof GemFireConfigException)) { - fail("Expected GemFireConfigException but received :", e); + Assert.fail("Expected GemFireConfigException but received :", e); } } } @@ -83,7 +85,7 @@ public class WanAutoDiscoveryDUnitTest extends WANTestBase { } catch (Exception e) { if (!(e.getCause()instanceof IncompatibleSystemException)) { - fail("Expected IncompatibleSystemException but received :", e); + Assert.fail("Expected IncompatibleSystemException but received :", e); } } } @@ -453,10 +455,10 @@ public class WanAutoDiscoveryDUnitTest extends WANTestBase { } catch (Throwable e) { e.printStackTrace(); - fail("Could not get end time", e); + Assert.fail("Could not get end time", e); } - getLogWriter().info("Time taken for all 9 locators discovery in 3 sites: " + (endTime.longValue() - startTime)); + LogWriterSupport.getLogWriter().info("Time taken for all 9 locators discovery in 3 sites: " + (endTime.longValue() - startTime)); vm0.invoke(WANTestBase.class, "checkAllSiteMetaDataFor3Sites", new Object[] { dsVsPort });