geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mark...@apache.org
Subject [2/4] incubator-geode git commit: [GEODE-51] - Including hostname-for-client parameters for server startup in order allow external clients connect to a distributed system from a different network. Needed for VMs or Docker deployments
Date Wed, 24 Jun 2015 01:40:28 GMT
[GEODE-51] - Including hostname-for-client parameters for server startup in order allow external
clients connect to a distributed system from a different network. Needed for VMs or Docker
deployments


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/3c952ac5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/3c952ac5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/3c952ac5

Branch: refs/heads/develop
Commit: 3c952ac5e5c948e09c7475170496a46da61ec190
Parents: c70f8fa
Author: William Markito <wmarkito@pivotal.io>
Authored: Tue Jun 16 16:11:38 2015 -0700
Committer: William Markito <wmarkito@pivotal.io>
Committed: Tue Jun 23 18:29:29 2015 -0700

----------------------------------------------------------------------
 .../gemstone/gemfire/distributed/ServerLauncher.java  | 14 ++++++++++++--
 .../cli/commands/LauncherLifecycleCommands.java       |  6 ++++++
 .../gemfire/distributed/ServerLauncherJUnitTest.java  | 14 +++++++++++++-
 3 files changed, 31 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3c952ac5/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/ServerLauncher.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/ServerLauncher.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/ServerLauncher.java
index d5db59d..8018433 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/ServerLauncher.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/ServerLauncher.java
@@ -912,7 +912,11 @@ public final class ServerLauncher extends AbstractLauncher<String>
{
       if (getSocketBufferSize() != null) {
         cacheServer.setSocketBufferSize(getSocketBufferSize());
       }
-      
+
+      if (getHostNameForClients() != null) {
+        cacheServer.setHostnameForClients(getHostNameForClients());
+      }
+
       cacheServer.start();
     }
   }
@@ -1434,6 +1438,7 @@ public final class ServerLauncher extends AbstractLauncher<String>
{
       parser.accepts(CliStrings.START_SERVER__MAX__THREADS).withRequiredArg().ofType(Integer.class);
       parser.accepts(CliStrings.START_SERVER__MESSAGE__TIME__TO__LIVE).withRequiredArg().ofType(Integer.class);
       parser.accepts(CliStrings.START_SERVER__SOCKET__BUFFER__SIZE).withRequiredArg().ofType(Integer.class);
+      parser.accepts(CliStrings.START_SERVER__HOSTNAME__FOR__CLIENTS).withRequiredArg().ofType(String.class);
 
       return parser;
     }
@@ -1518,7 +1523,12 @@ public final class ServerLauncher extends AbstractLauncher<String>
{
         if (options.hasArgument(CliStrings.START_SERVER__SOCKET__BUFFER__SIZE)) {
           setSocketBufferSize(Integer.parseInt(ObjectUtils.toString(options.valueOf(
             CliStrings.START_SERVER__SOCKET__BUFFER__SIZE))));
-        } 
+        }
+
+        if (options.hasArgument(CliStrings.START_SERVER__HOSTNAME__FOR__CLIENTS)) {
+          setHostNameForClients(ObjectUtils.toString(options.valueOf(CliStrings.START_SERVER__HOSTNAME__FOR__CLIENTS)));
+        }
+
       }
       catch (OptionException e) {
         throw new IllegalArgumentException(LocalizedStrings.Launcher_Builder_PARSE_COMMAND_LINE_ARGUMENT_ERROR_MESSAGE

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3c952ac5/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommands.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommands.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommands.java
index 68b2483..170f330 100755
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommands.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/LauncherLifecycleCommands.java
@@ -1519,6 +1519,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport
{
                                       help = CliStrings.START_SERVER__SOCKET__BUFFER__SIZE__HELP)
                             final Integer socketBufferSize)
   {
+
     try {
       if (workingDirectory == null) {
         // attempt to use or make sub-directory using memberName...
@@ -1591,6 +1592,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport
{
         .setMaxThreads(maxThreads)
         .setMessageTimeToLive(messageTimeToLive)
         .setSocketBufferSize(socketBufferSize)
+        .setHostNameForClients(hostNameForClients)
         .build();
 
       String[] serverCommandLine = createStartServerCommandLine(serverLauncher, gemfirePropertiesPathname,
@@ -1813,6 +1815,10 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport
{
       commandLine.add("--" + CliStrings.START_SERVER__MAX__THREADS + "=" + launcher.getMaxThreads());
     }
 
+    if (launcher.getHostNameForClients() != null) {
+      commandLine.add("--" + CliStrings.START_SERVER__HOSTNAME__FOR__CLIENTS + "=" + launcher.getHostNameForClients());
+    }
+
     return commandLine.toArray(new String[commandLine.size()]);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3c952ac5/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherJUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherJUnitTest.java
index 5af33e1..88876e7 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherJUnitTest.java
@@ -110,10 +110,11 @@ public class ServerLauncherJUnitTest extends CommonLauncherTestSuite
{
 
     builder.parseArguments("start", "serverOne", "--assign-buckets", "--disable-default-server",
"--debug", "--force",
       "--rebalance", "--redirect-output", "--dir=" + ServerLauncher.DEFAULT_WORKING_DIRECTORY,
"--pid=1234",
-        "--server-bind-address=" + InetAddress.getLocalHost().getHostAddress(), "--server-port=11235");
+        "--server-bind-address=" + InetAddress.getLocalHost().getHostAddress(), "--server-port=11235",
"--hostname-for-clients=192.168.99.100");
 
     assertEquals(Command.START, builder.getCommand());
     assertEquals("serverOne", builder.getMemberName());
+    assertEquals("192.168.99.100", builder.getHostNameForClients());
     assertTrue(builder.getAssignBuckets());
     assertTrue(builder.getDisableDefaultServer());
     assertTrue(builder.getDebug());
@@ -288,6 +289,17 @@ public class ServerLauncherJUnitTest extends CommonLauncherTestSuite
{
   }
 
   @Test
+  public void testSetAndGetHostnameForClients() {
+    final Builder builder = new Builder();
+
+    assertNull(builder.getHostNameForClients());
+    assertSame(builder, builder.setHostNameForClients("Pegasus"));
+    assertEquals("Pegasus", builder.getHostNameForClients());
+    assertSame(builder, builder.setHostNameForClients(null));
+    assertNull(builder.getHostNameForClients());
+  }
+
+  @Test
   public void testSetAndGetServerPort() {
     Builder builder = new Builder();
 


Mime
View raw message