geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinmeil...@apache.org
Subject [geode] branch develop updated: GEODE-5475: ClusterStartupRule improvement (#2193)
Date Thu, 26 Jul 2018 14:52:08 GMT
This is an automated email from the ASF dual-hosted git repository.

jinmeiliao pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new d00ab7c  GEODE-5475: ClusterStartupRule improvement (#2193)
d00ab7c is described below

commit d00ab7cebc938dfd89f60a5a1e39126771457cbe
Author: jinmeiliao <jiliao@pivotal.io>
AuthorDate: Thu Jul 26 07:51:42 2018 -0700

    GEODE-5475: ClusterStartupRule improvement (#2193)
    
    * add more convenience methods to startClientVM
    * rename stopMember to stop and push the implementation to VMProvider
    * rename forceDisconnectMember to forceDisconnect
---
 .../cli/JdbcClusterConfigDistributedTest.java      |  2 +-
 .../management/JMXMBeanReconnectDUnitTest.java     |  8 +--
 .../internal/JMXMBeanFederationDUnitTest.java      |  2 +-
 .../AlterAsyncEventQueueCommandDUnitTest.java      |  4 +-
 .../cli/commands/AlterCompressorDUnitTest.java     | 12 ++---
 .../cli/commands/AlterDiskStoreDUnitTest.java      |  4 +-
 .../CreateJndiBindingCommandDUnitTest.java         |  2 +-
 .../commands/DeployCommandRedeployDUnitTest.java   |  2 +-
 .../DestroyJndiBindingCommandDUnitTest.java        |  2 +-
 .../commands/DestroyRegionCommandDUnitTest.java    |  2 +-
 .../cli/commands/DiskStoreCommandsDUnitTest.java   |  8 +--
 .../IndexCommandsShareConfigurationDUnitTest.java  |  2 +-
 ...ersistThroughClusterConfigurationDUnitTest.java |  6 +--
 .../commands/RegionMembershipMBeanDUnitTest.java   |  4 +-
 .../commands/ShowMissingDiskStoresDUnitTest.java   |  4 +-
 .../ClusterConfigLocatorRestartDUnitTest.java      |  6 +--
 .../ImportClusterConfigDistributedTest.java        |  4 +-
 .../ImportOldClusterConfigDUnitTest.java           |  2 +-
 ...onUsingLegacySecurityWithFailoverDUnitTest.java |  8 +--
 .../apache/geode/test/dunit/rules/ClientVM.java    |  4 +-
 .../geode/test/dunit/rules/ClusterStartupRule.java | 58 ++++++++++++----------
 .../apache/geode/test/dunit/rules/MemberVM.java    | 26 +---------
 .../apache/geode/test/junit/rules/VMProvider.java  | 25 +++++++++-
 .../geode/test/dunit/DistributedTestUtils.java     |  4 +-
 .../geode/test/junit/rules/MemberStarterRule.java  | 11 +++-
 .../cli/commands/ListClientCommandDUnitTest.java   |  6 +--
 ...rConfigurationIndexWithFromClauseDUnitTest.java |  6 +--
 27 files changed, 119 insertions(+), 105 deletions(-)

diff --git a/geode-connectors/src/distributedTest/java/org/apache/geode/connectors/jdbc/internal/cli/JdbcClusterConfigDistributedTest.java
b/geode-connectors/src/distributedTest/java/org/apache/geode/connectors/jdbc/internal/cli/JdbcClusterConfigDistributedTest.java
index df0b028..476a270 100644
--- a/geode-connectors/src/distributedTest/java/org/apache/geode/connectors/jdbc/internal/cli/JdbcClusterConfigDistributedTest.java
+++ b/geode-connectors/src/distributedTest/java/org/apache/geode/connectors/jdbc/internal/cli/JdbcClusterConfigDistributedTest.java
@@ -63,7 +63,7 @@ public class JdbcClusterConfigDistributedTest {
       validateRegionMapping(service.getMappingForRegion("regionName"));
     });
 
-    server.stopMember(false);
+    server.stop(false);
 
     server = cluster.startServerVM(1, locator.getPort());
     server.invoke(() -> {
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/JMXMBeanReconnectDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/management/JMXMBeanReconnectDUnitTest.java
index e5c598e..21494ee 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/JMXMBeanReconnectDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/JMXMBeanReconnectDUnitTest.java
@@ -101,7 +101,7 @@ public class JMXMBeanReconnectDUnitTest {
   public void testLocalBeans_MaintainServerAndCrashLocator() {
     List<String> initialServerBeans = canonicalBeanNamesFor(server1);
 
-    locator1.forceDisconnectMember();
+    locator1.forceDisconnect();
 
     List<String> intermediateServerBeans = canonicalBeanNamesFor(server1);
 
@@ -120,7 +120,7 @@ public class JMXMBeanReconnectDUnitTest {
   public void testLocalBeans_MaintainLocatorAndCrashServer() {
     List<String> initialLocatorBeans = canonicalBeanNamesFor(locator1);
 
-    server1.forceDisconnectMember();
+    server1.forceDisconnect();
 
     List<String> intermediateLocatorBeans = canonicalBeanNamesFor(locator1);
 
@@ -146,7 +146,7 @@ public class JMXMBeanReconnectDUnitTest {
     assertThat(initialLocator1GemfireBeans)
         .containsExactlyElementsOf(initialLocator2GemfireBeans);
 
-    locator1.forceDisconnectMember();
+    locator1.forceDisconnect();
 
     List<ObjectName> intermediateLocator2GemfireBeans =
         getFederatedGemfireBeansFrom(locator2);
@@ -184,7 +184,7 @@ public class JMXMBeanReconnectDUnitTest {
     assertThat(initialLocator1GemfireBeans)
         .containsExactlyElementsOf(initialLocator2GemfireBeans);
 
-    server1.forceDisconnectMember();
+    server1.forceDisconnect();
 
     List<ObjectName> intermediateLocator1GemfireBeans =
         getFederatedGemfireBeansFrom(locator1);
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/JMXMBeanFederationDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/JMXMBeanFederationDUnitTest.java
index dcf57f4..73e2864 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/JMXMBeanFederationDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/JMXMBeanFederationDUnitTest.java
@@ -128,7 +128,7 @@ public class JMXMBeanFederationDUnitTest {
     intermediateMBeans = intermediateMBeans.stream().sorted().collect(Collectors.toList());
     assertThat(intermediateMBeans).containsExactlyElementsOf(expectedMBeans);
 
-    lsRule.stopMember(SERVER_3_VM_INDEX);
+    lsRule.stop(SERVER_3_VM_INDEX);
     SERVER_COUNT--;
     locator1.waitUntilRegionIsReadyOnExactlyThisManyServers(REGION_PATH, SERVER_COUNT);
 
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/AlterAsyncEventQueueCommandDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/AlterAsyncEventQueueCommandDUnitTest.java
index 7646901..292b70a 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/AlterAsyncEventQueueCommandDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/AlterAsyncEventQueueCommandDUnitTest.java
@@ -82,8 +82,8 @@ public class AlterAsyncEventQueueCommandDUnitTest {
     });
 
     // restart locator and server without clearing the file system
-    lsRule.stopMember(1, false);
-    lsRule.stopMember(0, false);
+    server1.stop(false);
+    locator.stop(false);
 
     locator = lsRule.startLocatorVM(0);
     server1 = lsRule.startServerVM(1, "group1", locator.getPort());
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/AlterCompressorDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/AlterCompressorDUnitTest.java
index 1b53620..c99f54a 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/AlterCompressorDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/AlterCompressorDUnitTest.java
@@ -103,9 +103,9 @@ public class AlterCompressorDUnitTest {
         server2);
 
     // stop the VM
-    server1.stopMember(false);
-    server2.stopMember(false);
-    server3.stopMember(false);
+    server1.stop(false);
+    server2.stop(false);
+    server3.stop(false);
 
     // Alter disk-store & region to add compressor
     Arrays.asList(server1, server2).stream().forEach(server -> {
@@ -145,9 +145,9 @@ public class AlterCompressorDUnitTest {
     VMProvider.invokeInEveryMember(AlterCompressorDUnitTest::verifyRegionIsCompressed, server1);
 
     // stop the VM
-    server1.stopMember(false);
-    server2.stopMember(false);
-    server3.stopMember(false);
+    server1.stop(false);
+    server2.stop(false);
+    server3.stop(false);
 
     Arrays.asList(server1, server2).stream().forEach(server -> {
       String diskDir = server.getWorkingDir() + "/diskStore";
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/AlterDiskStoreDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/AlterDiskStoreDUnitTest.java
index b6b4cd3..eb42826 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/AlterDiskStoreDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/AlterDiskStoreDUnitTest.java
@@ -95,7 +95,7 @@ public class AlterDiskStoreDUnitTest {
 
   @Test
   public void alterDiskStoreUpdatesValues() throws Exception {
-    startupRule.stopMember(1);
+    startupRule.stop(1);
 
     gfsh.connectAndVerify(locator.getJmxPort(), PortType.jmxManager);
     String commandOne = commandToSetManyVariables();
@@ -117,7 +117,7 @@ public class AlterDiskStoreDUnitTest {
     });
 
     // Halt the member and "alter" the disk store with the --remove option
-    startupRule.stopMember(1);
+    startupRule.stop(1);
     String cmd = commandWithRemoveAndNoOtherOption();
     gfsh.executeAndAssertThat(cmd).statusIsSuccess().containsOutput("The region " + regionName
         + " was successfully removed from the disk store " + diskStoreName);
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/CreateJndiBindingCommandDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/CreateJndiBindingCommandDUnitTest.java
index 43e7d9a..fbbb094 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/CreateJndiBindingCommandDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/CreateJndiBindingCommandDUnitTest.java
@@ -90,7 +90,7 @@ public class CreateJndiBindingCommandDUnitTest {
         () -> assertThat(JNDIInvoker.getNoOfAvailableDataSources()).isEqualTo(1));
 
     // bounce server1
-    server1.stopMember(false);
+    server1.stop(false);
     server1 = cluster.startServerVM(1, locator.getPort());
 
     // verify it has recreated the datasource from cluster config
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
index fadc237..5826c45 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
@@ -136,7 +136,7 @@ public class DeployCommandRedeployDUnitTest {
     server.invoke(() -> assertThatCanLoad(JAR_NAME_A, FUNCTION_A));
     server.invoke(() -> assertThatFunctionHasVersion(FUNCTION_A, VERSION2));
 
-    server.stopMember(false);
+    server.stop(false);
 
     lsRule.startServerVM(1, locator.getPort());
 
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DestroyJndiBindingCommandDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DestroyJndiBindingCommandDUnitTest.java
index b9297b4..f4c3cd6 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DestroyJndiBindingCommandDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DestroyJndiBindingCommandDUnitTest.java
@@ -96,7 +96,7 @@ public class DestroyJndiBindingCommandDUnitTest {
         () -> assertThat(JNDIInvoker.getNoOfAvailableDataSources()).isEqualTo(0));
 
     // bounce server1 and assert that there is still no datasource received from cluster
config
-    server1.stopMember(false);
+    server1.stop(false);
     server1 = cluster.startServerVM(1, locator.getPort());
 
     // verify no datasource from cluster config
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DestroyRegionCommandDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DestroyRegionCommandDUnitTest.java
index 5ef65b0..477743b 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DestroyRegionCommandDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DestroyRegionCommandDUnitTest.java
@@ -169,7 +169,7 @@ public class DestroyRegionCommandDUnitTest {
     });
 
     // restart one server to make sure the region does not exist anymore
-    lsRule.stopMember(1);
+    lsRule.stop(1);
     lsRule.startServerVM(1, locator.getPort());
 
     // make sure region does not exist
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsDUnitTest.java
index 8636b6f..8319129 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsDUnitTest.java
@@ -99,7 +99,7 @@ public class DiskStoreCommandsDUnitTest {
     gfsh.executeAndAssertThat("show missing-disk-stores")
         .containsOutput("No missing disk store found");
 
-    server1.stopMember(false);
+    server1.stop(false);
 
     server2.invoke(() -> {
       Cache cache = ClusterStartupRule.getCache();
@@ -107,7 +107,7 @@ public class DiskStoreCommandsDUnitTest {
       r.put("A", "C");
     });
 
-    server2.stopMember(false);
+    server2.stop(false);
 
     int locatorPort = locator.getPort();
     server1.invokeAsync(() -> {
@@ -155,7 +155,7 @@ public class DiskStoreCommandsDUnitTest {
     gfsh.executeAndAssertThat("show missing-disk-stores")
         .containsOutput("No missing disk store found");
 
-    server1.stopMember(false);
+    server1.stop(false);
 
     String diskDirs = new File(server1.getWorkingDir(), DISKSTORE).getAbsolutePath();
     gfsh.executeAndAssertThat(
@@ -181,7 +181,7 @@ public class DiskStoreCommandsDUnitTest {
     gfsh.executeAndAssertThat("show missing-disk-stores")
         .containsOutput("No missing disk store found");
 
-    server1.stopMember(false);
+    server1.stop(false);
 
     String diskDirs = new File(server1.getWorkingDir(), DISKSTORE).getAbsolutePath();
     File exportDir = tempDir.newFolder();
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/IndexCommandsShareConfigurationDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/IndexCommandsShareConfigurationDUnitTest.java
index 5517315..201671a 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/IndexCommandsShareConfigurationDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/IndexCommandsShareConfigurationDUnitTest.java
@@ -105,7 +105,7 @@ public class IndexCommandsShareConfigurationDUnitTest {
     });
 
     // Restart the data member cache to make sure that the index is destroyed.
-    startupRule.stopMember(1);
+    startupRule.stop(1);
     serverVM = startupRule.startServerVM(1, groupName, locator.getPort());
 
     serverVM.invoke(() -> {
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/RegionChangesPersistThroughClusterConfigurationDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/RegionChangesPersistThroughClusterConfigurationDUnitTest.java
index 4c20f93..316fb89 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/RegionChangesPersistThroughClusterConfigurationDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/RegionChangesPersistThroughClusterConfigurationDUnitTest.java
@@ -100,7 +100,7 @@ public class RegionChangesPersistThroughClusterConfigurationDUnitTest
{
           .contains(REGION_NAME);
     });
 
-    server2.forceDisconnectMember();
+    server2.forceDisconnect();
 
     server2.waitTilServerFullyReconnected();
     locator.waitUntilRegionIsReadyOnExactlyThisManyServers(REGION_PATH, 2);
@@ -132,7 +132,7 @@ public class RegionChangesPersistThroughClusterConfigurationDUnitTest
{
       assertThat(sharedConfig.getConfiguration(GROUP_NAME).getCacheXmlContent()).contains("45635");
     });
 
-    server2.forceDisconnectMember();
+    server2.forceDisconnect();
 
     server2.waitTilServerFullyReconnected();
     locator.waitUntilRegionIsReadyOnExactlyThisManyServers(REGION_PATH, 2);
@@ -157,7 +157,7 @@ public class RegionChangesPersistThroughClusterConfigurationDUnitTest
{
           .doesNotContain(REGION_NAME);
     });
 
-    server2.forceDisconnectMember();
+    server2.forceDisconnect();
 
     server2.waitTilServerFullyReconnected();
 
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/RegionMembershipMBeanDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/RegionMembershipMBeanDUnitTest.java
index 6a09119..69905a3 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/RegionMembershipMBeanDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/RegionMembershipMBeanDUnitTest.java
@@ -246,7 +246,7 @@ public class RegionMembershipMBeanDUnitTest {
         .isEqualTo(intermediateMemberSizeChild2FromMBean)
         .isEqualTo(initialMemberSizeChild2FromMBean + 1);
 
-    server3.stopMember(Boolean.TRUE);
+    server3.stop(Boolean.TRUE);
 
     locator.waitUntilRegionIsReadyOnExactlyThisManyServers(DATA_REGION_NAME_PATH, 2);
     locator.waitUntilRegionIsReadyOnExactlyThisManyServers(DATA_REGION_NAME_CHILD_1_PATH,
2);
@@ -335,7 +335,7 @@ public class RegionMembershipMBeanDUnitTest {
     assertThat(intermediateMemberSizeFromFunctionCall).isEqualTo(intermediateMemberSizeFromMBean)
         .isEqualTo(initialMemberSizeFromMBean + 1);
 
-    server3.stopMember(Boolean.TRUE);
+    server3.stop(Boolean.TRUE);
 
     Integer finalMemberSizeFromMBean =
         distributedRegionMembersSizeFromMBean(DATA_PAR_REGION_NAME_PATH);
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ShowMissingDiskStoresDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ShowMissingDiskStoresDUnitTest.java
index 03e82c1..e1d72b2 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ShowMissingDiskStoresDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ShowMissingDiskStoresDUnitTest.java
@@ -97,8 +97,8 @@ public class ShowMissingDiskStoresDUnitTest {
     putUsingGfsh(gfshConnector, testRegionName, 2, "B");
     putUsingGfsh(gfshConnector, testRegionName, 3, "C");
 
-    lsRule.stopMember(1);
-    lsRule.stopMember(2);
+    lsRule.stop(1);
+    lsRule.stop(2);
 
     AsyncInvocation restart1 = restartServerAsync(server1);
     checkAsyncResults(restart1, gfshConnector, 5);
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/configuration/ClusterConfigLocatorRestartDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/configuration/ClusterConfigLocatorRestartDUnitTest.java
index 1007158..9360027 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/configuration/ClusterConfigLocatorRestartDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/configuration/ClusterConfigLocatorRestartDUnitTest.java
@@ -62,8 +62,8 @@ public class ClusterConfigLocatorRestartDUnitTest {
 
     addDisconnectListener(locator0);
 
-    server2.forceDisconnectMember();
-    locator0.forceDisconnectMember();
+    server2.forceDisconnect();
+    locator0.forceDisconnect();
 
     waitForLocatorToReconnect(locator0);
 
@@ -92,7 +92,7 @@ public class ClusterConfigLocatorRestartDUnitTest {
     // Shut down hard
     rule.crashVM(0);
 
-    server3.forceDisconnectMember();
+    server3.forceDisconnect();
 
     rule.startServerVM(4, locator1.getPort(), locator0.getPort());
 
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/configuration/ImportClusterConfigDistributedTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/configuration/ImportClusterConfigDistributedTest.java
index 935995f..759453f 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/configuration/ImportClusterConfigDistributedTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/configuration/ImportClusterConfigDistributedTest.java
@@ -73,8 +73,8 @@ public class ImportClusterConfigDistributedTest {
         .statusIsSuccess();
 
     gfsh.disconnect();
-    locator.stopMember(true);
-    server.stopMember(true);
+    locator.stop(true);
+    server.stop(true);
 
     assertThat(this.exportedClusterConfig).exists();
     assertThat(this.exportedClusterConfig.length()).isGreaterThan(100);
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/configuration/ImportOldClusterConfigDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/configuration/ImportOldClusterConfigDUnitTest.java
index 89e05fb..287ed83 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/configuration/ImportOldClusterConfigDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/configuration/ImportOldClusterConfigDUnitTest.java
@@ -78,7 +78,7 @@ public class ImportOldClusterConfigDUnitTest {
     server.invoke(ImportOldClusterConfigDUnitTest::regionOneExists);
     server.invoke(ImportOldClusterConfigDUnitTest::regionTwoExists);
 
-    lsRule.stopMember(1);
+    lsRule.stop(1);
 
     server = lsRule.startServerVM(1, locator.getPort());
     server.invoke(ImportOldClusterConfigDUnitTest::regionOneExists);
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/security/ClientDataAuthorizationUsingLegacySecurityWithFailoverDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/security/ClientDataAuthorizationUsingLegacySecurityWithFailoverDUnitTest.java
index f3dd5ee..b747ec6 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/security/ClientDataAuthorizationUsingLegacySecurityWithFailoverDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/security/ClientDataAuthorizationUsingLegacySecurityWithFailoverDUnitTest.java
@@ -188,7 +188,7 @@ public class ClientDataAuthorizationUsingLegacySecurityWithFailoverDUnitTest
{
     MemberVM server_to_fail = determinePrimaryServer(client);
 
     // Bring down primary server
-    server_to_fail.stopMember(true);
+    server_to_fail.stop(true);
 
     // Confirm failover
     MemberVM secondaryServer = (server1.getPort() == server_to_fail.getPort()) ? server2
: server1;
@@ -252,7 +252,7 @@ public class ClientDataAuthorizationUsingLegacySecurityWithFailoverDUnitTest
{
     MemberVM server_to_fail = determinePrimaryServer(client);
 
     // Bring down primary server
-    server_to_fail.stopMember(true);
+    server_to_fail.stop(true);
 
     // Confirm failover
     MemberVM secondaryServer = (server1.getPort() == server_to_fail.getPort()) ? server2
: server1;
@@ -298,7 +298,7 @@ public class ClientDataAuthorizationUsingLegacySecurityWithFailoverDUnitTest
{
     MemberVM server_to_fail = determinePrimaryServer(client);
 
     // Bring down primary server
-    server_to_fail.stopMember(true);
+    server_to_fail.stop(true);
 
     // Confirm failover
     MemberVM secondaryServer = (server1.getPort() == server_to_fail.getPort()) ? server2
: server1;
@@ -356,7 +356,7 @@ public class ClientDataAuthorizationUsingLegacySecurityWithFailoverDUnitTest
{
     MemberVM server_to_fail = determinePrimaryServer(client);
 
     // Bring down primary server
-    server_to_fail.stopMember(true);
+    server_to_fail.stop(true);
 
     // Confirm failover
     MemberVM secondaryServer = (server1.getPort() == server_to_fail.getPort()) ? server2
: server1;
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/test/dunit/rules/ClientVM.java
b/geode-core/src/distributedTest/java/org/apache/geode/test/dunit/rules/ClientVM.java
index 305c296..0a92b36 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/test/dunit/rules/ClientVM.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/test/dunit/rules/ClientVM.java
@@ -15,10 +15,12 @@
 
 package org.apache.geode.test.dunit.rules;
 
+import java.io.Serializable;
+
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.junit.rules.VMProvider;
 
-public class ClientVM extends VMProvider {
+public class ClientVM extends VMProvider implements Serializable {
   private VM vm;
 
   public ClientVM(VM vm) {
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/test/dunit/rules/ClusterStartupRule.java
b/geode-core/src/distributedTest/java/org/apache/geode/test/dunit/rules/ClusterStartupRule.java
index 602c727..e5fc1be 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/test/dunit/rules/ClusterStartupRule.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/test/dunit/rules/ClusterStartupRule.java
@@ -76,6 +76,9 @@ public class ClusterStartupRule extends ExternalResource implements Serializable
   public static ClientCacheRule clientCacheRule;
 
   public static InternalCache getCache() {
+    if (memberStarter == null) {
+      return null;
+    }
     return memberStarter.getCache();
   }
 
@@ -111,6 +114,9 @@ public class ClusterStartupRule extends ExternalResource implements Serializable
   }
 
   public static ClientCache getClientCache() {
+    if (clientCacheRule == null) {
+      return null;
+    }
     return clientCacheRule.getCache();
   }
 
@@ -147,7 +153,7 @@ public class ClusterStartupRule extends ExternalResource implements Serializable
           occupiedVMs.values().stream().filter(x -> x.isServer()).collect(Collectors.toSet()));
       vms.addAll(
           occupiedVMs.values().stream().filter(x -> x.isLocator()).collect(Collectors.toSet()));
-      vms.forEach(x -> x.stopMember(true));
+      vms.forEach(x -> x.stop());
 
       // delete any file under root dir
       Arrays.stream(getWorkingDirRoot().listFiles()).filter(File::isFile)
@@ -259,11 +265,18 @@ public class ClusterStartupRule extends ExternalResource implements
Serializable
     return clientVM;
   }
 
+  public ClientVM startClientVM(int index,
+      SerializableConsumerIF<ClientCacheFactory> cacheFactorySetup) throws Exception
{
+    return startClientVM(index, new Properties(), cacheFactorySetup,
+        VersionManager.CURRENT_VERSION);
+  }
+
   public ClientVM startClientVM(int index, Properties properties,
       SerializableConsumerIF<ClientCacheFactory> cacheFactorySetup) throws Exception
{
     return startClientVM(index, properties, cacheFactorySetup, VersionManager.CURRENT_VERSION);
   }
 
+  // convenient startClientMethod
   public ClientVM startClientVM(int index, String username, String password,
       boolean subscriptionEnabled, int... serverPorts) throws Exception {
     Properties props = new Properties();
@@ -280,6 +293,18 @@ public class ClusterStartupRule extends ExternalResource implements Serializable
     return startClientVM(index, props, consumer);
   }
 
+  // convenient startClientMethod
+  public ClientVM startClientVM(int index, boolean subscriptionEnabled, int... serverPorts)
+      throws Exception {
+    SerializableConsumerIF<ClientCacheFactory> consumer = ((cacheFactory) -> {
+      cacheFactory.setPoolSubscriptionEnabled(subscriptionEnabled);
+      for (int serverPort : serverPorts) {
+        cacheFactory.addPoolServer("localhost", serverPort);
+      }
+    });
+    return startClientVM(index, consumer);
+  }
+
   /**
    * Returns the {@link Member} running inside the VM with the specified {@code index}
    */
@@ -298,38 +323,17 @@ public class ClusterStartupRule extends ExternalResource implements
Serializable
   /**
    * gracefully stop the member/client inside this vm
    *
-   * if this vm is a server/locator, it stops them
+   * if this vm is a server/locator, it stops them and cleans the working dir
    * if this vm is a client, it closes the client cache.
    *
    * @param index vm index
    */
-  public void stopMember(int index) {
-    stopMember(index, true);
-  }
-
-  /**
-   * gracefully stop the member inside this vm
-   */
-  public void stopMember(int index, boolean cleanWorkingDir) {
-    VMProvider member = occupiedVMs.get(index);
-
-    if (member == null)
-      return;
-
-    member.stopMember(cleanWorkingDir);
+  public void stop(int index) {
+    stop(index, true);
   }
 
-  /**
-   * this forces a disconnect of the distributed system of the member.
-   * The member will automatically try to reconnect after 5 seconds.
-   *
-   * will throw a ClassCastException if this method is called on a client VM.
-   */
-  public void forceDisconnectMember(int index) {
-    MemberVM member = getMember(index);
-    if (member == null)
-      return;
-    member.forceDisconnectMember();
+  public void stop(int index, boolean cleanWorkingDir) {
+    occupiedVMs.get(index).stop(cleanWorkingDir);
   }
 
   /**
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/test/dunit/rules/MemberVM.java
b/geode-core/src/distributedTest/java/org/apache/geode/test/dunit/rules/MemberVM.java
index 78a0f62..d7d4eae 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/test/dunit/rules/MemberVM.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/test/dunit/rules/MemberVM.java
@@ -16,11 +16,8 @@ package org.apache.geode.test.dunit.rules;
 
 import static java.util.concurrent.TimeUnit.SECONDS;
 
-import java.io.File;
-import java.util.Arrays;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.commons.io.FileUtils;
 import org.apache.logging.log4j.Logger;
 import org.awaitility.Awaitility;
 
@@ -57,11 +54,6 @@ public class MemberVM extends VMProvider implements Member {
   }
 
   @Override
-  public File getWorkingDir() {
-    return vm.getWorkingDirectory();
-  }
-
-  @Override
   public int getPort() {
     return member.getPort();
   }
@@ -89,26 +81,10 @@ public class MemberVM extends VMProvider implements Member {
   }
 
   /**
-   * this gracefully shutdown the member inside this vm
-   */
-  @Override
-  public void stopMember(boolean cleanWorkingDir) {
-    super.stopMember(cleanWorkingDir);
-
-    if (!cleanWorkingDir) {
-      return;
-    }
-
-    // if using the dunit/vm dir as the preset working dir, need to cleanup dir
-    // so that regions/indexes won't get persisted across tests
-    Arrays.stream(getWorkingDir().listFiles()).forEach(FileUtils::deleteQuietly);
-  }
-
-  /**
    * this disconnects the distributed system of the member. The member will automatically
try to
    * reconnect after 5 seconds.
    */
-  public void forceDisconnectMember() {
+  public void forceDisconnect() {
     vm.invoke("force disconnect", () -> ClusterStartupRule.memberStarter.forceDisconnectMember());
   }
 
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/test/junit/rules/VMProvider.java
b/geode-core/src/distributedTest/java/org/apache/geode/test/junit/rules/VMProvider.java
index 1b8f014..a47cedb 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/test/junit/rules/VMProvider.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/test/junit/rules/VMProvider.java
@@ -15,8 +15,11 @@
 
 package org.apache.geode.test.junit.rules;
 
+import java.io.File;
 import java.util.Arrays;
 
+import org.apache.commons.io.FileUtils;
+
 import org.apache.geode.test.dunit.AsyncInvocation;
 import org.apache.geode.test.dunit.SerializableCallableIF;
 import org.apache.geode.test.dunit.SerializableRunnableIF;
@@ -30,11 +33,19 @@ public abstract class VMProvider {
 
   public abstract VM getVM();
 
-  public void stopMember(boolean cleanWorkingDir) {
+  public void stop() {
+    stop(true);
+  }
+
+  public void stop(boolean cleanWorkingDir) {
     getVM().invoke(() -> {
       ClusterStartupRule.stopElementInsideVM();
       MemberStarterRule.disconnectDSIfAny();
     });
+
+    if (cleanWorkingDir) {
+      Arrays.stream(getWorkingDir().listFiles()).forEach(FileUtils::deleteQuietly);
+    }
   }
 
   public boolean isClient() {
@@ -63,6 +74,14 @@ public abstract class VMProvider {
     return getVM().invoke(callable);
   }
 
+  public void invoke(String name, final SerializableRunnableIF runnable) {
+    getVM().invoke(name, runnable);
+  }
+
+  public <T> T invoke(String name, final SerializableCallableIF<T> callable)
{
+    return getVM().invoke(name, callable);
+  }
+
   public AsyncInvocation invokeAsync(final SerializableRunnableIF runnable) {
     return getVM().invokeAsync(runnable);
   }
@@ -71,4 +90,8 @@ public abstract class VMProvider {
     return getVM().invokeAsync(name, runnable);
   }
 
+  public File getWorkingDir() {
+    return getVM().getWorkingDirectory();
+  }
+
 }
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/test/dunit/DistributedTestUtils.java
b/geode-core/src/integrationTest/java/org/apache/geode/test/dunit/DistributedTestUtils.java
index 5d7e135..f08ea78 100755
--- a/geode-core/src/integrationTest/java/org/apache/geode/test/dunit/DistributedTestUtils.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/test/dunit/DistributedTestUtils.java
@@ -35,13 +35,13 @@ import org.apache.geode.internal.InternalInstantiator;
  * or artifacts generated by a DistributedTest.
  *
  * <p>
- * These methods can be used directly: {@code DistributedTestUtils.forceDisconnectMember(...)},
+ * These methods can be used directly: {@code DistributedTestUtils.forceDisconnect(...)},
  * however, they are intended to be referenced through static import:
  *
  * <pre>
  * import static org.apache.geode.test.dunit.DistributedTestUtils.*;
  *    ...
- *    forceDisconnectMember(...);
+ *    forceDisconnect(...);
  * </pre>
  *
  * Extracted from DistributedTestCase.
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/test/junit/rules/MemberStarterRule.java
b/geode-core/src/integrationTest/java/org/apache/geode/test/junit/rules/MemberStarterRule.java
index b8b85ef..ac192b1 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/test/junit/rules/MemberStarterRule.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/test/junit/rules/MemberStarterRule.java
@@ -106,7 +106,7 @@ public abstract class MemberStarterRule<T> extends SerializableExternalResource
 
   @Override
   public void after() {
-    // invoke stopMember() first and then ds.disconnect
+    // invoke stop() first and then ds.disconnect
     stopMember();
 
     // this will clean up the SocketCreators created in this VM so that it won't contaminate
@@ -283,6 +283,15 @@ public abstract class MemberStarterRule<T> extends SerializableExternalResource
 
   public void waitUntilRegionIsReadyOnExactlyThisManyServers(String regionName,
       int exactServerCount) throws Exception {
+    if (exactServerCount == 0) {
+      waitUntilEqual(
+          () -> getRegionMBean(regionName),
+          Objects::isNull,
+          true,
+          String.format("Expecting to not find an mbean for region '%s'", regionName),
+          WAIT_UNTIL_TIMEOUT, TimeUnit.SECONDS);
+      return;
+    }
     // First wait until the region mbean is not null...
     waitUntilEqual(
         () -> getRegionMBean(regionName),
diff --git a/geode-cq/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ListClientCommandDUnitTest.java
b/geode-cq/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ListClientCommandDUnitTest.java
index 5e40c80..71e2d88 100644
--- a/geode-cq/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ListClientCommandDUnitTest.java
+++ b/geode-cq/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ListClientCommandDUnitTest.java
@@ -121,8 +121,8 @@ public class ListClientCommandDUnitTest {
                 "member=server-1,port=" + server1port);
 
     // shutdown the clients
-    cluster.stopMember(client1ID);
-    cluster.stopMember(client2ID);
+    cluster.stop(client1ID);
+    cluster.stop(client2ID);
   }
 
   @Test
@@ -178,6 +178,6 @@ public class ListClientCommandDUnitTest {
     assertThat(serverList.get(0)).contains("server-1").contains("server-2");
 
     // shutdown the clients
-    cluster.stopMember(client1ID);
+    cluster.stop(client1ID);
   }
 }
diff --git a/geode-wan/src/distributedTest/java/org/apache/geode/management/internal/configuration/ClusterConfigurationIndexWithFromClauseDUnitTest.java
b/geode-wan/src/distributedTest/java/org/apache/geode/management/internal/configuration/ClusterConfigurationIndexWithFromClauseDUnitTest.java
index c47266f..9299423 100644
--- a/geode-wan/src/distributedTest/java/org/apache/geode/management/internal/configuration/ClusterConfigurationIndexWithFromClauseDUnitTest.java
+++ b/geode-wan/src/distributedTest/java/org/apache/geode/management/internal/configuration/ClusterConfigurationIndexWithFromClauseDUnitTest.java
@@ -72,7 +72,7 @@ public class ClusterConfigurationIndexWithFromClauseDUnitTest {
     String serverName = vm1.getName();
     CommandStringBuilder csb = new CommandStringBuilder(CliStrings.LIST_MEMBER);
     gfshCommandRule.executeAndAssertThat(csb.toString()).statusIsSuccess();
-    lsRule.stopMember(1);
+    lsRule.stop(1);
     lsRule.startServerVM(1, locator.getPort());
     verifyIndexRecreated(INDEX_NAME);
   }
@@ -90,7 +90,7 @@ public class ClusterConfigurationIndexWithFromClauseDUnitTest {
     String serverName = vm1.getName();
     CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_DEFINED_INDEXES);
     gfshCommandRule.executeAndAssertThat(csb.toString()).statusIsSuccess();
-    lsRule.stopMember(1);
+    lsRule.stop(1);
     lsRule.startServerVM(1, locator.getPort());
     verifyIndexRecreated(INDEX_NAME);
 
@@ -109,7 +109,7 @@ public class ClusterConfigurationIndexWithFromClauseDUnitTest {
     String serverName = vm1.getName();
     CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_DEFINED_INDEXES);
     gfshCommandRule.executeAndAssertThat(csb.toString()).statusIsSuccess();
-    lsRule.stopMember(1);
+    lsRule.stop(1);
     lsRule.startServerVM(1, locator.getPort());
     verifyIndexRecreated(INDEX_NAME);
 


Mime
View raw message