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 3691518692 for ; Tue, 2 Feb 2016 20:28:32 +0000 (UTC) Received: (qmail 71162 invoked by uid 500); 2 Feb 2016 20:21:30 -0000 Delivered-To: apmail-geode-commits-archive@geode.apache.org Received: (qmail 71127 invoked by uid 500); 2 Feb 2016 20:21:30 -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 71118 invoked by uid 99); 2 Feb 2016 20:21:30 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Feb 2016 20:21:30 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id CE4C4C1824 for ; Tue, 2 Feb 2016 20:21:29 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.649 X-Spam-Level: X-Spam-Status: No, score=-3.649 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.429] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id ZhQXGRzZhUdK for ; Tue, 2 Feb 2016 20:21:21 +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 0A7ED31AF7 for ; Tue, 2 Feb 2016 20:21:09 +0000 (UTC) Received: (qmail 68866 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 B05F4DFE60; 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:12 -0000 Message-Id: <27dda65768744aca91d435a803f89910@git.apache.org> In-Reply-To: <8084d27559034992a68abed5afa94685@git.apache.org> References: <8084d27559034992a68abed5afa94685@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [05/44] incubator-geode git commit: Refactor dunit http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DurableClientCommandsDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DurableClientCommandsDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DurableClientCommandsDUnitTest.java index 89c7d5e..104abc7 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DurableClientCommandsDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DurableClientCommandsDUnitTest.java @@ -44,7 +44,10 @@ import com.gemstone.gemfire.management.cli.Result.Status; import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings; import com.gemstone.gemfire.management.internal.cli.result.CommandResult; import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder; +import com.gemstone.gemfire.test.dunit.DistributedTestSupport; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.LogWriterSupport; +import com.gemstone.gemfire.test.dunit.NetworkSupport; import com.gemstone.gemfire.test.dunit.SerializableCallable; import com.gemstone.gemfire.test.dunit.VM; @@ -247,7 +250,7 @@ public class DurableClientCommandsDUnitTest extends CliCommandTestBase { } private void writeToLog(String text, String resultAsString) { - getLogWriter().info(getUniqueName() + ": " + text + "\n" + resultAsString); + LogWriterSupport.getLogWriter().info(getUniqueName() + ": " + text + "\n" + resultAsString); } private void setupSystem() throws Exception { @@ -357,7 +360,7 @@ public class DurableClientCommandsDUnitTest extends CliCommandTestBase { getSystem(props); final ClientCacheFactory ccf = new ClientCacheFactory(props); - ccf.addPoolServer(getServerHostName(server.getHost()), port); + ccf.addPoolServer(NetworkSupport.getServerHostName(server.getHost()), port); ccf.setPoolSubscriptionEnabled(true); ClientCache cache = (ClientCache)getClientCache(ccf); @@ -420,7 +423,7 @@ public class DurableClientCommandsDUnitTest extends CliCommandTestBase { protected Properties getServerProperties() { Properties p = new Properties(); - p.setProperty(DistributionConfig.LOCATORS_NAME, "localhost["+getDUnitLocatorPort()+"]"); + p.setProperty(DistributionConfig.LOCATORS_NAME, "localhost["+DistributedTestSupport.getDUnitLocatorPort()+"]"); return p; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestCQDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestCQDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestCQDUnitTest.java index 131cbcd..833d49b 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestCQDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestCQDUnitTest.java @@ -21,7 +21,11 @@ import com.gemstone.gemfire.internal.AvailablePortHelper; import com.gemstone.gemfire.management.DistributedSystemMXBean; import com.gemstone.gemfire.management.ManagementService; import com.gemstone.gemfire.management.ManagementTestBase; +import com.gemstone.gemfire.test.dunit.LogWriterSupport; +import com.gemstone.gemfire.test.dunit.NetworkSupport; import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.Wait; +import com.gemstone.gemfire.test.dunit.WaitCriterion; /** * This is for testing continuous query. @@ -71,7 +75,7 @@ public class TestCQDUnitTest extends ManagementTestBase { return "wait for getNumOfCQ to complete and get results"; } }; - waitForCriterion(waitCriteria, 2 * 60 * 1000, 3000, true); + Wait.waitForCriterion(waitCriteria, 2 * 60 * 1000, 3000, true); final DistributedSystemMXBean bean = getManagementService().getDistributedSystemMXBean(); assertNotNull(bean); return bean.getActiveCQCount(); @@ -79,12 +83,12 @@ public class TestCQDUnitTest extends ManagementTestBase { public void testNumOfCQ() throws Exception { initManagement(false); - getLogWriter().info("started testNumOfCQ"); + LogWriterSupport.getLogWriter().info("started testNumOfCQ"); VM server = managedNodeList.get(1); VM client = managedNodeList.get(2); - final String host0 = getServerHostName(server.getHost()); + final String host0 = NetworkSupport.getServerHostName(server.getHost()); int serverPort = AvailablePortHelper.getRandomAvailableTCPPort(); cqDUnitTest.createServer(server, serverPort); @@ -128,7 +132,7 @@ public class TestCQDUnitTest extends ManagementTestBase { long numOfCQ = ((Number) managingNode.invoke(TestCQDUnitTest.class, "getNumOfCQ")).intValue(); - getLogWriter().info("testNumOfCQ numOfCQ= " + numOfCQ); + LogWriterSupport.getLogWriter().info("testNumOfCQ numOfCQ= " + numOfCQ); cqDUnitTest.closeClient(client); cqDUnitTest.closeServer(server); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestClientsDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestClientsDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestClientsDUnitTest.java index 814e07e..552ecb9 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestClientsDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestClientsDUnitTest.java @@ -21,7 +21,11 @@ import com.gemstone.gemfire.internal.AvailablePortHelper; import com.gemstone.gemfire.management.DistributedSystemMXBean; import com.gemstone.gemfire.management.ManagementService; import com.gemstone.gemfire.management.ManagementTestBase; +import com.gemstone.gemfire.test.dunit.LogWriterSupport; +import com.gemstone.gemfire.test.dunit.NetworkSupport; import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.Wait; +import com.gemstone.gemfire.test.dunit.WaitCriterion; /** * This is for testing Number of clients and can be extended for relevant test @@ -69,7 +73,7 @@ public class TestClientsDUnitTest extends ManagementTestBase { } }; - waitForCriterion(waitCriteria, 2 * 60 * 1000, 3000, true); + Wait.waitForCriterion(waitCriteria, 2 * 60 * 1000, 3000, true); final DistributedSystemMXBean bean = getManagementService() .getDistributedSystemMXBean(); assertNotNull(bean); @@ -87,11 +91,11 @@ public class TestClientsDUnitTest extends ManagementTestBase { cqDUnitTest.createServer(server, serverPort); final int port = server.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort"); - final String host0 = getServerHostName(server.getHost()); + final String host0 = NetworkSupport.getServerHostName(server.getHost()); cqDUnitTest.createClient(client, port, host0); Integer numOfClients = (Integer) managingNode.invoke( TestClientsDUnitTest.class, "getNumOfClients"); - getLogWriter().info("testNumOfClients numOfClients = " + numOfClients); + LogWriterSupport.getLogWriter().info("testNumOfClients numOfClients = " + numOfClients); cqDUnitTest.closeClient(client); cqDUnitTest.closeServer(server); assertEquals(1, numOfClients.intValue()); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestServerDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestServerDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestServerDUnitTest.java index 6475fa5..721e78a 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestServerDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestServerDUnitTest.java @@ -21,7 +21,10 @@ import com.gemstone.gemfire.internal.AvailablePortHelper; import com.gemstone.gemfire.management.DistributedSystemMXBean; import com.gemstone.gemfire.management.ManagementService; import com.gemstone.gemfire.management.ManagementTestBase; +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; /** * This is for testing server count details from MBean @@ -66,7 +69,7 @@ public class TestServerDUnitTest extends ManagementTestBase { } }; - waitForCriterion(waitCriteria, 2 * 60 * 1000, 3000, true); + Wait.waitForCriterion(waitCriteria, 2 * 60 * 1000, 3000, true); final DistributedSystemMXBean bean = getManagementService().getDistributedSystemMXBean(); assertNotNull(bean); return bean.listCacheServers().length; @@ -83,7 +86,7 @@ public class TestServerDUnitTest extends ManagementTestBase { cqDUnitTest.createServer(server, serverPort); int serverCount = ((Number) managingNode.invoke(TestServerDUnitTest.class, "getNumOfServersFromMBean")).intValue(); - getLogWriter().info("TestServerDUnitTest serverCount =" + serverCount); + LogWriterSupport.getLogWriter().info("TestServerDUnitTest serverCount =" + serverCount); cqDUnitTest.closeServer(server); assertEquals(1, serverCount); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTwoDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTwoDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTwoDUnitTest.java index 7725ef6..6ccc27e 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTwoDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTwoDUnitTest.java @@ -18,6 +18,7 @@ package com.gemstone.gemfire.security; import com.gemstone.gemfire.cache.operations.OperationContext.OperationCode; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.IgnoredException; /** * Tests for authorization from client to server. This tests for authorization @@ -64,11 +65,11 @@ public class ClientAuthorizationTwoDUnitTest extends // Region: Tests public void testAllOpsWithFailover2() { - addExpectedException("Read timed out"); - addExpectedException("Connection reset"); - addExpectedException("SocketTimeoutException"); - addExpectedException("ServerConnectivityException"); - addExpectedException("Socket Closed"); + IgnoredException.addIgnoredException("Read timed out"); + IgnoredException.addIgnoredException("Connection reset"); + IgnoredException.addIgnoredException("SocketTimeoutException"); + IgnoredException.addIgnoredException("ServerConnectivityException"); + IgnoredException.addIgnoredException("Socket Closed"); OperationWithAction[] allOps = { // Register interest in all keys using list http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthzObjectModDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthzObjectModDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthzObjectModDUnitTest.java index 58f26bb..bf57be6 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthzObjectModDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthzObjectModDUnitTest.java @@ -34,6 +34,7 @@ import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.security.ObjectWithAuthz; import com.gemstone.gemfire.test.dunit.DistributedTestCase; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.LogWriterSupport; import com.gemstone.gemfire.test.dunit.SerializableRunnable; /** @@ -338,15 +339,15 @@ public class ClientAuthzObjectModDUnitTest extends ClientAuthorizationTestBase { String authInit = gen.getAuthInit(); String authenticator = gen.getAuthenticator(); - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "testPutsGetsObjectModWithFailover: Using authinit: " + authInit); - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "testPutsGetsObjectModWithFailover: Using authenticator: " + authenticator); - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "testPutsGetsObjectModWithFailover: Using pre-operation accessor: " + preAccessor); - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "testPutsGetsObjectModWithFailover: Using post-operation accessor: " + postAccessor); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientCQPostAuthorizationDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientCQPostAuthorizationDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientCQPostAuthorizationDUnitTest.java index 2854c24..0e4dcce 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientCQPostAuthorizationDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientCQPostAuthorizationDUnitTest.java @@ -42,9 +42,12 @@ import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.internal.logging.InternalLogWriter; -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.LogWriterSupport; import com.gemstone.gemfire.test.dunit.SerializableRunnable; +import com.gemstone.gemfire.test.dunit.Wait; +import com.gemstone.gemfire.test.dunit.WaitCriterion; /** * This is for multiuser-authentication * @@ -71,7 +74,7 @@ public class ClientCQPostAuthorizationDUnitTest extends super.setUp(); getSystem(); - invokeInEveryVM(new SerializableRunnable("getSystem") { + Invoke.invokeInEveryVM(new SerializableRunnable("getSystem") { public void run() { getSystem(); } @@ -301,7 +304,7 @@ public class ClientCQPostAuthorizationDUnitTest extends + SecurityTestUtil.proxyCaches[i].getRegion(regionName).getFullPath(); // Create CQ Attributes. CqAttributesFactory cqf = new CqAttributesFactory(); - CqListener[] cqListeners = {new CqQueryTestListener(getLogWriter())}; + CqListener[] cqListeners = {new CqQueryTestListener(LogWriterSupport.getLogWriter())}; ((CqQueryTestListener)cqListeners[0]).cqName = cqName; cqf.initCqListeners(cqListeners); @@ -315,7 +318,7 @@ public class ClientCQPostAuthorizationDUnitTest extends AssertionError err = new AssertionError("Failed to create CQ " + cqName + " . "); err.initCause(ex); - getLogWriter().info("CqService is :" + cqService, err); + LogWriterSupport.getLogWriter().info("CqService is :" + cqService, err); throw err; } } @@ -343,16 +346,16 @@ public class ClientCQPostAuthorizationDUnitTest extends try { cq1 = cqService.getCq(cqName); if (cq1 == null) { - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "Failed to get CqQuery object for CQ name: " + cqName); fail("Failed to get CQ " + cqName); } else { - getLogWriter().info("Obtained CQ, CQ name: " + cq1.getName()); + LogWriterSupport.getLogWriter().info("Obtained CQ, CQ name: " + cq1.getName()); assertTrue("newCq() state mismatch", cq1.getState().isStopped()); } } catch (Exception ex) { - getLogWriter().info("CqService is :" + cqService); - getLogWriter().error(ex); + LogWriterSupport.getLogWriter().info("CqService is :" + cqService); + LogWriterSupport.getLogWriter().error(ex); AssertionError err = new AssertionError("Failed to execute CQ " + cqName); err.initCause(ex); @@ -366,9 +369,9 @@ public class ClientCQPostAuthorizationDUnitTest extends cqResults = cq1.executeWithInitialResults(); } catch (CqException ce) { if (ce.getCause() instanceof NotAuthorizedException && !postAuthzAllowed[i]) { - getLogWriter().info("Got expected exception for CQ " + cqName); + LogWriterSupport.getLogWriter().info("Got expected exception for CQ " + cqName); } else { - getLogWriter().info("CqService is: " + cqService); + LogWriterSupport.getLogWriter().info("CqService is: " + cqService); ce.printStackTrace(); AssertionError err = new AssertionError("Failed to execute CQ " + cqName); @@ -376,14 +379,14 @@ public class ClientCQPostAuthorizationDUnitTest extends throw err; } } catch (Exception ex) { - getLogWriter().info("CqService is: " + cqService); + LogWriterSupport.getLogWriter().info("CqService is: " + cqService); ex.printStackTrace(); AssertionError err = new AssertionError("Failed to execute CQ " + cqName); err.initCause(ex); throw err; } - getLogWriter().info("initial result size = " + cqResults.size()); + LogWriterSupport.getLogWriter().info("initial result size = " + cqResults.size()); assertTrue("executeWithInitialResults() state mismatch", cq1 .getState().isRunning()); if (expectedResultsSize >= 0) { @@ -395,9 +398,9 @@ public class ClientCQPostAuthorizationDUnitTest extends cq1.execute(); } catch (CqException ce) { if (ce.getCause() instanceof NotAuthorizedException && !postAuthzAllowed[i]) { - getLogWriter().info("Got expected exception for CQ " + cqName); + LogWriterSupport.getLogWriter().info("Got expected exception for CQ " + cqName); } else { - getLogWriter().info("CqService is: " + cqService); + LogWriterSupport.getLogWriter().info("CqService is: " + cqService); ce.printStackTrace(); AssertionError err = new AssertionError("Failed to execute CQ " + cqName); @@ -409,7 +412,7 @@ public class ClientCQPostAuthorizationDUnitTest extends + cqName); err.initCause(ex); if (expectedErr == null) { - getLogWriter().info("CqService is: " + cqService, err); + LogWriterSupport.getLogWriter().info("CqService is: " + cqService, err); } throw err; } @@ -492,7 +495,7 @@ public class ClientCQPostAuthorizationDUnitTest extends + " CQs to be registered on this server."; } }; - DistributedTestCase.waitForCriterion(wc, 60 * 1000, 100, false); + Wait.waitForCriterion(wc, 60 * 1000, 100, false); } public static void checkCQListeners(Integer numOfUsers, http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientPostAuthorizationDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientPostAuthorizationDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientPostAuthorizationDUnitTest.java index bd22dfb..6642124 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientPostAuthorizationDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientPostAuthorizationDUnitTest.java @@ -27,6 +27,7 @@ import security.CredentialGenerator; import com.gemstone.gemfire.cache.operations.OperationContext.OperationCode; import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.LogWriterSupport; /** * Tests for authorization from client to server. This tests for authorization @@ -126,10 +127,10 @@ public class ClientPostAuthorizationDUnitTest extends String accessor = gen.getAuthorizationCallback(); TestAuthzCredentialGenerator tgen = new TestAuthzCredentialGenerator(gen); - getLogWriter().info("testAllPostOps: Using authinit: " + authInit); - getLogWriter().info( + LogWriterSupport.getLogWriter().info("testAllPostOps: Using authinit: " + authInit); + LogWriterSupport.getLogWriter().info( "testAllPostOps: Using authenticator: " + authenticator); - getLogWriter().info("testAllPostOps: Using accessor: " + accessor); + LogWriterSupport.getLogWriter().info("testAllPostOps: Using accessor: " + accessor); // Start servers with all required properties Properties serverProps = buildProperties(authenticator, accessor, true, @@ -315,7 +316,7 @@ public class ClientPostAuthorizationDUnitTest extends OperationWithAction.OPBLOCK_NO_FAILOVER }; AuthzCredentialGenerator gen = getXmlAuthzGenerator(); - getLogWriter().info("Executing opblocks with credential generator " + gen); + LogWriterSupport.getLogWriter().info("Executing opblocks with credential generator " + gen); CredentialGenerator cGen = gen.getCredentialGenerator(); Properties extraAuthProps = cGen.getSystemProperties(); Properties javaProps = cGen.getJavaProperties(); @@ -325,11 +326,11 @@ public class ClientPostAuthorizationDUnitTest extends String accessor = gen.getAuthorizationCallback(); TestAuthzCredentialGenerator tgen = new TestAuthzCredentialGenerator(gen); - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "testAllOpsNotifications: Using authinit: " + authInit); - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "testAllOpsNotifications: Using authenticator: " + authenticator); - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "testAllOpsNotifications: Using accessor: " + accessor); // Start servers with all required properties http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-cq/src/test/java/com/gemstone/gemfire/security/MultiuserAPIDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/MultiuserAPIDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/MultiuserAPIDUnitTest.java index 26f2e31..5997562 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/MultiuserAPIDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/MultiuserAPIDUnitTest.java @@ -36,7 +36,9 @@ import com.gemstone.gemfire.cache.query.Query; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.internal.cache.PoolManagerImpl; +import com.gemstone.gemfire.test.dunit.Assert; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.LogWriterSupport; import com.gemstone.gemfire.test.dunit.VM; import security.DummyCredentialGenerator; @@ -136,11 +138,11 @@ public class MultiuserAPIDUnitTest extends ClientAuthorizationTestBase { String authenticator = gen.getAuthenticator(); String authInit = gen.getAuthInit(); - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "testValidCredentials: Using scheme: " + gen.classCode()); - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "testValidCredentials: Using authenticator: " + authenticator); - getLogWriter().info("testValidCredentials: Using authinit: " + authInit); + LogWriterSupport.getLogWriter().info("testValidCredentials: Using authinit: " + authInit); // Start the servers Integer locPort1 = SecurityTestUtil.getLocatorPort(); @@ -156,12 +158,12 @@ public class MultiuserAPIDUnitTest extends ClientAuthorizationTestBase { // Start the clients with valid credentials Properties credentials1 = gen.getValidCredentials(1); Properties javaProps1 = gen.getJavaProperties(); - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "testValidCredentials: For first client credentials: " + credentials1 + " : " + javaProps1); Properties credentials2 = gen.getValidCredentials(2); Properties javaProps2 = gen.getJavaProperties(); - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "testValidCredentials: For second client credentials: " + credentials2 + " : " + javaProps2); client1.invoke(MultiuserAPIDUnitTest.class, "createCacheClient", @@ -198,7 +200,7 @@ public class MultiuserAPIDUnitTest extends ClientAuthorizationTestBase { Log.getLogWriter().info(op + ": Got expected exception: " + uoe); success = true; } catch (Exception e) { - fail("Got unexpected exception while doing " + op, e); + Assert.fail("Got unexpected exception while doing " + op, e); } if (!success) { fail("Did not get exception while doing " + op); @@ -369,7 +371,7 @@ public class MultiuserAPIDUnitTest extends ClientAuthorizationTestBase { Log.getLogWriter().info(op + ": Got expected exception: " + uoe); success = true; } catch (Exception e) { - fail("Got unexpected exception while doing " + op, e); + Assert.fail("Got unexpected exception while doing " + op, e); } if (!success) { fail("Did not get exception while doing " + op); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-cq/src/test/java/com/gemstone/gemfire/security/MultiuserDurableCQAuthzDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/MultiuserDurableCQAuthzDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/MultiuserDurableCQAuthzDUnitTest.java index 675f8c6..082d352 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/MultiuserDurableCQAuthzDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/MultiuserDurableCQAuthzDUnitTest.java @@ -39,6 +39,8 @@ import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.internal.logging.InternalLogWriter; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.Invoke; +import com.gemstone.gemfire.test.dunit.LogWriterSupport; import com.gemstone.gemfire.test.dunit.SerializableRunnable; /** @@ -62,7 +64,7 @@ public class MultiuserDurableCQAuthzDUnitTest extends public void setUp() throws Exception { super.setUp(); getSystem(); - invokeInEveryVM(new SerializableRunnable("getSystem") { + Invoke.invokeInEveryVM(new SerializableRunnable("getSystem") { public void run() { getSystem(); } @@ -318,7 +320,7 @@ public class MultiuserDurableCQAuthzDUnitTest extends + SecurityTestUtil.proxyCaches[i].getRegion(regionName).getFullPath(); // Create CQ Attributes. CqAttributesFactory cqf = new CqAttributesFactory(); - CqListener[] cqListeners = {new CqQueryTestListener(getLogWriter())}; + CqListener[] cqListeners = {new CqQueryTestListener(LogWriterSupport.getLogWriter())}; ((CqQueryTestListener)cqListeners[0]).cqName = cqName; cqf.initCqListeners(cqListeners); @@ -332,7 +334,7 @@ public class MultiuserDurableCQAuthzDUnitTest extends AssertionError err = new AssertionError("Failed to create CQ " + cqName + " . "); err.initCause(ex); - getLogWriter().info("CqService is :" + cqService, err); + LogWriterSupport.getLogWriter().info("CqService is :" + cqService, err); throw err; } } @@ -360,16 +362,16 @@ public class MultiuserDurableCQAuthzDUnitTest extends try { cq1 = cqService.getCq(cqName); if (cq1 == null) { - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "Failed to get CqQuery object for CQ name: " + cqName); fail("Failed to get CQ " + cqName); } else { - getLogWriter().info("Obtained CQ, CQ name: " + cq1.getName()); + LogWriterSupport.getLogWriter().info("Obtained CQ, CQ name: " + cq1.getName()); assertTrue("newCq() state mismatch", cq1.getState().isStopped()); } } catch (Exception ex) { - getLogWriter().info("CqService is :" + cqService); - getLogWriter().error(ex); + LogWriterSupport.getLogWriter().info("CqService is :" + cqService); + LogWriterSupport.getLogWriter().error(ex); AssertionError err = new AssertionError("Failed to execute CQ " + cqName); err.initCause(ex); @@ -382,14 +384,14 @@ public class MultiuserDurableCQAuthzDUnitTest extends try { cqResults = cq1.executeWithInitialResults(); } catch (Exception ex) { - getLogWriter().info("CqService is: " + cqService); + LogWriterSupport.getLogWriter().info("CqService is: " + cqService); ex.printStackTrace(); AssertionError err = new AssertionError("Failed to execute CQ " + cqName); err.initCause(ex); throw err; } - getLogWriter().info("initial result size = " + cqResults.size()); + LogWriterSupport.getLogWriter().info("initial result size = " + cqResults.size()); assertTrue("executeWithInitialResults() state mismatch", cq1 .getState().isRunning()); if (expectedResultsSize >= 0) { @@ -404,7 +406,7 @@ public class MultiuserDurableCQAuthzDUnitTest extends + cqName); err.initCause(ex); if (expectedErr == null) { - getLogWriter().info("CqService is: " + cqService, err); + LogWriterSupport.getLogWriter().info("CqService is: " + cqService, err); } throw err; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/UpdateVersionDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/UpdateVersionDUnitTest.java b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/UpdateVersionDUnitTest.java index 7cb5c0b..f4e87f8 100644 --- a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/UpdateVersionDUnitTest.java +++ b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/UpdateVersionDUnitTest.java @@ -54,10 +54,15 @@ import com.gemstone.gemfire.internal.cache.versions.VersionStamp; import com.gemstone.gemfire.internal.cache.versions.VersionTag; import com.gemstone.gemfire.internal.cache.wan.InternalGatewaySenderFactory; import com.gemstone.gemfire.test.dunit.DistributedTestCase; +import com.gemstone.gemfire.test.dunit.IgnoredException; +import com.gemstone.gemfire.test.dunit.Invoke; +import com.gemstone.gemfire.test.dunit.LogWriterSupport; import com.gemstone.gemfire.test.dunit.Host; import com.gemstone.gemfire.test.dunit.SerializableCallable; import com.gemstone.gemfire.test.dunit.SerializableRunnable; import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.Wait; +import com.gemstone.gemfire.test.dunit.WaitCriterion; /** * @author Shobhit Agarwal @@ -67,7 +72,7 @@ public class UpdateVersionDUnitTest extends DistributedTestCase { protected static final String regionName = "testRegion"; protected static Cache cache; - private static SetexpectedExceptions = new HashSet(); + private static SetexpectedExceptions = new HashSet(); @@ -78,7 +83,7 @@ public class UpdateVersionDUnitTest extends DistributedTestCase { public void tearDown2() throws Exception { super.tearDown2(); closeCache(); - invokeInEveryVM(new SerializableRunnable() { public void run() { + Invoke.invokeInEveryVM(new SerializableRunnable() { public void run() { closeCache(); } }); } @@ -184,7 +189,7 @@ public class UpdateVersionDUnitTest extends DistributedTestCase { throw new RuntimeException("unexpected exception", e); } if (entry != null) { - getLogWriter().info("found entry " + entry); + LogWriterSupport.getLogWriter().info("found entry " + entry); } return (entry != null); } @@ -193,7 +198,7 @@ public class UpdateVersionDUnitTest extends DistributedTestCase { return "Expected "+key+" to be received on remote WAN site"; } }; - DistributedTestCase.waitForCriterion(wc, 30000, 500, true); + Wait.waitForCriterion(wc, 30000, 500, true); wc = new WaitCriterion() { public boolean done() { @@ -206,7 +211,7 @@ public class UpdateVersionDUnitTest extends DistributedTestCase { return "waiting for timestamp to be updated"; } }; - DistributedTestCase.waitForCriterion(wc, 30000, 500, true); + Wait.waitForCriterion(wc, 30000, 500, true); Entry entry = region.getEntry(key); assertTrue("entry class is wrong: " + entry, entry instanceof EntrySnapshot); @@ -318,7 +323,7 @@ public class UpdateVersionDUnitTest extends DistributedTestCase { return "Expected key-1 to be received on remote WAN site"; } }; - DistributedTestCase.waitForCriterion(wc, 30000, 500, true); + Wait.waitForCriterion(wc, 30000, 500, true); wc = new WaitCriterion() { public boolean done() { @@ -331,7 +336,7 @@ public class UpdateVersionDUnitTest extends DistributedTestCase { return "waiting for timestamp to be updated"; } }; - DistributedTestCase.waitForCriterion(wc, 30000, 500, true); + Wait.waitForCriterion(wc, 30000, 500, true); Entry entry = region.getEntry(key); assertTrue(entry instanceof NonTXEntry); @@ -448,7 +453,7 @@ public class UpdateVersionDUnitTest extends DistributedTestCase { throw new RuntimeException("unexpected exception", e); } if (entry != null) { - getLogWriter().info("found entry " + entry); + LogWriterSupport.getLogWriter().info("found entry " + entry); } return (entry != null); } @@ -457,7 +462,7 @@ public class UpdateVersionDUnitTest extends DistributedTestCase { return "Expected key-1 to be received on remote WAN site"; } }; - DistributedTestCase.waitForCriterion(wc, 30000, 500, true); + Wait.waitForCriterion(wc, 30000, 500, true); wc = new WaitCriterion() { public boolean done() { @@ -470,7 +475,7 @@ public class UpdateVersionDUnitTest extends DistributedTestCase { return "waiting for timestamp to be updated"; } }; - DistributedTestCase.waitForCriterion(wc, 30000, 500, true); + Wait.waitForCriterion(wc, 30000, 500, true); Entry entry = region.getEntry(key); assertTrue(entry instanceof EntrySnapshot); @@ -587,7 +592,7 @@ public class UpdateVersionDUnitTest extends DistributedTestCase { throw new RuntimeException("unexpected exception", e); } if (entry != null) { - getLogWriter().info("found entry " + entry); + LogWriterSupport.getLogWriter().info("found entry " + entry); } return (entry != null); } @@ -596,7 +601,7 @@ public class UpdateVersionDUnitTest extends DistributedTestCase { return "Expected key-1 to be received on remote WAN site"; } }; - DistributedTestCase.waitForCriterion(wc, 30000, 500, true); + Wait.waitForCriterion(wc, 30000, 500, true); wc = new WaitCriterion() { public boolean done() { @@ -609,7 +614,7 @@ public class UpdateVersionDUnitTest extends DistributedTestCase { return "waiting for timestamp to be updated"; } }; - DistributedTestCase.waitForCriterion(wc, 30000, 500, true); + Wait.waitForCriterion(wc, 30000, 500, true); Entry entry = region.getEntry(key); assertTrue(entry instanceof EntrySnapshot); @@ -650,22 +655,22 @@ public class UpdateVersionDUnitTest extends DistributedTestCase { Properties props = new Properties(); props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + locPort + "]"); - props.setProperty(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel()); + props.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterSupport.getDUnitLogLevel()); props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false"); props.setProperty(DistributionConfig.USE_CLUSTER_CONFIGURATION_NAME, "false"); InternalDistributedSystem ds = test.getSystem(props); cache = CacheFactory.create(ds); - ExpectedException ex = new ExpectedException("could not get remote locator information for remote site"); + IgnoredException ex = new IgnoredException("could not get remote locator information for remote site"); cache.getLogger().info(ex.getAddMessage()); expectedExceptions.add(ex); - ex = new ExpectedException("Pool ln1 is not available"); + ex = new IgnoredException("Pool ln1 is not available"); cache.getLogger().info(ex.getAddMessage()); expectedExceptions.add(ex); } private static void closeCache() { if (cache != null && !cache.isClosed()) { - for (ExpectedException expectedException: expectedExceptions) { + for (IgnoredException expectedException: expectedExceptions) { cache.getLogger().info(expectedException.getRemoveMessage()); } expectedExceptions.clear(); @@ -781,7 +786,7 @@ public class UpdateVersionDUnitTest extends DistributedTestCase { return "Expected sender isRunning state to be true but is false"; } }; - DistributedTestCase.waitForCriterion(wc, 300000, 500, true); + Wait.waitForCriterion(wc, 300000, 500, true); } public static Integer createFirstRemoteLocator(int dsId, int remoteLocPort) { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/WANTestBase.java ---------------------------------------------------------------------- diff --git a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/WANTestBase.java b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/WANTestBase.java index f0c01ab..b984425 100644 --- a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/WANTestBase.java +++ b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/WANTestBase.java @@ -115,8 +115,13 @@ import com.gemstone.gemfire.internal.cache.wan.parallel.ParallelGatewaySenderQue import com.gemstone.gemfire.pdx.SimpleClass; import com.gemstone.gemfire.pdx.SimpleClass1; import com.gemstone.gemfire.test.dunit.DistributedTestCase; +import com.gemstone.gemfire.test.dunit.IgnoredException; +import com.gemstone.gemfire.test.dunit.Invoke; +import com.gemstone.gemfire.test.dunit.LogWriterSupport; import com.gemstone.gemfire.test.dunit.Host; import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.Wait; +import com.gemstone.gemfire.test.dunit.WaitCriterion; import com.gemstone.gemfire.util.test.TestUtil; import com.jayway.awaitility.Awaitility; @@ -182,11 +187,11 @@ public class WANTestBase extends DistributedTestCase{ //this is done to vary the number of dispatchers for sender //during every test method run shuffleNumDispatcherThreads(); - invokeInEveryVM(WANTestBase.class,"setNumDispatcherThreadsForTheRun", + Invoke.invokeInEveryVM(WANTestBase.class,"setNumDispatcherThreadsForTheRun", new Object[]{dispatcherThreads.get(0)}); - addExpectedException("Connection refused"); - addExpectedException("Software caused connection abort"); - addExpectedException("Connection reset"); + IgnoredException.addIgnoredException("Connection refused"); + IgnoredException.addIgnoredException("Software caused connection abort"); + IgnoredException.addIgnoredException("Connection reset"); } public static void shuffleNumDispatcherThreads() { @@ -350,11 +355,11 @@ public class WANTestBase extends DistributedTestCase{ } public static void createReplicatedRegion(String regionName, String senderIds, Boolean offHeap){ - ExpectedException exp = addExpectedException(ForceReattemptException.class + IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); - ExpectedException exp1 = addExpectedException(InterruptedException.class + IgnoredException exp1 = IgnoredException.addIgnoredException(InterruptedException.class .getName()); - ExpectedException exp2 = addExpectedException(GatewaySenderException.class + IgnoredException exp2 = IgnoredException.addIgnoredException(GatewaySenderException.class .getName()); try { AttributesFactory fact = new AttributesFactory(); @@ -455,7 +460,7 @@ public class WANTestBase extends DistributedTestCase{ public static void createReplicatedRegionWithAsyncEventQueue( String regionName, String asyncQueueIds, Boolean offHeap) { - ExpectedException exp1 = addExpectedException(ForceReattemptException.class + IgnoredException exp1 = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); try { AttributesFactory fact = new AttributesFactory(); @@ -498,7 +503,7 @@ public class WANTestBase extends DistributedTestCase{ public static void createReplicatedRegionWithSenderAndAsyncEventQueue( String regionName, String senderIds, String asyncChannelId, Boolean offHeap) { - ExpectedException exp = addExpectedException(ForceReattemptException.class + IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); try { @@ -654,7 +659,7 @@ public class WANTestBase extends DistributedTestCase{ Integer batchSize, boolean isConflation, boolean isPersistent, String diskStoreName, boolean isDiskSynchronous, int nDispatchers) { - ExpectedException exp = addExpectedException(ForceReattemptException.class + IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); try { @@ -730,7 +735,7 @@ public class WANTestBase extends DistributedTestCase{ } else { persistentDirectory = new File(diskStoreName); } - getLogWriter().info("The ds is : " + persistentDirectory.getName()); + LogWriterSupport.getLogWriter().info("The ds is : " + persistentDirectory.getName()); persistentDirectory.mkdir(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); File [] dirs1 = new File[] {persistentDirectory}; @@ -848,7 +853,7 @@ public class WANTestBase extends DistributedTestCase{ final Set queues = ((AbstractGatewaySender) sender) .getQueues(); - waitForCriterion(new WaitCriterion() { + Wait.waitForCriterion(new WaitCriterion() { public String description() { return "Waiting for EventQueue size to be " + numQueueEntries; @@ -870,9 +875,9 @@ public class WANTestBase extends DistributedTestCase{ } public static void createPartitionedRegion(String regionName, String senderIds, Integer redundantCopies, Integer totalNumBuckets, Boolean offHeap){ - ExpectedException exp = addExpectedException(ForceReattemptException.class + IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); - ExpectedException exp1 = addExpectedException(PartitionOfflineException.class + IgnoredException exp1 = IgnoredException.addIgnoredException(PartitionOfflineException.class .getName()); try { AttributesFactory fact = new AttributesFactory(); @@ -903,9 +908,9 @@ public class WANTestBase extends DistributedTestCase{ // TODO:OFFHEAP: add offheap flavor public static void createPartitionedRegionWithPersistence(String regionName, String senderIds, Integer redundantCopies, Integer totalNumBuckets) { - ExpectedException exp = addExpectedException(ForceReattemptException.class + IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); - ExpectedException exp1 = addExpectedException(PartitionOfflineException.class + IgnoredException exp1 = IgnoredException.addIgnoredException(PartitionOfflineException.class .getName()); try { AttributesFactory fact = new AttributesFactory(); @@ -934,9 +939,9 @@ public class WANTestBase extends DistributedTestCase{ } public static void createColocatedPartitionedRegion(String regionName, String senderIds, Integer redundantCopies, Integer totalNumBuckets, String colocatedWith) { - ExpectedException exp = addExpectedException(ForceReattemptException.class + IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); - ExpectedException exp1 = addExpectedException(PartitionOfflineException.class + IgnoredException exp1 = IgnoredException.addIgnoredException(PartitionOfflineException.class .getName()); try { AttributesFactory fact = new AttributesFactory(); @@ -982,9 +987,9 @@ public class WANTestBase extends DistributedTestCase{ public static void createPartitionedRegionWithAsyncEventQueue( String regionName, String asyncEventQueueId, Boolean offHeap) { - ExpectedException exp = addExpectedException(ForceReattemptException.class + IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); - ExpectedException exp1 = addExpectedException(PartitionOfflineException.class + IgnoredException exp1 = IgnoredException.addIgnoredException(PartitionOfflineException.class .getName()); try { AttributesFactory fact = new AttributesFactory(); @@ -1006,9 +1011,9 @@ public class WANTestBase extends DistributedTestCase{ public static void createColocatedPartitionedRegionWithAsyncEventQueue( String regionName, String asyncEventQueueId, Integer totalNumBuckets, String colocatedWith) { - ExpectedException exp = addExpectedException(ForceReattemptException.class + IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); - ExpectedException exp1 = addExpectedException(PartitionOfflineException.class + IgnoredException exp1 = IgnoredException.addIgnoredException(PartitionOfflineException.class .getName()); try { AttributesFactory fact = new AttributesFactory(); @@ -1051,7 +1056,7 @@ public class WANTestBase extends DistributedTestCase{ */ public static void createPRWithRedundantCopyWithAsyncEventQueue( String regionName, String asyncEventQueueId, Boolean offHeap) { - ExpectedException exp = addExpectedException(ForceReattemptException.class + IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); try { @@ -1141,9 +1146,9 @@ public class WANTestBase extends DistributedTestCase{ Integer totalNumBuckets, Boolean offHeap){ - ExpectedException exp = addExpectedException(ForceReattemptException.class + IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); - ExpectedException exp1 = addExpectedException(PartitionOfflineException.class + IgnoredException exp1 = IgnoredException.addIgnoredException(PartitionOfflineException.class .getName()); try { @@ -1175,7 +1180,7 @@ public class WANTestBase extends DistributedTestCase{ public static void createCustomerOrderShipmentPartitionedRegion( String regionName, String senderIds, Integer redundantCopies, Integer totalNumBuckets, Boolean offHeap) { - ExpectedException exp = addExpectedException(ForceReattemptException.class + IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); try { AttributesFactory fact = new AttributesFactory(); @@ -1201,7 +1206,7 @@ public class WANTestBase extends DistributedTestCase{ customerRegion = (PartitionedRegion)cache.createRegionFactory( fact.create()).create(customerRegionName); assertNotNull(customerRegion); - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "Partitioned Region CUSTOMER created Successfully :" + customerRegion.toString()); @@ -1226,7 +1231,7 @@ public class WANTestBase extends DistributedTestCase{ orderRegion = (PartitionedRegion)cache.createRegionFactory(fact.create()) .create(orderRegionName); assertNotNull(orderRegion); - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "Partitioned Region ORDER created Successfully :" + orderRegion.toString()); @@ -1251,7 +1256,7 @@ public class WANTestBase extends DistributedTestCase{ shipmentRegion = (PartitionedRegion)cache.createRegionFactory( fact.create()).create(shipmentRegionName); assertNotNull(shipmentRegion); - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "Partitioned Region SHIPMENT created Successfully :" + shipmentRegion.toString()); } @@ -1361,7 +1366,7 @@ public class WANTestBase extends DistributedTestCase{ boolean gatewaySslRequireAuth = true; Properties gemFireProps = new Properties(); - gemFireProps.put(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel()); + gemFireProps.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterSupport.getDUnitLogLevel()); gemFireProps.put(DistributionConfig.GATEWAY_SSL_ENABLED_NAME, String.valueOf(gatewaySslenabled)); gemFireProps.put(DistributionConfig.GATEWAY_SSL_PROTOCOLS_NAME, gatewaySslprotocols); gemFireProps.put(DistributionConfig.GATEWAY_SSL_CIPHERS_NAME, gatewaySslciphers); @@ -1378,7 +1383,7 @@ public class WANTestBase extends DistributedTestCase{ gemFireProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); gemFireProps.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + locPort + "]"); - getLogWriter().info("Starting cache ds with following properties \n" + gemFireProps); + LogWriterSupport.getLogWriter().info("Starting cache ds with following properties \n" + gemFireProps); InternalDistributedSystem ds = test.getSystem(gemFireProps); cache = CacheFactory.create(ds); @@ -1433,7 +1438,7 @@ public class WANTestBase extends DistributedTestCase{ server1.start(); } catch (IOException e) { - fail("Failed to start the Server", e); + com.gemstone.gemfire.test.dunit.Assert.fail("Failed to start the Server", e); } assertTrue(server1.isRunning()); @@ -1467,11 +1472,11 @@ public class WANTestBase extends DistributedTestCase{ } public static void startSender(String senderId) { - final ExpectedException exln = addExpectedException("Could not connect"); + final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect"); - ExpectedException exp = addExpectedException(ForceReattemptException.class + IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); - ExpectedException exp1 = addExpectedException(InterruptedException.class + IgnoredException exp1 = IgnoredException.addIgnoredException(InterruptedException.class .getName()); try { Set senders = cache.getGatewaySenders(); @@ -1569,7 +1574,7 @@ public class WANTestBase extends DistributedTestCase{ + " but actual entries: " + regionQueue.size(); } }; - DistributedTestCase.waitForCriterion(wc, 120000, 500, true); + Wait.waitForCriterion(wc, 120000, 500, true); } ArrayList stats = new ArrayList(); stats.add(statistics.getEventQueueSize()); @@ -1871,7 +1876,7 @@ public class WANTestBase extends DistributedTestCase{ } public static void waitForSenderRunningState(String senderId){ - final ExpectedException exln = addExpectedException("Could not connect"); + final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect"); try { Set senders = cache.getGatewaySenders(); final GatewaySender sender = getGatewaySenderById(senders, senderId); @@ -1888,7 +1893,7 @@ public class WANTestBase extends DistributedTestCase{ return "Expected sender isRunning state to be true but is false"; } }; - DistributedTestCase.waitForCriterion(wc, 300000, 500, true); + Wait.waitForCriterion(wc, 300000, 500, true); } finally { exln.remove(); } @@ -1909,7 +1914,7 @@ public class WANTestBase extends DistributedTestCase{ return "Expected sender primary state to be true but is false"; } }; - DistributedTestCase.waitForCriterion(wc, 10000, 1000, true); + Wait.waitForCriterion(wc, 10000, 1000, true); } private static GatewaySender getGatewaySenderById(Set senders, String senderId) { @@ -1951,7 +1956,7 @@ public class WANTestBase extends DistributedTestCase{ return "Expected seconadry map to be " + primaryUpdatesMap + " but it is " + secondaryUpdatesMap; } }; - DistributedTestCase.waitForCriterion(wc, 300000, 500, true); + Wait.waitForCriterion(wc, 300000, 500, true); } public static HashMap checkQueue2(){ @@ -2149,8 +2154,8 @@ public class WANTestBase extends DistributedTestCase{ } public static void pauseSender(String senderId) { - final ExpectedException exln = addExpectedException("Could not connect"); - ExpectedException exp = addExpectedException(ForceReattemptException.class + final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect"); + IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); try { Set senders = cache.getGatewaySenders(); @@ -2170,8 +2175,8 @@ public class WANTestBase extends DistributedTestCase{ } public static void pauseSenderAndWaitForDispatcherToPause(String senderId) { - final ExpectedException exln = addExpectedException("Could not connect"); - ExpectedException exp = addExpectedException(ForceReattemptException.class + final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect"); + IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); try { Set senders = cache.getGatewaySenders(); @@ -2191,8 +2196,8 @@ public class WANTestBase extends DistributedTestCase{ } public static void resumeSender(String senderId) { - final ExpectedException exln = addExpectedException("Could not connect"); - ExpectedException exp = addExpectedException(ForceReattemptException.class + final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect"); + IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); try { Set senders = cache.getGatewaySenders(); @@ -2212,8 +2217,8 @@ public class WANTestBase extends DistributedTestCase{ } public static void stopSender(String senderId) { - final ExpectedException exln = addExpectedException("Could not connect"); - ExpectedException exp = addExpectedException(ForceReattemptException.class + final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect"); + IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); try { Set senders = cache.getGatewaySenders(); @@ -2254,7 +2259,7 @@ public class WANTestBase extends DistributedTestCase{ boolean isParallel, Integer maxMemory, Integer batchSize, boolean isConflation, boolean isPersistent, GatewayEventFilter filter, boolean isManulaStart) { - final ExpectedException exln = addExpectedException("Could not connect"); + final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect"); try { File persistentDirectory = new File(dsName + "_disk_" + System.currentTimeMillis() + "_" + VM.getCurrentVMNum()); @@ -2319,7 +2324,7 @@ public class WANTestBase extends DistributedTestCase{ boolean isParallel, Integer maxMemory, Integer batchSize, boolean isConflation, boolean isPersistent, GatewayEventFilter filter, boolean isManulaStart, int numDispatchers, OrderPolicy orderPolicy) { - final ExpectedException exln = addExpectedException("Could not connect"); + final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect"); try { File persistentDirectory = new File(dsName + "_disk_" + System.currentTimeMillis() + "_" + VM.getCurrentVMNum()); @@ -2504,7 +2509,7 @@ public class WANTestBase extends DistributedTestCase{ List eventfilters, List tranportFilters, boolean isManulaStart, boolean isDiskSync) { - ExpectedException exp1 = addExpectedException(RegionDestroyedException.class + IgnoredException exp1 = IgnoredException.addIgnoredException(RegionDestroyedException.class .getName()); try { File persistentDirectory = new File(dsName + "_disk_" @@ -2596,7 +2601,7 @@ public class WANTestBase extends DistributedTestCase{ else { persistentDirectory = new File(dsStore); } - getLogWriter().info("The ds is : " + persistentDirectory.getName()); + LogWriterSupport.getLogWriter().info("The ds is : " + persistentDirectory.getName()); persistentDirectory.mkdir(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); @@ -2618,12 +2623,12 @@ public class WANTestBase extends DistributedTestCase{ gateway.setPersistenceEnabled(true); String dsname = dsf.setDiskDirs(dirs1).create(dsName).getName(); gateway.setDiskStoreName(dsname); - getLogWriter().info("The DiskStoreName is : " + dsname); + LogWriterSupport.getLogWriter().info("The DiskStoreName is : " + dsname); } else { DiskStore store = dsf.setDiskDirs(dirs1).create(dsName); gateway.setDiskStoreName(store.getName()); - getLogWriter().info("The ds is : " + store.getName()); + LogWriterSupport.getLogWriter().info("The ds is : " + store.getName()); } gateway.setBatchConflationEnabled(isConflation); gateway.create(dsName, remoteDsId); @@ -2733,7 +2738,7 @@ public class WANTestBase extends DistributedTestCase{ return "Expected to wait for " + millisec + " millisec."; } }; - DistributedTestCase.waitForCriterion(wc, millisec, 500, false); + Wait.waitForCriterion(wc, millisec, 500, false); } public static int createReceiver(int locPort) { @@ -2766,7 +2771,7 @@ public class WANTestBase extends DistributedTestCase{ WANTestBase test = new WANTestBase(testName); Properties props = new Properties(); props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); - props.setProperty(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel()); + props.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterSupport.getDUnitLogLevel()); props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + locPort + "]"); @@ -2784,7 +2789,7 @@ public class WANTestBase extends DistributedTestCase{ fail("Expected GatewayReciever Exception"); } catch (GatewayReceiverException gRE){ - getLogWriter().fine("KBKBKB : got the GatewayReceiverException", gRE); + LogWriterSupport.getLogWriter().fine("KBKBKB : got the GatewayReceiverException", gRE); assertTrue(gRE.getMessage().contains("Failed to create server socket on")); } catch (IOException e) { @@ -2802,7 +2807,7 @@ public class WANTestBase extends DistributedTestCase{ Properties gemFireProps = new Properties(); - gemFireProps.put(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel()); + gemFireProps.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterSupport.getDUnitLogLevel()); gemFireProps.put(DistributionConfig.GATEWAY_SSL_ENABLED_NAME, String.valueOf(gatewaySslenabled)); gemFireProps.put(DistributionConfig.GATEWAY_SSL_PROTOCOLS_NAME, gatewaySslprotocols); gemFireProps.put(DistributionConfig.GATEWAY_SSL_CIPHERS_NAME, gatewaySslciphers); @@ -2819,7 +2824,7 @@ public class WANTestBase extends DistributedTestCase{ gemFireProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); gemFireProps.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + locPort + "]"); - getLogWriter().info("Starting cache ds with following properties \n" + gemFireProps); + LogWriterSupport.getLogWriter().info("Starting cache ds with following properties \n" + gemFireProps); InternalDistributedSystem ds = test.getSystem(gemFireProps); cache = CacheFactory.create(ds); @@ -2899,7 +2904,7 @@ public class WANTestBase extends DistributedTestCase{ try { server.start(); } catch (IOException e) { - fail("Failed to start server ", e); + com.gemstone.gemfire.test.dunit.Assert.fail("Failed to start server ", e); } } @@ -2915,7 +2920,7 @@ public class WANTestBase extends DistributedTestCase{ } catch (IOException e) { e.printStackTrace(); - fail("Failed to start GatewayRecevier on port " + port, e); + com.gemstone.gemfire.test.dunit.Assert.fail("Failed to start GatewayRecevier on port " + port, e); } return port; } @@ -2937,7 +2942,7 @@ public class WANTestBase extends DistributedTestCase{ try { server.start(); } catch (IOException e) { - fail("Failed to start server ", e); + com.gemstone.gemfire.test.dunit.Assert.fail("Failed to start server ", e); } return port; } @@ -2973,7 +2978,7 @@ public class WANTestBase extends DistributedTestCase{ region = cache.createRegion(regionName, attrs); region.registerInterest("ALL_KEYS"); assertNotNull(region); - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "Distributed Region " + regionName + " created Successfully :" + region.toString()); } @@ -3032,9 +3037,9 @@ public class WANTestBase extends DistributedTestCase{ CacheTransactionManager txMgr = cache.getCacheTransactionManager(); txMgr.setDistributed(true); - ExpectedException exp1 = addExpectedException(InterruptedException.class + IgnoredException exp1 = IgnoredException.addIgnoredException(InterruptedException.class .getName()); - ExpectedException exp2 = addExpectedException(GatewaySenderException.class + IgnoredException exp2 = IgnoredException.addIgnoredException(GatewaySenderException.class .getName()); try { Region r = cache.getRegion(Region.SEPARATOR + regionName); @@ -3054,9 +3059,9 @@ public class WANTestBase extends DistributedTestCase{ } public static void doPuts(String regionName, int numPuts) { - ExpectedException exp1 = addExpectedException(InterruptedException.class + IgnoredException exp1 = IgnoredException.addIgnoredException(InterruptedException.class .getName()); - ExpectedException exp2 = addExpectedException(GatewaySenderException.class + IgnoredException exp2 = IgnoredException.addIgnoredException(GatewaySenderException.class .getName()); try { Region r = cache.getRegion(Region.SEPARATOR + regionName); @@ -3157,7 +3162,7 @@ public class WANTestBase extends DistributedTestCase{ return "Looking for min size of region to be " + min; } }; - DistributedTestCase.waitForCriterion(wc, 30000, 5, false); + Wait.waitForCriterion(wc, 30000, 5, false); r.destroyRegion(); } @@ -3176,13 +3181,13 @@ public class WANTestBase extends DistributedTestCase{ return "Looking for min size of region to be " + min; } }; - DistributedTestCase.waitForCriterion(wc, 30000, 5, false); + Wait.waitForCriterion(wc, 30000, 5, false); r.destroyRegion(); destroyFlag = false; } public static void localDestroyRegion(String regionName) { - ExpectedException exp = addExpectedException(PRLocallyDestroyedException.class + IgnoredException exp = IgnoredException.addIgnoredException(PRLocallyDestroyedException.class .getName()); try { Region r = cache.getRegion(Region.SEPARATOR + regionName); @@ -3219,11 +3224,11 @@ public class WANTestBase extends DistributedTestCase{ custKeyValues.put(custid, customer); } catch (Exception e) { - fail( + com.gemstone.gemfire.test.dunit.Assert.fail( "putCustomerPartitionedRegion : failed while doing put operation in CustomerPartitionedRegion ", e); } - getLogWriter().info("Customer :- { " + custid + " : " + customer + " }"); + LogWriterSupport.getLogWriter().info("Customer :- { " + custid + " : " + customer + " }"); } return custKeyValues; } @@ -3245,11 +3250,11 @@ public class WANTestBase extends DistributedTestCase{ } catch (Exception e) { - fail( + com.gemstone.gemfire.test.dunit.Assert.fail( "putOrderPartitionedRegion : failed while doing put operation in OrderPartitionedRegion ", e); } - getLogWriter().info("Order :- { " + orderId + " : " + order + " }"); + LogWriterSupport.getLogWriter().info("Order :- { " + orderId + " : " + order + " }"); } return orderKeyValues; } @@ -3268,11 +3273,11 @@ public class WANTestBase extends DistributedTestCase{ assertEquals(order, orderRegion.get(custid)); } catch (Exception e) { - fail( + com.gemstone.gemfire.test.dunit.Assert.fail( "putOrderPartitionedRegionUsingCustId : failed while doing put operation in OrderPartitionedRegion ", e); } - getLogWriter().info("Order :- { " + custid + " : " + order + " }"); + LogWriterSupport.getLogWriter().info("Order :- { " + custid + " : " + order + " }"); } return orderKeyValues; } @@ -3295,11 +3300,11 @@ public class WANTestBase extends DistributedTestCase{ } catch (Exception e) { - fail( + com.gemstone.gemfire.test.dunit.Assert.fail( "updateOrderPartitionedRegion : failed while doing put operation in OrderPartitionedRegion ", e); } - getLogWriter().info("Order :- { " + orderId + " : " + order + " }"); + LogWriterSupport.getLogWriter().info("Order :- { " + orderId + " : " + order + " }"); } } return orderKeyValues; @@ -3318,11 +3323,11 @@ public class WANTestBase extends DistributedTestCase{ assertEquals(order, orderRegion.get(custid)); orderKeyValues.put(custid, order); } catch (Exception e) { - fail( + com.gemstone.gemfire.test.dunit.Assert.fail( "updateOrderPartitionedRegionUsingCustId : failed while doing put operation in OrderPartitionedRegion ", e); } - getLogWriter().info("Order :- { " + custid + " : " + order + " }"); + LogWriterSupport.getLogWriter().info("Order :- { " + custid + " : " + order + " }"); } return orderKeyValues; } @@ -3347,11 +3352,11 @@ public class WANTestBase extends DistributedTestCase{ shipmentKeyValue.put(shipmentId, shipment); } catch (Exception e) { - fail( + com.gemstone.gemfire.test.dunit.Assert.fail( "putShipmentPartitionedRegion : failed while doing put operation in ShipmentPartitionedRegion ", e); } - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "Shipment :- { " + shipmentId + " : " + shipment + " }"); } } @@ -3396,11 +3401,11 @@ public class WANTestBase extends DistributedTestCase{ assertEquals(shipment, shipmentRegion.get(custid)); shipmentKeyValue.put(custid, shipment); } catch (Exception e) { - fail( + com.gemstone.gemfire.test.dunit.Assert.fail( "putShipmentPartitionedRegionUsingCustId : failed while doing put operation in ShipmentPartitionedRegion ", e); } - getLogWriter().info("Shipment :- { " + custid + " : " + shipment + " }"); + LogWriterSupport.getLogWriter().info("Shipment :- { " + custid + " : " + shipment + " }"); } return shipmentKeyValue; } @@ -3425,11 +3430,11 @@ public class WANTestBase extends DistributedTestCase{ shipmentKeyValue.put(shipmentId, shipment); } catch (Exception e) { - fail( + com.gemstone.gemfire.test.dunit.Assert.fail( "updateShipmentPartitionedRegion : failed while doing put operation in ShipmentPartitionedRegion ", e); } - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "Shipment :- { " + shipmentId + " : " + shipment + " }"); } } @@ -3450,11 +3455,11 @@ public class WANTestBase extends DistributedTestCase{ assertEquals(shipment, shipmentRegion.get(custid)); shipmentKeyValue.put(custid, shipment); } catch (Exception e) { - fail( + com.gemstone.gemfire.test.dunit.Assert.fail( "updateShipmentPartitionedRegionUsingCustId : failed while doing put operation in ShipmentPartitionedRegion ", e); } - getLogWriter().info("Shipment :- { " + custid + " : " + shipment + " }"); + LogWriterSupport.getLogWriter().info("Shipment :- { " + custid + " : " + shipment + " }"); } return shipmentKeyValue; } @@ -3490,7 +3495,7 @@ public class WANTestBase extends DistributedTestCase{ public static void doNextPuts(String regionName, int start, int numPuts) { //waitForSitesToUpdate(); - ExpectedException exp = addExpectedException(CacheClosedException.class + IgnoredException exp = IgnoredException.addIgnoredException(CacheClosedException.class .getName()); try { Region r = cache.getRegion(Region.SEPARATOR + regionName); @@ -3572,7 +3577,7 @@ public class WANTestBase extends DistributedTestCase{ }; - DistributedTestCase.waitForCriterion(wc, 120000, 500, true); + Wait.waitForCriterion(wc, 120000, 500, true); } } @@ -3666,9 +3671,9 @@ public class WANTestBase extends DistributedTestCase{ } public static void validateRegionSize(String regionName, final int regionSize) { - 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 { @@ -3688,7 +3693,7 @@ public class WANTestBase extends DistributedTestCase{ + " present region keyset " + r.keySet(); } }; - DistributedTestCase.waitForCriterion(wc, 240000, 500, true); + Wait.waitForCriterion(wc, 240000, 500, true); } finally { exp.remove(); exp1.remove(); @@ -3752,7 +3757,7 @@ public class WANTestBase extends DistributedTestCase{ + " but actual entries: " + eventsMap.size(); } }; - DistributedTestCase.waitForCriterion(wc, 60000, 500, true); //TODO:Yogs + Wait.waitForCriterion(wc, 60000, 500, true); //TODO:Yogs } public static void validateCustomAsyncEventListener(String asyncQueueId, @@ -3781,7 +3786,7 @@ public class WANTestBase extends DistributedTestCase{ + " but actual entries: " + eventsMap.size(); } }; - DistributedTestCase.waitForCriterion(wc, 60000, 500, true); // TODO:Yogs + Wait.waitForCriterion(wc, 60000, 500, true); // TODO:Yogs Iterator itr = eventsMap.values().iterator(); while (itr.hasNext()) { @@ -3828,7 +3833,7 @@ public class WANTestBase extends DistributedTestCase{ + size; } }; - DistributedTestCase.waitForCriterion(wc, 60000, 500, true); + Wait.waitForCriterion(wc, 60000, 500, true); } else { WaitCriterion wc = new WaitCriterion() { @@ -3856,7 +3861,7 @@ public class WANTestBase extends DistributedTestCase{ + size; } }; - DistributedTestCase.waitForCriterion(wc, 60000, 500, true); + Wait.waitForCriterion(wc, 60000, 500, true); } } @@ -3879,7 +3884,7 @@ public class WANTestBase extends DistributedTestCase{ for (int bucketId : bucketIds) { List eventsForBucket = bucketToEventsMap .get(bucketId); - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "Events for bucket: " + bucketId + " is " + eventsForBucket); assertNotNull(eventsForBucket); for (int i = 0; i < batchSize; i++) { @@ -3901,7 +3906,7 @@ public class WANTestBase extends DistributedTestCase{ final Map eventsMap = ((MyAsyncEventListener)theListener).getEventsMap(); assertNotNull(eventsMap); - getLogWriter().info("The events map size is " + eventsMap.size()); + LogWriterSupport.getLogWriter().info("The events map size is " + eventsMap.size()); return eventsMap.size(); } @@ -3935,9 +3940,9 @@ public class WANTestBase extends DistributedTestCase{ return "Expected region entries: " + regionSize + " but actual entries: " + r.keySet().size() + " present region keyset " + r.keySet() ; } }; - DistributedTestCase.waitForCriterion(wc, 200000, 500, true); + Wait.waitForCriterion(wc, 200000, 500, true); for(int i = 0 ; i < regionSize; i++){ - getLogWriter().info("For Key : Key_"+i + " : Values : " + r.get("Key_" + i)); + LogWriterSupport.getLogWriter().info("For Key : Key_"+i + " : Values : " + r.get("Key_" + i)); assertEquals(new SimpleClass(i, (byte)i), r.get("Key_" + i)); } } @@ -3957,9 +3962,9 @@ public class WANTestBase extends DistributedTestCase{ return "Expected region entries: " + regionSize + " but actual entries: " + r.keySet().size() + " present region keyset " + r.keySet() ; } }; - DistributedTestCase.waitForCriterion(wc, 200000, 500, true); + Wait.waitForCriterion(wc, 200000, 500, true); for(int i = 0 ; i < regionSize; i++){ - getLogWriter().info("For Key : Key_"+i + " : Values : " + r.get("Key_" + i)); + LogWriterSupport.getLogWriter().info("For Key : Key_"+i + " : Values : " + r.get("Key_" + i)); assertEquals(new SimpleClass1(false, (short) i, "" + i, i,"" +i ,""+ i,i, i), r.get("Key_" + i)); } } @@ -3967,7 +3972,7 @@ public class WANTestBase extends DistributedTestCase{ public static void validateQueueSizeStat(String id, final int queueSize) { final AbstractGatewaySender sender = (AbstractGatewaySender) cache.getGatewaySender(id); - waitForCriterion(new WaitCriterion() { + Wait.waitForCriterion(new WaitCriterion() { @Override public boolean done() { @@ -4020,7 +4025,7 @@ public class WANTestBase extends DistributedTestCase{ return "Expected region size to remain same below a specified limit but actual region size does not remain same or exceeded the specified limit " + sameRegionSizeCounter + " :regionSize " + previousSize; } }; - DistributedTestCase.waitForCriterion(wc, 200000, 500, true); + Wait.waitForCriterion(wc, 200000, 500, true); } public static String getRegionFullPath(String regionName) { @@ -4042,7 +4047,7 @@ public class WANTestBase extends DistributedTestCase{ public boolean done() { for(Object key: keyValues.keySet()) { if (!r.get(key).equals(keyValues.get(key))) { - getLogWriter().info( + LogWriterSupport.getLogWriter().info( "The values are for key " + " " + key + " " + r.get(key) + " in the map " + keyValues.get(key)); return false; @@ -4055,7 +4060,7 @@ public class WANTestBase extends DistributedTestCase{ return "Expected region entries doesn't match"; } }; - DistributedTestCase.waitForCriterion(wc, 120000, 500, true); + Wait.waitForCriterion(wc, 120000, 500, true); } public static void CheckContent(String regionName, final int regionSize) { @@ -4082,7 +4087,7 @@ public class WANTestBase extends DistributedTestCase{ return "Expected region entries: " + regionSize + " but actual entries: " + r.keySet().size(); } }; - DistributedTestCase.waitForCriterion(wc, 120000, 500, true); + Wait.waitForCriterion(wc, 120000, 500, true); } public static void verifyPrimaryStatus(final Boolean isPrimary) { @@ -4102,7 +4107,7 @@ public class WANTestBase extends DistributedTestCase{ return "Expected sender to be : " + isPrimary.booleanValue() + " but actually it is : " + sender.isPrimary(); } }; - DistributedTestCase.waitForCriterion(wc, 120000, 500, true); + Wait.waitForCriterion(wc, 120000, 500, true); } public static Boolean getPrimaryStatus(){ @@ -4121,7 +4126,7 @@ public class WANTestBase extends DistributedTestCase{ return "Checking Primary Status"; } }; - DistributedTestCase.waitForCriterion(wc, 10000, 500, false); + Wait.waitForCriterion(wc, 10000, 500, false); return sender.isPrimary(); } @@ -4189,10 +4194,10 @@ public class WANTestBase extends DistributedTestCase{ } public static Boolean killSender(String senderId){ - final ExpectedException exln = addExpectedException("Could not connect"); - ExpectedException exp = addExpectedException(CacheClosedException.class + final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect"); + IgnoredException exp = IgnoredException.addIgnoredException(CacheClosedException.class .getName()); - ExpectedException exp1 = addExpectedException(ForceReattemptException.class + IgnoredException exp1 = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); try { Set senders = cache.getGatewaySenders(); @@ -4204,7 +4209,7 @@ public class WANTestBase extends DistributedTestCase{ } } if (sender.isPrimary()) { - getLogWriter().info("Gateway sender is killed by a test"); + LogWriterSupport.getLogWriter().info("Gateway sender is killed by a test"); cache.getDistributedSystem().disconnect(); return Boolean.TRUE; } @@ -4226,7 +4231,7 @@ public class WANTestBase extends DistributedTestCase{ } } if (queue.isPrimary()) { - getLogWriter().info("AsyncEventQueue is killed by a test"); + LogWriterSupport.getLogWriter().info("AsyncEventQueue is killed by a test"); cache.getDistributedSystem().disconnect(); return Boolean.TRUE; } @@ -4234,10 +4239,10 @@ public class WANTestBase extends DistributedTestCase{ } public static void killSender(){ - getLogWriter().info("Gateway sender is going to be killed by a test"); + LogWriterSupport.getLogWriter().info("Gateway sender is going to be killed by a test"); cache.close(); cache.getDistributedSystem().disconnect(); - getLogWriter().info("Gateway sender is killed by a test"); + LogWriterSupport.getLogWriter().info("Gateway sender is killed by a test"); } static void waitForSitesToUpdate() { @@ -4249,7 +4254,7 @@ public class WANTestBase extends DistributedTestCase{ return "Waiting for all sites to get updated"; } }; - DistributedTestCase.waitForCriterion(wc, 10000, 500, false); + Wait.waitForCriterion(wc, 10000, 500, false); } public static void checkAllSiteMetaData( @@ -4300,7 +4305,7 @@ public class WANTestBase extends DistributedTestCase{ return "Making sure system is initialized"; } }; - DistributedTestCase.waitForCriterion(wc, 50000, 1000, true); + Wait.waitForCriterion(wc, 50000, 1000, true); assertNotNull(system); // final Map> allSiteMetaData = ((DistributionConfigImpl)system @@ -4339,7 +4344,7 @@ public class WANTestBase extends DistributedTestCase{ + " but actual meta data: " + allSiteMetaData; } }; - DistributedTestCase.waitForCriterion(wc, 300000, 500, true); + Wait.waitForCriterion(wc, 300000, 500, true); return System.currentTimeMillis(); } @@ -4367,9 +4372,9 @@ public class WANTestBase extends DistributedTestCase{ public static void validateQueueContents(final String senderId, final int regionSize) { - ExpectedException exp1 = addExpectedException(InterruptedException.class + IgnoredException exp1 = IgnoredException.addIgnoredException(InterruptedException.class .getName()); - ExpectedException exp2 = addExpectedException(GatewaySenderException.class + IgnoredException exp2 = IgnoredException.addIgnoredException(GatewaySenderException.class .getName()); try { Set senders = cache.getGatewaySenders(); @@ -4403,7 +4408,7 @@ public class WANTestBase extends DistributedTestCase{ + " but actual entries: " + size; } }; - DistributedTestCase.waitForCriterion(wc, 120000, 500, true); + Wait.waitForCriterion(wc, 120000, 500, true); } else if (sender.isParallel()) { final RegionQueue regionQueue; @@ -4422,7 +4427,7 @@ public class WANTestBase extends DistributedTestCase{ + " but actual entries: " + regionQueue.size(); } }; - DistributedTestCase.waitForCriterion(wc, 120000, 500, true); + Wait.waitForCriterion(wc, 120000, 500, true); } } finally { exp1.remove(); @@ -4487,7 +4492,7 @@ public class WANTestBase extends DistributedTestCase{ + " but actual entries: " + size; } }; - DistributedTestCase.waitForCriterion(wc, 120000, 500, true); + Wait.waitForCriterion(wc, 120000, 500, true); } public static Integer getQueueContentSize(final String senderId) { @@ -4535,9 +4540,9 @@ public class WANTestBase extends DistributedTestCase{ public static void validateParallelSenderQueueAllBucketsDrained( final String senderId) { - ExpectedException exp = addExpectedException(RegionDestroyedException.class + IgnoredException exp = IgnoredException.addIgnoredException(RegionDestroyedException.class .getName()); - ExpectedException exp1 = addExpectedException(ForceReattemptException.class + IgnoredException exp1 = IgnoredException.addIgnoredException(ForceReattemptException.class .getName()); try { Set senders = cache.getGatewaySenders(); @@ -4556,7 +4561,7 @@ public class WANTestBase extends DistributedTestCase{ 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; @@ -4570,7 +4575,7 @@ public class WANTestBase extends DistributedTestCase{ + bucket.keySet(); } }; - DistributedTestCase.waitForCriterion(wc, 180000, 50, true); + Wait.waitForCriterion(wc, 180000, 50, true); }// for loop ends } finally { exp.remove();