Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 93ECB2009F9 for ; Tue, 24 May 2016 00:01:13 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 92595160A0E; Mon, 23 May 2016 22:01:13 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 441C2160A2B for ; Tue, 24 May 2016 00:01:12 +0200 (CEST) Received: (qmail 42426 invoked by uid 500); 23 May 2016 22:01:11 -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 42416 invoked by uid 99); 23 May 2016 22:01:11 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 May 2016 22:01:11 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 127F71A5C14 for ; Mon, 23 May 2016 22:01:11 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.221 X-Spam-Level: X-Spam-Status: No, score=-3.221 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.001] autolearn=disabled Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 1cwn5kDKmA5h for ; Mon, 23 May 2016 22:01:06 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with SMTP id DA9265FB23 for ; Mon, 23 May 2016 22:01:04 +0000 (UTC) Received: (qmail 40931 invoked by uid 99); 23 May 2016 22:01:04 -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; Mon, 23 May 2016 22:01:04 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D32E1E5720; Mon, 23 May 2016 22:01:03 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: upthewaterspout@apache.org To: commits@geode.incubator.apache.org Date: Mon, 23 May 2016 22:01:12 -0000 Message-Id: <278dcee12caa47bfaaae983d4665f8ff@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [10/11] incubator-geode git commit: GEODE-1367: Reverted test for LocatorLauncherAssemblyIntegrationTest.java. archived-at: Mon, 23 May 2016 22:01:13 -0000 GEODE-1367: Reverted test for LocatorLauncherAssemblyIntegrationTest.java. Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/8c23fab4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/8c23fab4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/8c23fab4 Branch: refs/heads/feature/GEODE-837 Commit: 8c23fab4b8780f741bf358a560f1d00b16ee9a72 Parents: 6122723 Author: Udo Kohlmeyer Authored: Wed May 18 10:47:32 2016 +1000 Committer: Udo Kohlmeyer Committed: Tue May 24 03:37:40 2016 +1000 ---------------------------------------------------------------------- .../LocatorLauncherAssemblyIntegrationTest.java | 20 ++- .../controllers/RestAPIsWithSSLDUnitTest.java | 77 ++++++----- .../gemfire/management/ManagementTestBase.java | 133 ++++++++----------- 3 files changed, 100 insertions(+), 130 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8c23fab4/geode-assembly/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherAssemblyIntegrationTest.java ---------------------------------------------------------------------- diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherAssemblyIntegrationTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherAssemblyIntegrationTest.java index 81f345d..ac8cf10 100644 --- a/geode-assembly/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherAssemblyIntegrationTest.java +++ b/geode-assembly/src/test/java/com/gemstone/gemfire/distributed/LocatorLauncherAssemblyIntegrationTest.java @@ -142,19 +142,17 @@ public class LocatorLauncherAssemblyIntegrationTest extends AbstractLocatorLaunc this.errorCollector.addError(e); } - Awaitility.await().pollInterval(100, TimeUnit.MILLISECONDS).pollDelay(100, TimeUnit.MILLISECONDS) - .timeout(60, TimeUnit.SECONDS).until(() -> initialThreadCount == Thread.activeCount()); + int finalThreadCount = Integer.MAX_VALUE; // Spin for up to 5 seconds waiting for threads to finish - // for (int i = 0; i < 50 && finalThreadCount > initialThreadCount; i++) { - // try { - // Thread.sleep(100); - // } catch (InterruptedException ex) { - // ignored - // } - // finalThreadCount = Thread.activeCount(); - // } - int finalThreadCount = Thread.activeCount(); + for (int i = 0; i < 50 && finalThreadCount > initialThreadCount; i++) { + try { + Thread.sleep(100); + } catch (InterruptedException ex) { + // ignored + } + finalThreadCount = Thread.activeCount(); + } assertEquals(initialThreadCount, finalThreadCount); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8c23fab4/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java index 331dc9d..9578d35 100644 --- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java +++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java @@ -170,12 +170,15 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { VM client = host.getVM(3); // start locator - int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); + final int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); + final String locatorHostName = NetworkUtils.getServerHostName(locator.getHost()); - locator.invoke("Start Locator", () -> startLocator(NetworkUtils.getServerHostName(locator.getHost()), locatorPort, "")); + locator.invoke("Start Locator", () -> { + startLocator(locatorHostName, locatorPort, ""); + }); // find locators - String locators = NetworkUtils.getServerHostName(locator.getHost()) + "[" + locatorPort + "]"; + String locators = locatorHostName + "[" + locatorPort + "]"; // start manager (peer cache) manager.invoke("StartManager", () -> startManager(locators, new String[] { REGION_NAME }, sslProperties)); @@ -192,7 +195,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { client.invoke("Create ClientCache", () -> { new ClientCacheFactory() .setPdxReadSerialized(true) - .addPoolLocator(NetworkUtils.getServerHostName(locator.getHost()), locatorPort).create(); + .addPoolLocator(locatorHostName, locatorPort).create(); return null; }); @@ -218,10 +221,10 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { // stop the client and make sure the bridge server notifies // stopBridgeMemberVM(client); - helper.closeCache(locator); - helper.closeCache(manager); - helper.closeCache(server); - helper.closeCache(client); + locator.invoke(()-> helper.closeCache()); + manager.invoke(()-> helper.closeCache()); + server.invoke(()-> helper.closeCache()); + client.invoke(()-> helper.closeCache()); } private void sslPropertyConverter(Properties properties, Properties newProperties, String propertyName, String newPropertyName) { @@ -257,7 +260,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { } } - private void startManager(final String locators, final String[] regions, final Properties sslProperties) throws IOException { + private int startManager(final String locators, final String[] regions, final Properties sslProperties) throws IOException { IgnoredException.addIgnoredException("java.net.BindException"); IgnoredException.addIgnoredException("java.rmi.server.ExportException"); @@ -315,6 +318,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { CacheServer server = cache.addCacheServer(); server.setPort(0); server.start(); + return server.getPort(); } private void createRegionInClientCache() { @@ -331,7 +335,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { regionFactory.create(PEOPLE_REGION_NAME); } - private CloseableHttpClient getSSLBasedHTTPClient() throws Exception { + private CloseableHttpClient getSSLBasedHTTPClient(String algo) throws Exception { File jks = findTrustedJKS(); KeyStore clientKeys = KeyStore.getInstance("JKS"); @@ -353,7 +357,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { return httpclient; } - private void validateConnection(String restEndpoint) { + private void validateConnection(String restEndpoint, String algo) { try { // 1. Get on key="1" and validate result. @@ -362,7 +366,8 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { get.addHeader("Content-Type", "application/json"); get.addHeader("Accept", "application/json"); - CloseableHttpClient httpclient = getSSLBasedHTTPClient(); + + CloseableHttpClient httpclient = getSSLBasedHTTPClient(algo); CloseableHttpResponse response = httpclient.execute(get); HttpEntity entity = response.getEntity(); @@ -397,82 +402,76 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath()); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password"); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME, "JKS"); - validateConnection(startInfraWithSSL(props, false)); + String restEndpoint = startInfraWithSSL(props,false); + validateConnection(restEndpoint, "SSL"); } public void testSSLWithoutKeyStoreType() throws Exception { - Properties props = new Properties(); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true"); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath()); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password"); - validateConnection(startInfraWithSSL(props, false)); - + String restEndpoint = startInfraWithSSL(props, false); + validateConnection(restEndpoint, "SSL"); } public void testSSLWithSSLProtocol() throws Exception { - Properties props = new Properties(); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true"); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath()); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password"); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "SSL"); - validateConnection(startInfraWithSSL(props, false)); - + String restEndpoint = startInfraWithSSL(props, false); + validateConnection(restEndpoint, "SSL"); } public void testSSLWithTLSProtocol() throws Exception { - Properties props = new Properties(); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true"); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath()); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password"); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "TLS"); - validateConnection(startInfraWithSSL(props, false)); - + String restEndpoint = startInfraWithSSL(props, false); + validateConnection(restEndpoint, "TLS"); } public void testSSLWithTLSv11Protocol() throws Exception { - Properties props = new Properties(); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true"); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath()); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password"); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "TLSv1.1"); - validateConnection(startInfraWithSSL(props, false)); - + String restEndpoint = startInfraWithSSL(props, false); + validateConnection(restEndpoint, "TLSv1.1"); } public void testSSLWithTLSv12Protocol() throws Exception { - Properties props = new Properties(); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true"); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath()); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password"); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "TLSv1.2"); - validateConnection(startInfraWithSSL(props, false)); - + String restEndpoint = startInfraWithSSL(props, false); + validateConnection(restEndpoint, "TLSv1.2"); } public void testWithMultipleProtocol() throws Exception { - Properties props = new Properties(); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true"); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath()); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password"); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "SSL,TLSv1.2"); - validateConnection(startInfraWithSSL(props, false)); - + String restEndpoint = startInfraWithSSL(props, false); + validateConnection(restEndpoint, "TLSv1.2"); } public void testSSLWithCipherSuite() throws Exception { - System.setProperty("javax.net.debug", "ssl"); Properties props = new Properties(); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true"); @@ -487,12 +486,11 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_CIPHERS_NAME, cipherSuites[0]); - validateConnection(startInfraWithSSL(props, false)); - + String restEndpoint = startInfraWithSSL(props, false); + validateConnection(restEndpoint, "TLSv1.2"); } public void testSSLWithMultipleCipherSuite() throws Exception { - Properties props = new Properties(); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true"); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath()); @@ -506,12 +504,11 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_CIPHERS_NAME, cipherSuites[0] + "," + cipherSuites[1]); - validateConnection(startInfraWithSSL(props, false)); - + String restEndpoint = startInfraWithSSL(props, false); + validateConnection(restEndpoint, "TLSv1.2"); } public void testMutualAuthentication() throws Exception { - Properties props = new Properties(); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true"); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath()); @@ -522,7 +519,9 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase { props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME, jks.getCanonicalPath()); props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME, "password"); - validateConnection(startInfraWithSSL(props, false)); + + String restEndpoint = startInfraWithSSL(props, false); + validateConnection(restEndpoint, "SSL"); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8c23fab4/geode-core/src/test/java/com/gemstone/gemfire/management/ManagementTestBase.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/ManagementTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/management/ManagementTestBase.java index 6064297..d699727 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/management/ManagementTestBase.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/management/ManagementTestBase.java @@ -16,42 +16,20 @@ */ package com.gemstone.gemfire.management; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Properties; -import java.util.Set; - -import javax.management.MBeanServer; -import javax.management.ObjectName; - import com.gemstone.gemfire.LogWriter; -import com.gemstone.gemfire.cache.Cache; -import com.gemstone.gemfire.cache.CacheFactory; -import com.gemstone.gemfire.cache.Region; -import com.gemstone.gemfire.cache.RegionFactory; -import com.gemstone.gemfire.cache.RegionShortcut; +import com.gemstone.gemfire.cache.*; import com.gemstone.gemfire.distributed.DistributedMember; import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.internal.statistics.SampleCollector; -import com.gemstone.gemfire.management.internal.FederatingManager; -import com.gemstone.gemfire.management.internal.LocalManager; -import com.gemstone.gemfire.management.internal.MBeanJMXAdapter; -import com.gemstone.gemfire.management.internal.ManagementStrings; -import com.gemstone.gemfire.management.internal.SystemManagementService; -import com.gemstone.gemfire.test.dunit.Assert; -import com.gemstone.gemfire.test.dunit.AsyncInvocation; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; -import com.gemstone.gemfire.test.dunit.Host; -import com.gemstone.gemfire.test.dunit.Invoke; -import com.gemstone.gemfire.test.dunit.SerializableCallable; -import com.gemstone.gemfire.test.dunit.SerializableRunnable; -import com.gemstone.gemfire.test.dunit.VM; -import com.gemstone.gemfire.test.dunit.Wait; -import com.gemstone.gemfire.test.dunit.WaitCriterion; +import com.gemstone.gemfire.management.internal.*; +import com.gemstone.gemfire.test.dunit.*; + +import javax.management.MBeanServer; +import javax.management.ObjectName; +import java.util.*; public class ManagementTestBase extends DistributedTestCase { @@ -63,10 +41,11 @@ public class ManagementTestBase extends DistributedTestCase { private static final int MAX_WAIT = 70 * 1000; private static final long serialVersionUID = 1L; - /** log writer instance */ + /** + * log writer instance + */ private static LogWriter logWriter; - private static Properties props = new Properties(); /** @@ -95,10 +74,8 @@ public class ManagementTestBase extends DistributedTestCase { protected static VM locatorVM; private static SampleCollector sampleCollector; - - protected static MBeanServer mbeanServer = MBeanJMXAdapter.mbeanServer; - + protected static MBeanServer mbeanServer = MBeanJMXAdapter.mbeanServer; private static int mcastPort; @@ -129,14 +106,14 @@ public class ManagementTestBase extends DistributedTestCase { @Override public final void preTearDown() throws Exception { preTearDownManagementTestBase(); - + closeAllCache(); managementService = null; mcastPort = 0; disconnectAllFromDS(); props.clear(); - + postTearDownManagementTestBase(); } @@ -146,7 +123,7 @@ public class ManagementTestBase extends DistributedTestCase { protected void postTearDownManagementTestBase() throws Exception { } - public void closeAllCache() throws Exception{ + public void closeAllCache() throws Exception { closeCache(managingNode); closeCache(managedNode1); closeCache(managedNode2); @@ -178,11 +155,9 @@ public class ManagementTestBase extends DistributedTestCase { } - /** * managingNodeFirst variable tests for two different test cases where * Managing & Managed Node creation time lines are reversed. - * */ public void initManagement(boolean managingNodeFirst) throws Exception { @@ -205,7 +180,6 @@ public class ManagementTestBase extends DistributedTestCase { } } - @SuppressWarnings("serial") public void createCache(VM vm1) throws Exception { vm1.invoke(new SerializableRunnable("Create Cache") { @@ -228,7 +202,7 @@ public class ManagementTestBase extends DistributedTestCase { public Cache createCache(Properties props) { System.setProperty("dunitLogPerTest", "true"); - props.setProperty(DistributionConfig.LOG_FILE_NAME,getTestMethodName()+"-.log"); + props.setProperty(DistributionConfig.LOG_FILE_NAME, getTestMethodName() + "-.log"); ds = (new ManagementTestBase("temp")).getSystem(props); cache = CacheFactory.create(ds); managementService = ManagementService.getManagementService(cache); @@ -238,7 +212,6 @@ public class ManagementTestBase extends DistributedTestCase { return cache; } - public Cache getCache() { return cache; } @@ -253,7 +226,7 @@ public class ManagementTestBase extends DistributedTestCase { } props.setProperty(DistributionConfig.ENABLE_TIME_STATISTICS_NAME, "true"); props.setProperty(DistributionConfig.STATISTIC_SAMPLING_ENABLED_NAME, "true"); - props.setProperty(DistributionConfig.LOG_FILE_NAME,getTestMethodName()+"-.log"); + props.setProperty(DistributionConfig.LOG_FILE_NAME, getTestMethodName() + "-.log"); ds = (new ManagementTestBase("temp")).getSystem(props); cache = CacheFactory.create(ds); managementService = ManagementService.getManagementService(cache); @@ -263,7 +236,6 @@ public class ManagementTestBase extends DistributedTestCase { return cache; } - @SuppressWarnings("serial") public void createManagementCache(VM vm1) throws Exception { vm1.invoke(new SerializableRunnable("Create Management Cache") { @@ -273,7 +245,6 @@ public class ManagementTestBase extends DistributedTestCase { }); } - @SuppressWarnings("serial") public void closeCache(VM vm1) throws Exception { vm1.invoke(new SerializableRunnable("Close Cache") { @@ -292,9 +263,21 @@ public class ManagementTestBase extends DistributedTestCase { } + public void closeCache() throws Exception { + GemFireCacheImpl existingInstance = GemFireCacheImpl.getInstance(); + if (existingInstance != null) { + existingInstance.close(); + } + InternalDistributedSystem ds = InternalDistributedSystem + .getConnectedInstance(); + if (ds != null) { + ds.disconnect(); + } + } + public String getMemberId(final VM vm) { SerializableCallable getMember = new SerializableCallable("getMemberId") { - public Object call() throws Exception{ + public Object call() throws Exception { GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); return cache.getDistributedSystem().getDistributedMember().getId(); } @@ -312,7 +295,7 @@ public class ManagementTestBase extends DistributedTestCase { } public boolean done() { - SystemManagementService service = (SystemManagementService)managementService; + SystemManagementService service = (SystemManagementService) managementService; if (service.getMBeanProxy(objectName, interfaceClass) != null) { return true; } else { @@ -323,8 +306,8 @@ public class ManagementTestBase extends DistributedTestCase { }, MAX_WAIT, 500, true); } - protected void runManagementTaskAdhoc(){ - SystemManagementService service = (SystemManagementService)managementService; + protected void runManagementTaskAdhoc() { + SystemManagementService service = (SystemManagementService) managementService; service.getLocalManager().runManagementTaskAdhoc(); } @@ -398,7 +381,6 @@ public class ManagementTestBase extends DistributedTestCase { } /** - * * Check various resources clean up Once a VM stops being managable it should * remove all the artifacts of management namely a) Notification region b) * Monitoring Region c) Management task should stop @@ -434,7 +416,6 @@ public class ManagementTestBase extends DistributedTestCase { } /** - * * Check various resources clean up Once a VM stops being Managing.It should * remove all the artifacts of management namely a) proxies b) Monitoring * Region c) Management task should stop @@ -471,7 +452,6 @@ public class ManagementTestBase extends DistributedTestCase { member)); } - } catch (ManagementException e) { Assert.fail("failed with ManagementException", e); } @@ -491,34 +471,33 @@ public class ManagementTestBase extends DistributedTestCase { if (e.getMessage() .equals(ManagementStrings.Management_Service_CLOSED_CACHE) || e.getMessage().equals( - ManagementStrings.Management_Service_MANAGEMENT_SERVICE_IS_CLOSED - .toLocalizedString()) + ManagementStrings.Management_Service_MANAGEMENT_SERVICE_IS_CLOSED + .toLocalizedString()) || e - .getMessage() - .equals( - ManagementStrings.Management_Service_MANAGEMENT_SERVICE_NOT_STARTED_YET - .toLocalizedString()) - || e.getMessage().equals( - ManagementStrings.Management_Service_NOT_A_GEMFIRE_DOMAIN_MBEAN + .getMessage() + .equals( + ManagementStrings.Management_Service_MANAGEMENT_SERVICE_NOT_STARTED_YET .toLocalizedString()) || e.getMessage().equals( - ManagementStrings.Management_Service_NOT_A_MANAGING_NODE_YET - .toLocalizedString()) + ManagementStrings.Management_Service_NOT_A_GEMFIRE_DOMAIN_MBEAN + .toLocalizedString()) + || e.getMessage().equals( + ManagementStrings.Management_Service_NOT_A_MANAGING_NODE_YET + .toLocalizedString()) || e - .getMessage() - .equals( - ManagementStrings.Management_Service_OPERATION_NOT_ALLOWED_FOR_CLIENT_CACHE - .toLocalizedString()) + .getMessage() + .equals( + ManagementStrings.Management_Service_OPERATION_NOT_ALLOWED_FOR_CLIENT_CACHE + .toLocalizedString()) || e.getMessage().equals( - ManagementStrings.Management_Service_PROXY_NOT_AVAILABLE - .toLocalizedString())) { + ManagementStrings.Management_Service_PROXY_NOT_AVAILABLE + .toLocalizedString())) { return false; } return true; } - public static List getManagedNodeList() { return managedNodeList; } @@ -534,10 +513,8 @@ public class ManagementTestBase extends DistributedTestCase { /** * Creates a Distributed region * - * @param vm - * reference to VM - * @param regionName - * name of the distributed region + * @param vm reference to VM + * @param regionName name of the distributed region */ protected void createDistributedRegion(VM vm, final String regionName) throws Exception { @@ -554,10 +531,8 @@ public class ManagementTestBase extends DistributedTestCase { /** * Creates a Local region * - * @param vm - * reference to VM - * @param localRegionName - * name of the local region + * @param vm reference to VM + * @param localRegionName name of the local region */ protected void createLocalRegion(VM vm, final String localRegionName) throws Exception { @@ -580,8 +555,7 @@ public class ManagementTestBase extends DistributedTestCase { /** * Creates a Sub region * - * @param vm - * reference to VM + * @param vm reference to VM */ protected void createSubRegion(VM vm, final String parentRegionPath, final String subregionName) throws Exception { @@ -691,7 +665,6 @@ public class ManagementTestBase extends DistributedTestCase { assertNotNull(service.getDistributedSystemMXBean()); - Wait.waitForCriterion(new WaitCriterion() { public String description() { return "Waiting All members to intimate DistributedSystemMBean";