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-3539: enhance rule to start locator joining other locators (#1104)
Date Thu, 30 Nov 2017 18:10:55 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 375d368  GEODE-3539: enhance rule to start locator joining other locators (#1104)
375d368 is described below

commit 375d3684d283c8e3d57174d79a37b3be44b8830c
Author: jinmeiliao <jiliao@pivotal.io>
AuthorDate: Thu Nov 30 10:10:52 2017 -0800

    GEODE-3539: enhance rule to start locator joining other locators (#1104)
---
 .../internal/cli/commands/DeployCommandRedeployDUnitTest.java |  7 ++++---
 .../configuration/ClusterConfigDeployJarDUnitTest.java        | 11 ++---------
 .../geode/test/dunit/rules/LocatorServerStartupRule.java      | 11 +++++++++++
 3 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
index 4b91ce5..92e8c9d 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
@@ -47,7 +47,7 @@ import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.serializable.SerializableTemporaryFolder;
 
 @Category(DistributedTest.class)
-public class DeployCommandRedeployDUnitTest implements Serializable {
+public class DeployCommandRedeployDUnitTest {
   private static final String VERSION1 = "Version1";
   private static final String VERSION2 = "Version2";
 
@@ -173,7 +173,7 @@ public class DeployCommandRedeployDUnitTest implements Serializable {
     return jar;
   }
 
-  private void assertThatFunctionHasVersion(String functionId, String version) {
+  private static void assertThatFunctionHasVersion(String functionId, String version) {
     GemFireCacheImpl gemFireCache = GemFireCacheImpl.getInstance();
     DistributedSystem distributedSystem = gemFireCache.getDistributedSystem();
     Execution execution = FunctionService.onMember(distributedSystem.getDistributedMember());
@@ -181,7 +181,8 @@ public class DeployCommandRedeployDUnitTest implements Serializable {
     assertThat(result.get(0)).isEqualTo(version);
   }
 
-  private void assertThatCanLoad(String jarName, String className) throws ClassNotFoundException
{
+  private static void assertThatCanLoad(String jarName, String className)
+      throws ClassNotFoundException {
     assertThat(ClassPathLoader.getLatest().getJarDeployer().findDeployedJar(jarName)).isNotNull();
     assertThat(ClassPathLoader.getLatest().forName(className)).isNotNull();
   }
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java
index 0d12a18..5a1058f 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java
@@ -15,7 +15,6 @@
 package org.apache.geode.management.internal.configuration;
 
 import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
-import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
 import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
 import static org.assertj.core.api.Assertions.assertThat;
 
@@ -68,14 +67,8 @@ public class ClusterConfigDeployJarDUnitTest extends ClusterConfigTestBase
{
   @Test
   public void testDeployToMultipleLocators() throws Exception {
     MemberVM locator = lsRule.startLocatorVM(0, locatorProps);
-    locatorProps.setProperty(LOCATORS, "localhost[" + locator.getPort() + "]");
-    MemberVM locator2 = lsRule.startLocatorVM(1, locatorProps);
-    locatorProps.setProperty(LOCATORS,
-        "localhost[" + locator.getPort() + "],localhost[" + locator2.getPort() + "]");
-    MemberVM locator3 = lsRule.startLocatorVM(2, locatorProps);
-
-    // has to start a server in order to run deploy command
-    lsRule.startServerVM(3, serverProps, locator.getPort());
+    MemberVM locator2 = lsRule.startLocatorVM(1, locator.getPort());
+    MemberVM locator3 = lsRule.startLocatorVM(2, locator.getPort(), locator2.getPort());
 
     gfshConnector.connect(locator);
     assertThat(gfshConnector.isConnected()).isTrue();
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
index c9e2c83..1399e2b 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
@@ -18,6 +18,7 @@ package org.apache.geode.test.dunit.rules;
 
 import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
 import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
 import static org.apache.geode.distributed.ConfigurationProperties.NAME;
 import static org.apache.geode.test.dunit.Host.getHost;
 
@@ -25,7 +26,9 @@ import java.io.File;
 import java.io.IOException;
 import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Properties;
+import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 
 import org.junit.rules.ExternalResource;
@@ -136,6 +139,14 @@ public class LocatorServerStartupRule extends ExternalResource implements
Serial
     return startLocatorVM(index, new Properties());
   }
 
+  public MemberVM startLocatorVM(int index, int... locatorPort) throws Exception {
+    Properties properties = new Properties();
+    String locators = Arrays.stream(locatorPort).mapToObj(i -> "localhost[" + i + "]")
+        .collect(Collectors.joining(","));
+    properties.setProperty(LOCATORS, locators);
+    return startLocatorVM(index, properties);
+  }
+
   /**
    * Starts a locator instance with the given configuration properties inside
    * {@code getHost(0).getVM(index)}.

-- 
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <commits@geode.apache.org>'].

Mime
View raw message