[ https://issues.apache.org/jira/browse/GEODE-3539?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16273094#comment-16273094 ]
ASF GitHub Bot commented on GEODE-3539: --------------------------------------- jinmeiliao closed pull request #1104: GEODE-3539: enhance rule to start locator joining other locators URL: https://github.com/apache/geode/pull/1104 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): 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 4b91ce50c4..92e8c9d8bb 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.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 @@ private File createJarWithFunctionB(String version) throws Exception { 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 @@ private void assertThatFunctionHasVersion(String functionId, String version) { 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 0d12a18949..5a1058fb60 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 void testDeployToNoServer() throws Exception { @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 c9e2c8337c..1399e2bae8 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 @@ 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.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 MemberVM startLocatorVM(int index) throws Exception { 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)}. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add more test coverage for p2p commands > --------------------------------------- > > Key: GEODE-3539 > URL: https://issues.apache.org/jira/browse/GEODE-3539 > Project: Geode > Issue Type: Improvement > Components: gfsh > Reporter: Jinmei Liao > > Add more command tests that would eventually get rid of the legacy tests. -- This message was sent by Atlassian JIRA (v6.4.14#64029)