You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ji...@apache.org on 2017/02/07 04:15:32 UTC
geode git commit: GEODE-2103: start locator command should include
--http-service-port and --http-service-bind-address
Repository: geode
Updated Branches:
refs/heads/develop 2df3063f6 -> 1d5ae68ef
GEODE-2103: start locator command should include --http-service-port and --http-service-bind-address
* Adding --http-service-port and --http-service-bind-address parameters to start locator command
* Added Junit test to verify command line parameters
* Fixing HelpCommandsIntegrationTest
* this closes #326
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/1d5ae68e
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/1d5ae68e
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/1d5ae68e
Branch: refs/heads/develop
Commit: 1d5ae68ef07fa2c7f4298b91be9f02bea5fc8110
Parents: 2df3063
Author: Deepak Dixit <de...@gmail.com>
Authored: Sat Dec 24 10:42:55 2016 +0530
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Mon Feb 6 20:14:56 2017 -0800
----------------------------------------------------------------------
.../LauncherLifecycleCommandsJUnitTest.java | 43 ++++++++++++++++++++
.../cli/commands/LauncherLifecycleCommands.java | 13 +++++-
.../internal/cli/i18n/CliStrings.java | 6 +++
.../cli/commands/golden-help-offline.properties | 9 +++-
4 files changed, 69 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/1d5ae68e/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsJUnitTest.java b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsJUnitTest.java
index a31c78c..947da42 100755
--- a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsJUnitTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsJUnitTest.java
@@ -25,6 +25,7 @@ import java.util.Properties;
import java.util.Set;
import java.util.Stack;
+import org.apache.geode.distributed.LocatorLauncher;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -566,6 +567,48 @@ public class LauncherLifecycleCommandsJUnitTest {
expectedCommandLineElements.isEmpty());
}
+ /**
+ * Verify commandline parameters passed for starting locator
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testLocatorCommandLineWithRestAPI() throws Exception {
+ LocatorLauncher locatorLauncher =
+ new LocatorLauncher.Builder().setCommand(LocatorLauncher.Command.START)
+ .setMemberName("testLocatorCommandLineWithRestAPI").setBindAddress("localhost")
+ .setPort(11111).build();
+
+ Properties gemfireProperties = new Properties();
+ gemfireProperties.setProperty(HTTP_SERVICE_PORT, "8089");
+ gemfireProperties.setProperty(HTTP_SERVICE_BIND_ADDRESS, "localhost");
+
+
+ String[] commandLineElements = launcherCommands.createStartLocatorCommandLine(locatorLauncher,
+ null, null, gemfireProperties, null, false, new String[0], null, null);
+
+ assertNotNull(commandLineElements);
+ assertTrue(commandLineElements.length > 0);
+
+ Set<String> expectedCommandLineElements = new HashSet<>(6);
+
+ expectedCommandLineElements.add(locatorLauncher.getCommand().getName());
+ expectedCommandLineElements.add(locatorLauncher.getMemberName().toLowerCase());
+ expectedCommandLineElements.add(String.format("--port=%1$d", locatorLauncher.getPort()));
+ expectedCommandLineElements
+ .add("-d" + DistributionConfig.GEMFIRE_PREFIX + "" + HTTP_SERVICE_PORT + "=" + "8089");
+ expectedCommandLineElements.add("-d" + DistributionConfig.GEMFIRE_PREFIX + ""
+ + HTTP_SERVICE_BIND_ADDRESS + "=" + "localhost");
+
+
+ for (String commandLineElement : commandLineElements) {
+ expectedCommandLineElements.remove(commandLineElement.toLowerCase());
+ }
+
+ assertTrue(String.format("Expected ([]); but was (%1$s)", expectedCommandLineElements),
+ expectedCommandLineElements.isEmpty());
+ }
+
@Test
public void testReadPidWithNonExistingFile() {
http://git-wip-us.apache.org/repos/asf/geode/blob/1d5ae68e/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java
index 922b94d..e677ba3 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java
@@ -276,7 +276,13 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
unspecifiedDefaultValue = "false",
help = CliStrings.START_LOCATOR__LOAD__SHARED_CONFIGURATION__FROM__FILESYSTEM__HELP) final boolean loadSharedConfigurationFromDirectory,
@CliOption(key = CliStrings.START_LOCATOR__CLUSTER__CONFIG__DIR, unspecifiedDefaultValue = "",
- help = CliStrings.START_LOCATOR__CLUSTER__CONFIG__DIR__HELP) final String clusterConfigDir) {
+ help = CliStrings.START_LOCATOR__CLUSTER__CONFIG__DIR__HELP) final String clusterConfigDir,
+ @CliOption(key = CliStrings.START_LOCATOR__HTTP_SERVICE_PORT,
+ unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
+ help = CliStrings.START_LOCATOR__HTTP_SERVICE_PORT__HELP) final Integer httpServicePort,
+ @CliOption(key = CliStrings.START_LOCATOR__HTTP_SERVICE_BIND_ADDRESS,
+ unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
+ help = CliStrings.START_LOCATOR__HTTP_SERVICE_BIND_ADDRESS__HELP) final String httpServiceBindAddress) {
try {
if (StringUtils.isBlank(memberName)) {
// when the user doesn't give us a name, we make one up!
@@ -336,6 +342,11 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
StringUtils.valueOf(loadSharedConfigurationFromDirectory, StringUtils.EMPTY_STRING));
gemfireProperties.setProperty(CLUSTER_CONFIGURATION_DIR,
StringUtils.valueOf(clusterConfigDir, StringUtils.EMPTY_STRING));
+ gemfireProperties.setProperty(HTTP_SERVICE_PORT,
+ StringUtils.valueOf(httpServicePort, StringUtils.EMPTY_STRING));
+ gemfireProperties.setProperty(HTTP_SERVICE_BIND_ADDRESS,
+ StringUtils.valueOf(httpServiceBindAddress, StringUtils.EMPTY_STRING));
+
// read the OSProcess enable redirect system property here -- TODO: replace with new GFSH
// argument
http://git-wip-us.apache.org/repos/asf/geode/blob/1d5ae68e/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
index 4c22c44..c536e8e 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
@@ -2396,6 +2396,12 @@ public class CliStrings {
public static final String START_LOCATOR__CLUSTER__CONFIG__DIR = "cluster-config-dir";
public static final String START_LOCATOR__CLUSTER__CONFIG__DIR__HELP =
"Directory used by the cluster configuration service to store the cluster configuration on the filesystem";
+ public static final String START_LOCATOR__HTTP_SERVICE_PORT = "http-service-port";
+ public static final String START_LOCATOR__HTTP_SERVICE_PORT__HELP =
+ "Port on which HTTP Service will listen on";
+ public static final String START_LOCATOR__HTTP_SERVICE_BIND_ADDRESS = "http-service-bind-address";
+ public static final String START_LOCATOR__HTTP_SERVICE_BIND_ADDRESS__HELP =
+ "The IP address on which the HTTP Service will be bound. By default, the Server is bound to all local addresses.";
/* 'start manager' command */
public static final String START_MANAGER = "start manager";
http://git-wip-us.apache.org/repos/asf/geode/blob/1d5ae68e/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/golden-help-offline.properties
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/golden-help-offline.properties b/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/golden-help-offline.properties
index d0f41e4..694d4ff 100644
--- a/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/golden-help-offline.properties
+++ b/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/golden-help-offline.properties
@@ -2416,7 +2416,7 @@ SYNTAX\n\
\ \ \ \ [--port=value] [--dir=value] [--properties-file=value] [--security-properties-file=value]\n\
\ \ \ \ [--initial-heap=value] [--max-heap=value] [--J=value(,value)*] [--connect(=value)?]\n\
\ \ \ \ [--enable-cluster-configuration(=value)?] [--load-cluster-configuration-from-dir=value]\n\
-\ \ \ \ [--cluster-config-dir=value]\n\
+\ \ \ \ [--cluster-config-dir=value] [--http-service-port=value] [--http-service-bind-address=value]\n\
PARAMETERS\n\
\ \ \ \ name\n\
\ \ \ \ \ \ \ \ The member name to give this Locator in the Geode cluster.\n\
@@ -2509,6 +2509,13 @@ PARAMETERS\n\
\ \ \ \ \ \ \ \ Directory used by the cluster configuration service to store the cluster configuration on\n\
\ \ \ \ \ \ \ \ the filesystem\n\
\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ http-service-port\n\
+\ \ \ \ \ \ \ \ Port on which HTTP Service will listen on\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ http-service-bind-address\n\
+\ \ \ \ \ \ \ \ The IP address on which the HTTP Service will be bound. By default, the Server is bound to\n\
+\ \ \ \ \ \ \ \ all local addresses.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
start-pulse.help=\
NAME\n\