You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by la...@apache.org on 2017/10/03 22:40:39 UTC

[geode] branch feature/GEODE-3687 updated (931e03f -> 6b96a8a)

This is an automated email from the ASF dual-hosted git repository.

ladyvader pushed a change to branch feature/GEODE-3687
in repository https://gitbox.apache.org/repos/asf/geode.git.


 discard 931e03f  GEODE-3687: GatewayReceiverImpl constructor and create method updates
     new 6b96a8a  GEODE-3687: GatewayReceiverImpl constructor and create method updates

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (931e03f)
            \
             N -- N -- N   refs/heads/feature/GEODE-3687 (6b96a8a)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../CreateGatewayReceiverCommandDUnitTest.java     | 126 ++++++++++++---------
 .../cache/wan/wancommand/WANCommandTestBase.java   |   9 +-
 2 files changed, 78 insertions(+), 57 deletions(-)

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

[geode] 01/01: GEODE-3687: GatewayReceiverImpl constructor and create method updates

Posted by la...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ladyvader pushed a commit to branch feature/GEODE-3687
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 6b96a8aa16cd2dc175c1fd152587162c5aa2c3c2
Author: Lynn Hughes-Godfrey <lh...@pivotal.io>
AuthorDate: Fri Sep 29 13:18:31 2017 -0700

    GEODE-3687: GatewayReceiverImpl constructor and create method updates
    
    - bind-address specified in gemfire.properties is now used to configure Profile and ServerLocations
    - removed host field (previously calculated at config time based on hostname-for-sender and bind-address parameters)
      with result then passed to CacheServerImpl.start()
    - replaced host field with hostnameForSenders, which is now used (when set) to set hostnameForClients in CacheServerImpl.
    - replaced getHost with getHostnameForSenders
    - associated tests, including those to set bind-address and server-bind-address through gemfire.properties
---
 .../apache/geode/cache/wan/GatewayReceiver.java    |   2 +-
 .../internal/cache/xmlcache/CacheCreation.java     |   2 +-
 .../cache/xmlcache/GatewayReceiverCreation.java    |  30 +-
 .../internal/cache/wan/GatewayReceiverImpl.java    |  51 +--
 .../geode/cache/CacheXml70GatewayDUnitTest.java    |   2 +-
 .../cache/wan/misc/WANConfigurationJUnitTest.java  |   2 +-
 .../CreateGatewayReceiverCommandDUnitTest.java     | 433 ++++++++++++++++-----
 .../cache/wan/wancommand/WANCommandTestBase.java   |  45 ++-
 8 files changed, 395 insertions(+), 172 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/cache/wan/GatewayReceiver.java b/geode-core/src/main/java/org/apache/geode/cache/wan/GatewayReceiver.java
index fd6f039..5ea2ef3 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/wan/GatewayReceiver.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/wan/GatewayReceiver.java
@@ -134,7 +134,7 @@ public interface GatewayReceiver {
    * 
    * @return the ip address or host name to give to clients so they can connect to this receiver
    */
-  public String getHost();
+  public String getHostnameForSenders();
 
   /**
    * Returns the configured buffer size of the socket connection for this
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
index 9c80ce1..b8c14c1 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
@@ -536,7 +536,7 @@ public class CacheCreation implements InternalCache {
       for (GatewayTransportFilter filter : receiverCreation.getGatewayTransportFilters()) {
         factory.addGatewayTransportFilter(filter);
       }
-      factory.setHostnameForSenders(receiverCreation.getHost());
+      factory.setHostnameForSenders(receiverCreation.getHostnameForSenders());
       GatewayReceiver receiver = factory.create();
       if (receiver.isManualStart()) {
         cache.getLoggerI18n().info(
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/GatewayReceiverCreation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/GatewayReceiverCreation.java
index a4241f5..7dc30a3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/GatewayReceiverCreation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/GatewayReceiverCreation.java
@@ -51,6 +51,8 @@ public class GatewayReceiverCreation implements GatewayReceiver {
 
   private String bindAddress;
 
+  private String hostnameForSenders;
+
   private boolean manualStart;
 
   private CacheServer receiver;
@@ -61,34 +63,12 @@ public class GatewayReceiverCreation implements GatewayReceiver {
       boolean manualStart) {
     this.cache = cache;
 
-    /*
-     * If user has set hostNameForSenders then it should take precedence over bindAddress. If user
-     * hasn't set either hostNameForSenders or bindAddress then getLocalHost().getHostName() should
-     * be used.
-     */
-    if (hostnameForSenders == null || hostnameForSenders.isEmpty()) {
-      if (bindAdd == null || bindAdd.isEmpty()) {
-        try {
-          logger
-              .warn(LocalizedMessage.create(LocalizedStrings.GatewayReceiverImpl_USING_LOCAL_HOST));
-          this.host = SocketCreator.getLocalHost().getHostName();
-        } catch (UnknownHostException e) {
-          throw new IllegalStateException(
-              LocalizedStrings.GatewayReceiverImpl_COULD_NOT_GET_HOST_NAME.toLocalizedString(), e);
-        }
-      } else {
-        this.host = bindAdd;
-      }
-    } else {
-      this.host = hostnameForSenders;
-    }
-
-
     this.startPort = startPort;
     this.endPort = endPort;
     this.maxTimeBetweenPings = timeBetPings;
     this.socketBufferSize = buffSize;
     this.bindAddress = bindAdd;
+    this.hostnameForSenders = hostnameForSenders;
     this.transFilter = filters;
     this.manualStart = manualStart;
   }
@@ -129,8 +109,8 @@ public class GatewayReceiverCreation implements GatewayReceiver {
     this.socketBufferSize = socketBufferSize;
   }
 
-  public String getHost() {
-    return this.host;
+  public String getHostnameForSenders() {
+    return this.hostnameForSenders;
   }
 
   public String getBindAddress() {
diff --git a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewayReceiverImpl.java b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewayReceiverImpl.java
index 5e26a46..b4b2b56 100644
--- a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewayReceiverImpl.java
+++ b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewayReceiverImpl.java
@@ -46,6 +46,8 @@ public class GatewayReceiverImpl implements GatewayReceiver {
 
   private String host;
 
+  private String hostnameForSenders;
+
   private int startPort;
 
   private int endPort;
@@ -71,28 +73,7 @@ public class GatewayReceiverImpl implements GatewayReceiver {
       boolean manualStart) {
     this.cache = cache;
 
-    /*
-     * If user has set hostNameForSenders then it should take precedence over bindAddress. If user
-     * hasn't set either hostNameForSenders or bindAddress then getLocalHost().getHostName() should
-     * be used.
-     */
-    if (hostnameForSenders == null || hostnameForSenders.isEmpty()) {
-      if (bindAdd == null || bindAdd.isEmpty()) {
-        try {
-          logger
-              .warn(LocalizedMessage.create(LocalizedStrings.GatewayReceiverImpl_USING_LOCAL_HOST));
-          this.host = SocketCreator.getLocalHost().getHostName();
-        } catch (UnknownHostException e) {
-          throw new IllegalStateException(
-              LocalizedStrings.GatewayReceiverImpl_COULD_NOT_GET_HOST_NAME.toLocalizedString(), e);
-        }
-      } else {
-        this.host = bindAdd;
-      }
-    } else {
-      this.host = hostnameForSenders;
-    }
-
+    this.hostnameForSenders = hostnameForSenders;
     this.startPort = startPort;
     this.endPort = endPort;
     this.timeBetPings = timeBetPings;
@@ -102,6 +83,10 @@ public class GatewayReceiverImpl implements GatewayReceiver {
     this.manualStart = manualStart;
   }
 
+  public String getHostnameForSenders() {
+    return hostnameForSenders;
+  }
+
   public List<GatewayTransportFilter> getGatewayTransportFilters() {
     return this.filters;
   }
@@ -148,7 +133,9 @@ public class GatewayReceiverImpl implements GatewayReceiver {
       receiver.setPort(this.port);
       receiver.setSocketBufferSize(socketBufferSize);
       receiver.setMaximumTimeBetweenPings(timeBetPings);
-      receiver.setHostnameForClients(host);
+      if (hostnameForSenders != null && !hostnameForSenders.isEmpty()) {
+        receiver.setHostnameForClients(hostnameForSenders);
+      }
       receiver.setBindAddress(bindAdd);
       receiver.setGroups(new String[] {GatewayReceiver.RECEIVER_GROUP});
       ((CacheServerImpl) receiver).setGatewayTransportFilter(this.filters);
@@ -209,10 +196,6 @@ public class GatewayReceiverImpl implements GatewayReceiver {
     receiver.stop();
   }
 
-  public String getHost() {
-    return this.host;
-  }
-
   public String getBindAddress() {
     return this.bindAdd;
   }
@@ -226,13 +209,13 @@ public class GatewayReceiverImpl implements GatewayReceiver {
 
   public String toString() {
     return new StringBuffer().append("Gateway Receiver").append("@")
-        .append(Integer.toHexString(hashCode())).append(" [").append("host='").append(getHost())
-        .append("'; port=").append(getPort()).append("; bindAddress=").append(getBindAddress())
-        .append("; maximumTimeBetweenPings=").append(getMaximumTimeBetweenPings())
-        .append("; socketBufferSize=").append(getSocketBufferSize()).append("; isManualStart=")
-        .append(isManualStart()).append("; group=")
-        .append(Arrays.toString(new String[] {GatewayReceiver.RECEIVER_GROUP})).append("]")
-        .toString();
+        .append(Integer.toHexString(hashCode())).append("'; port=").append(getPort())
+        .append("; bindAddress=").append(getBindAddress()).append("'; hostnameForSenders=")
+        .append(getHostnameForSenders()).append("; maximumTimeBetweenPings=")
+        .append(getMaximumTimeBetweenPings()).append("; socketBufferSize=")
+        .append(getSocketBufferSize()).append("; isManualStart=").append(isManualStart())
+        .append("; group=").append(Arrays.toString(new String[] {GatewayReceiver.RECEIVER_GROUP}))
+        .append("]").toString();
   }
 
 }
diff --git a/geode-wan/src/test/java/org/apache/geode/cache/CacheXml70GatewayDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/cache/CacheXml70GatewayDUnitTest.java
index 25cffb3..9e50c94 100644
--- a/geode-wan/src/test/java/org/apache/geode/cache/CacheXml70GatewayDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/cache/CacheXml70GatewayDUnitTest.java
@@ -219,7 +219,7 @@ public class CacheXml70GatewayDUnitTest extends CacheXmlTestCase {
   }
 
   static void validateGatewayReceiver(GatewayReceiver receiver1, GatewayReceiver gatewayReceiver) {
-    assertEquals(receiver1.getHost(), gatewayReceiver.getHost());
+    assertEquals(receiver1.getHostnameForSenders(), gatewayReceiver.getHostnameForSenders());
     assertEquals(receiver1.getStartPort(), gatewayReceiver.getStartPort());
     assertEquals(receiver1.getEndPort(), gatewayReceiver.getEndPort());
     assertEquals(receiver1.getMaximumTimeBetweenPings(),
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WANConfigurationJUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WANConfigurationJUnitTest.java
index 202ffe9..43f8cb9 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WANConfigurationJUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/misc/WANConfigurationJUnitTest.java
@@ -223,7 +223,7 @@ public class WANConfigurationJUnitTest {
     Region region = cache.createRegionFactory().create("test_ValidateGatewayReceiverAttributes");
     Set<GatewayReceiver> receivers = cache.getGatewayReceivers();
     GatewayReceiver rec = receivers.iterator().next();
-    assertEquals(receiver1.getHost(), rec.getHost());
+    assertEquals(receiver1.getHostnameForSenders(), rec.getHostnameForSenders());
     assertEquals(receiver1.getStartPort(), rec.getStartPort());
     assertEquals(receiver1.getEndPort(), rec.getEndPort());
     assertEquals(receiver1.getBindAddress(), rec.getBindAddress());
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/CreateGatewayReceiverCommandDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/CreateGatewayReceiverCommandDUnitTest.java
index 63a5043..27da5da 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/CreateGatewayReceiverCommandDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/CreateGatewayReceiverCommandDUnitTest.java
@@ -20,12 +20,9 @@ import static org.apache.geode.test.dunit.Assert.fail;
 import static org.apache.geode.test.dunit.LogWriterUtils.getLogWriter;
 
 import java.net.InetAddress;
-import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.geode.internal.i18n.LocalizedStrings;
-import org.apache.geode.internal.logging.log4j.LocalizedMessage;
 import org.apache.geode.internal.net.SocketCreator;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -64,6 +61,47 @@ public class CreateGatewayReceiverCommandDUnitTest extends WANCommandTestBase {
     vm5.invoke(() -> createCache(dsIdPort));
 
     String command = CliStrings.CREATE_GATEWAYRECEIVER;
+    executeCommandAndVerifyStatus(command, 4);
+
+    // if neither bind-address or hostname-for-senders is set, profile
+    // uses AcceptorImpl.getExternalAddress() to derive canonical hostname
+    // when the Profile (and ServerLocation) are created
+    String hostname = getHostName();
+
+    vm3.invoke(() -> verifyGatewayReceiverProfile(hostname));
+    vm4.invoke(() -> verifyGatewayReceiverProfile(hostname));
+    vm5.invoke(() -> verifyGatewayReceiverProfile(hostname));
+
+    vm3.invoke(() -> verifyGatewayReceiverServerLocations(dsIdPort, hostname));
+    vm4.invoke(() -> verifyGatewayReceiverServerLocations(dsIdPort, hostname));
+    vm5.invoke(() -> verifyGatewayReceiverServerLocations(dsIdPort, hostname));
+
+    vm3.invoke(() -> verifyReceiverCreationWithAttributes(!GatewayReceiver.DEFAULT_MANUAL_START,
+        GatewayReceiver.DEFAULT_START_PORT, GatewayReceiver.DEFAULT_END_PORT,
+        GatewayReceiver.DEFAULT_BIND_ADDRESS, GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS,
+        GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null,
+        GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
+    vm4.invoke(() -> verifyReceiverCreationWithAttributes(!GatewayReceiver.DEFAULT_MANUAL_START,
+        GatewayReceiver.DEFAULT_START_PORT, GatewayReceiver.DEFAULT_END_PORT,
+        GatewayReceiver.DEFAULT_BIND_ADDRESS, GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS,
+        GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null,
+        GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
+    vm5.invoke(() -> verifyReceiverCreationWithAttributes(!GatewayReceiver.DEFAULT_MANUAL_START,
+        GatewayReceiver.DEFAULT_START_PORT, GatewayReceiver.DEFAULT_END_PORT,
+        GatewayReceiver.DEFAULT_BIND_ADDRESS, GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS,
+        GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null,
+        GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
+  }
+
+  private String getHostName() throws Exception {
+    return SocketCreator.getLocalHost().getCanonicalHostName();
+  }
+
+  private String getBindAddress() throws Exception {
+    return InetAddress.getLocalHost().getHostAddress();
+  }
+
+  private void executeCommandAndVerifyStatus(String command, int numGatewayReceivers) {
     CommandResult cmdResult = executeCommand(command);
     if (cmdResult != null) {
       String strCmdResult = commandResultToString(cmdResult);
@@ -72,7 +110,9 @@ public class CreateGatewayReceiverCommandDUnitTest extends WANCommandTestBase {
 
       TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
       List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(4, status.size());// expected size 4 includes the manager node
+      // expected size of 4 includes the manager node when we don't set the receiver groups to
+      // ignore it)
+      assertEquals(numGatewayReceivers, status.size());
       // verify there is no error in the status
       for (String stat : status) {
         assertTrue("GatewayReceiver creation failed with: " + stat, !stat.contains("ERROR:"));
@@ -80,22 +120,6 @@ public class CreateGatewayReceiverCommandDUnitTest extends WANCommandTestBase {
     } else {
       fail("testCreateGatewayReceiver failed as did not get CommandResult");
     }
-
-    String hostname;
-    hostname = SocketCreator.getLocalHost().getHostName();
-
-    vm3.invoke(() -> verifyReceiverCreationWithAttributes(!GatewayReceiver.DEFAULT_MANUAL_START,
-        GatewayReceiver.DEFAULT_START_PORT, GatewayReceiver.DEFAULT_END_PORT,
-        GatewayReceiver.DEFAULT_BIND_ADDRESS, GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS,
-        GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null, hostname));
-    vm4.invoke(() -> verifyReceiverCreationWithAttributes(!GatewayReceiver.DEFAULT_MANUAL_START,
-        GatewayReceiver.DEFAULT_START_PORT, GatewayReceiver.DEFAULT_END_PORT,
-        GatewayReceiver.DEFAULT_BIND_ADDRESS, GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS,
-        GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null, hostname));
-    vm5.invoke(() -> verifyReceiverCreationWithAttributes(!GatewayReceiver.DEFAULT_MANUAL_START,
-        GatewayReceiver.DEFAULT_START_PORT, GatewayReceiver.DEFAULT_END_PORT,
-        GatewayReceiver.DEFAULT_BIND_ADDRESS, GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS,
-        GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null, hostname));
   }
 
   /**
@@ -119,35 +143,23 @@ public class CreateGatewayReceiverCommandDUnitTest extends WANCommandTestBase {
             + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000" + " --"
             + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000" + " --"
             + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info("testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
+    executeCommandAndVerifyStatus(command, 4);
+
+    // cannot verify Profile/ServerLocation when manualStart is true
 
-      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(4, status.size());// expected size 4 includes the manager node
-      // verify there is no error in the status
-      for (String stat : status) {
-        assertTrue("GatewayReceiver creation failed with: " + stat, !stat.contains("ERROR:"));
-      }
-    } else {
-      fail("testCreateGatewayReceiver failed as did not get CommandResult");
-    }
     vm3.invoke(() -> verifyReceiverCreationWithAttributes(false, 10000, 11000, "localhost", 100000,
-        512000, null, "localhost"));
+        512000, null, GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
     vm4.invoke(() -> verifyReceiverCreationWithAttributes(false, 10000, 11000, "localhost", 100000,
-        512000, null, "localhost"));
+        512000, null, GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
     vm5.invoke(() -> verifyReceiverCreationWithAttributes(false, 10000, 11000, "localhost", 100000,
-        512000, null, "localhost"));
+        512000, null, GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
   }
 
   /**
    * GatewayReceiver with hostnameForSenders
    */
   @Test
-  public void testCreateGatewayReceiverWithHostnameForSenders() throws UnknownHostException {
+  public void testCreateGatewayReceiverWithHostnameForSenders() throws Exception {
     VM puneLocator = Host.getLocator();
     int dsIdPort = puneLocator.invoke(this::getLocatorPort);
     propsSetUp(dsIdPort);
@@ -157,7 +169,7 @@ public class CreateGatewayReceiverCommandDUnitTest extends WANCommandTestBase {
     vm4.invoke(() -> createCache(dsIdPort));
     vm5.invoke(() -> createCache(dsIdPort));
 
-    String hostnameForSenders = InetAddress.getLocalHost().getHostName();
+    String hostnameForSenders = getHostName();
     String command =
         CliStrings.CREATE_GATEWAYRECEIVER + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART
             + "=false" + " --" + CliStrings.CREATE_GATEWAYRECEIVER__HOSTNAMEFORSENDERS + "="
@@ -165,23 +177,205 @@ public class CreateGatewayReceiverCommandDUnitTest extends WANCommandTestBase {
             + " --" + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000" + " --"
             + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000" + " --"
             + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info("testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
+    executeCommandAndVerifyStatus(command, 4);
 
-      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(4, status.size());// expected size 4 includes the manager node
-      // verify there is no error in the status
-      for (String stat : status) {
-        assertTrue("GatewayReceiver creation failed with: " + stat, !stat.contains("ERROR:"));
-      }
-    } else {
-      fail("testCreateGatewayReceiver failed as did not get CommandResult");
-    }
+    // verify hostname-for-senders is used when configured
+    vm3.invoke(() -> verifyGatewayReceiverProfile(hostnameForSenders));
+    vm4.invoke(() -> verifyGatewayReceiverProfile(hostnameForSenders));
+    vm5.invoke(() -> verifyGatewayReceiverProfile(hostnameForSenders));
+
+    vm3.invoke(() -> verifyGatewayReceiverServerLocations(dsIdPort, hostnameForSenders));
+    vm4.invoke(() -> verifyGatewayReceiverServerLocations(dsIdPort, hostnameForSenders));
+    vm5.invoke(() -> verifyGatewayReceiverServerLocations(dsIdPort, hostnameForSenders));
+
+    vm3.invoke(() -> verifyReceiverCreationWithAttributes(true, 10000, 11000, "", 100000, 512000,
+        null, hostnameForSenders));
+    vm4.invoke(() -> verifyReceiverCreationWithAttributes(true, 10000, 11000, "", 100000, 512000,
+        null, hostnameForSenders));
+    vm5.invoke(() -> verifyReceiverCreationWithAttributes(true, 10000, 11000, "", 100000, 512000,
+        null, hostnameForSenders));
+  }
+
+  /**
+   * GatewayReceiver with all default attributes and bind-address in gemfire-properties
+   */
+  @Test
+  public void testCreateGatewayReceiverWithDefaultAndBindProperty() throws Exception {
+    VM puneLocator = Host.getLocator();
+    int dsIdPort = puneLocator.invoke(this::getLocatorPort);
+    propsSetUp(dsIdPort);
+    vm2.invoke(() -> createFirstRemoteLocator(2, dsIdPort));
+
+    String expectedBindAddress = getBindAddress();
+
+    String receiverGroup = "receiverGroup";
+    vm3.invoke(() -> createCacheWithBindAddress(dsIdPort, expectedBindAddress, receiverGroup));
+    vm4.invoke(() -> createCacheWithBindAddress(dsIdPort, expectedBindAddress, receiverGroup));
+    vm5.invoke(() -> createCacheWithBindAddress(dsIdPort, expectedBindAddress, receiverGroup));
+
+    String command =
+        CliStrings.CREATE_GATEWAYRECEIVER + " --" + CliStrings.GROUP + "=" + receiverGroup;
+    executeCommandAndVerifyStatus(command, 3);
+
+    // verify bind-address used when provided as a gemfire property
+    vm3.invoke(() -> verifyGatewayReceiverProfile(expectedBindAddress));
+    vm4.invoke(() -> verifyGatewayReceiverProfile(expectedBindAddress));
+    vm5.invoke(() -> verifyGatewayReceiverProfile(expectedBindAddress));
+
+    vm3.invoke(() -> verifyGatewayReceiverServerLocations(dsIdPort, expectedBindAddress));
+    vm4.invoke(() -> verifyGatewayReceiverServerLocations(dsIdPort, expectedBindAddress));
+    vm5.invoke(() -> verifyGatewayReceiverServerLocations(dsIdPort, expectedBindAddress));
+
+    vm3.invoke(() -> verifyReceiverCreationWithAttributes(!GatewayReceiver.DEFAULT_MANUAL_START,
+        GatewayReceiver.DEFAULT_START_PORT, GatewayReceiver.DEFAULT_END_PORT,
+        GatewayReceiver.DEFAULT_BIND_ADDRESS, GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS,
+        GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null,
+        GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
+    vm4.invoke(() -> verifyReceiverCreationWithAttributes(!GatewayReceiver.DEFAULT_MANUAL_START,
+        GatewayReceiver.DEFAULT_START_PORT, GatewayReceiver.DEFAULT_END_PORT,
+        GatewayReceiver.DEFAULT_BIND_ADDRESS, GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS,
+        GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null,
+        GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
+    vm5.invoke(() -> verifyReceiverCreationWithAttributes(!GatewayReceiver.DEFAULT_MANUAL_START,
+        GatewayReceiver.DEFAULT_START_PORT, GatewayReceiver.DEFAULT_END_PORT,
+        GatewayReceiver.DEFAULT_BIND_ADDRESS, GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS,
+        GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null,
+        GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
+  }
+
+  /**
+   * GatewayReceiver with all default attributes and server-bind-address in the gemfire properties
+   */
+  @Test
+  public void testCreateGatewayReceiverWithDefaultsAndServerBindAddressProperty() throws Exception {
+    VM puneLocator = Host.getLocator();
+    int dsIdPort = puneLocator.invoke(this::getLocatorPort);
+    propsSetUp(dsIdPort);
+    vm2.invoke(() -> createFirstRemoteLocator(2, dsIdPort));
+
+    String expectedBindAddress = getBindAddress();
+
+    String receiverGroup = "receiverGroup";
+    vm3.invoke(
+        () -> createCacheWithServerBindAddress(dsIdPort, expectedBindAddress, receiverGroup));
+    vm4.invoke(
+        () -> createCacheWithServerBindAddress(dsIdPort, expectedBindAddress, receiverGroup));
+    vm5.invoke(
+        () -> createCacheWithServerBindAddress(dsIdPort, expectedBindAddress, receiverGroup));
+
+    String command =
+        CliStrings.CREATE_GATEWAYRECEIVER + " --" + CliStrings.GROUP + "=" + receiverGroup;
+    executeCommandAndVerifyStatus(command, 3);
+
+    // verify server-bind-address used if provided as a gemfire property
+    vm3.invoke(() -> verifyGatewayReceiverProfile(expectedBindAddress));
+    vm4.invoke(() -> verifyGatewayReceiverProfile(expectedBindAddress));
+    vm5.invoke(() -> verifyGatewayReceiverProfile(expectedBindAddress));
+
+    vm3.invoke(() -> verifyGatewayReceiverServerLocations(dsIdPort, expectedBindAddress));
+    vm4.invoke(() -> verifyGatewayReceiverServerLocations(dsIdPort, expectedBindAddress));
+    vm5.invoke(() -> verifyGatewayReceiverServerLocations(dsIdPort, expectedBindAddress));
+
+    vm3.invoke(() -> verifyReceiverCreationWithAttributes(!GatewayReceiver.DEFAULT_MANUAL_START,
+        GatewayReceiver.DEFAULT_START_PORT, GatewayReceiver.DEFAULT_END_PORT,
+        GatewayReceiver.DEFAULT_BIND_ADDRESS, GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS,
+        GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null,
+        GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
+    vm4.invoke(() -> verifyReceiverCreationWithAttributes(!GatewayReceiver.DEFAULT_MANUAL_START,
+        GatewayReceiver.DEFAULT_START_PORT, GatewayReceiver.DEFAULT_END_PORT,
+        GatewayReceiver.DEFAULT_BIND_ADDRESS, GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS,
+        GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null,
+        GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
+    vm5.invoke(() -> verifyReceiverCreationWithAttributes(!GatewayReceiver.DEFAULT_MANUAL_START,
+        GatewayReceiver.DEFAULT_START_PORT, GatewayReceiver.DEFAULT_END_PORT,
+        GatewayReceiver.DEFAULT_BIND_ADDRESS, GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS,
+        GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null,
+        GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
+  }
+
+  /**
+   * GatewayReceiver with all default attributes and server-bind-address in the gemfire properties
+   */
+  @Test
+  public void testCreateGatewayReceiverWithDefaultsAndMultipleBindAddressProperties()
+      throws Exception {
+    VM puneLocator = Host.getLocator();
+    int dsIdPort = puneLocator.invoke(this::getLocatorPort);
+    propsSetUp(dsIdPort);
+    vm2.invoke(() -> createFirstRemoteLocator(2, dsIdPort));
+
+    String extraBindAddress = "localhost";
+    String expectedBindAddress = getBindAddress();
+    String receiverGroup = "receiverGroup";
+
+    vm3.invoke(() -> createCacheWithMultipleBindAddressProperties(dsIdPort, extraBindAddress,
+        expectedBindAddress, receiverGroup));
+    vm4.invoke(() -> createCacheWithMultipleBindAddressProperties(dsIdPort, extraBindAddress,
+        expectedBindAddress, receiverGroup));
+    vm5.invoke(() -> createCacheWithMultipleBindAddressProperties(dsIdPort, extraBindAddress,
+        expectedBindAddress, receiverGroup));
+
+    String command =
+        CliStrings.CREATE_GATEWAYRECEIVER + " --" + CliStrings.GROUP + "=" + receiverGroup;
+    executeCommandAndVerifyStatus(command, 3);
+
+    // verify server-bind-address used if provided as a gemfire property
+    vm3.invoke(() -> verifyGatewayReceiverProfile(expectedBindAddress));
+    vm4.invoke(() -> verifyGatewayReceiverProfile(expectedBindAddress));
+    vm5.invoke(() -> verifyGatewayReceiverProfile(expectedBindAddress));
 
+    vm3.invoke(() -> verifyGatewayReceiverServerLocations(dsIdPort, expectedBindAddress));
+    vm4.invoke(() -> verifyGatewayReceiverServerLocations(dsIdPort, expectedBindAddress));
+    vm5.invoke(() -> verifyGatewayReceiverServerLocations(dsIdPort, expectedBindAddress));
+
+    vm3.invoke(() -> verifyReceiverCreationWithAttributes(!GatewayReceiver.DEFAULT_MANUAL_START,
+        GatewayReceiver.DEFAULT_START_PORT, GatewayReceiver.DEFAULT_END_PORT,
+        GatewayReceiver.DEFAULT_BIND_ADDRESS, GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS,
+        GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null,
+        GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
+    vm4.invoke(() -> verifyReceiverCreationWithAttributes(!GatewayReceiver.DEFAULT_MANUAL_START,
+        GatewayReceiver.DEFAULT_START_PORT, GatewayReceiver.DEFAULT_END_PORT,
+        GatewayReceiver.DEFAULT_BIND_ADDRESS, GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS,
+        GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null,
+        GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
+    vm5.invoke(() -> verifyReceiverCreationWithAttributes(!GatewayReceiver.DEFAULT_MANUAL_START,
+        GatewayReceiver.DEFAULT_START_PORT, GatewayReceiver.DEFAULT_END_PORT,
+        GatewayReceiver.DEFAULT_BIND_ADDRESS, GatewayReceiver.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS,
+        GatewayReceiver.DEFAULT_SOCKET_BUFFER_SIZE, null,
+        GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
+  }
+
+
+  /**
+   * GatewayReceiver with hostnameForSenders
+   */
+  @Test
+  public void testCreateGatewayReceiverWithHostnameForSendersAndServerBindAddressProperty()
+      throws Exception {
+    VM puneLocator = Host.getLocator();
+    int dsIdPort = puneLocator.invoke(this::getLocatorPort);
+    propsSetUp(dsIdPort);
+    vm2.invoke(() -> createFirstRemoteLocator(2, dsIdPort));
+
+    String hostnameForSenders = getHostName();
+    String serverBindAddress = getBindAddress();
+
+    String receiverGroup = "receiverGroup";
+    vm3.invoke(() -> createCacheWithServerBindAddress(dsIdPort, serverBindAddress, receiverGroup));
+    vm4.invoke(() -> createCacheWithServerBindAddress(dsIdPort, serverBindAddress, receiverGroup));
+    vm5.invoke(() -> createCacheWithServerBindAddress(dsIdPort, serverBindAddress, receiverGroup));
+
+    String command =
+        CliStrings.CREATE_GATEWAYRECEIVER + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART
+            + "=false" + " --" + CliStrings.CREATE_GATEWAYRECEIVER__HOSTNAMEFORSENDERS + "="
+            + hostnameForSenders + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000"
+            + " --" + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000" + " --"
+            + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000" + " --"
+            + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000" + " --"
+            + CliStrings.GROUP + "=" + receiverGroup;
+    executeCommandAndVerifyStatus(command, 3);
+
+    // verify server-bind-address takes precedence over hostname-for-senders
     vm3.invoke(() -> verifyGatewayReceiverProfile(hostnameForSenders));
     vm4.invoke(() -> verifyGatewayReceiverProfile(hostnameForSenders));
     vm5.invoke(() -> verifyGatewayReceiverProfile(hostnameForSenders));
@@ -198,6 +392,50 @@ public class CreateGatewayReceiverCommandDUnitTest extends WANCommandTestBase {
         null, hostnameForSenders));
   }
 
+  /**
+   * GatewayReceiver with hostnameForSenders
+   */
+  @Test
+  public void testCreateGatewayReceiverWithHostnameForSendersAndBindAddressProperty()
+      throws Exception {
+    VM puneLocator = Host.getLocator();
+    int dsIdPort = puneLocator.invoke(this::getLocatorPort);
+    propsSetUp(dsIdPort);
+    vm2.invoke(() -> createFirstRemoteLocator(2, dsIdPort));
+
+    String hostnameForSenders = getHostName();
+    String expectedBindAddress = getBindAddress();
+
+    String receiverGroup = "receiverGroup";
+    vm3.invoke(() -> createCacheWithBindAddress(dsIdPort, expectedBindAddress, receiverGroup));
+    vm4.invoke(() -> createCacheWithBindAddress(dsIdPort, expectedBindAddress, receiverGroup));
+    vm5.invoke(() -> createCacheWithBindAddress(dsIdPort, expectedBindAddress, receiverGroup));
+
+    String command =
+        CliStrings.CREATE_GATEWAYRECEIVER + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART
+            + "=false" + " --" + CliStrings.CREATE_GATEWAYRECEIVER__HOSTNAMEFORSENDERS + "="
+            + hostnameForSenders + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000"
+            + " --" + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000" + " --"
+            + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000" + " --"
+            + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000" + " --"
+            + CliStrings.GROUP + "=" + receiverGroup;
+    executeCommandAndVerifyStatus(command, 3);
+
+    vm3.invoke(() -> verifyGatewayReceiverProfile(hostnameForSenders));
+    vm4.invoke(() -> verifyGatewayReceiverProfile(hostnameForSenders));
+    vm5.invoke(() -> verifyGatewayReceiverProfile(hostnameForSenders));
+
+    vm3.invoke(() -> verifyGatewayReceiverServerLocations(dsIdPort, hostnameForSenders));
+    vm4.invoke(() -> verifyGatewayReceiverServerLocations(dsIdPort, hostnameForSenders));
+    vm5.invoke(() -> verifyGatewayReceiverServerLocations(dsIdPort, hostnameForSenders));
+
+    vm3.invoke(() -> verifyReceiverCreationWithAttributes(true, 10000, 11000, "", 100000, 512000,
+        null, hostnameForSenders));
+    vm4.invoke(() -> verifyReceiverCreationWithAttributes(true, 10000, 11000, "", 100000, 512000,
+        null, hostnameForSenders));
+    vm5.invoke(() -> verifyReceiverCreationWithAttributes(true, 10000, 11000, "", 100000, 512000,
+        null, hostnameForSenders));
+  }
 
   /**
    * GatewayReceiver with given attributes and a single GatewayTransportFilter.
@@ -222,31 +460,16 @@ public class CreateGatewayReceiverCommandDUnitTest extends WANCommandTestBase {
             + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000" + " --"
             + CliStrings.CREATE_GATEWAYRECEIVER__GATEWAYTRANSPORTFILTER
             + "=org.apache.geode.cache30.MyGatewayTransportFilter1";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info("testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(4, status.size());// expected size 4 includes the manager node
-      // verify there is no error in the status
-      for (String stat : status) {
-        assertTrue("GatewayReceiver creation failed with: " + stat, !stat.contains("ERROR:"));
-      }
-    } else {
-      fail("testCreateGatewayReceiver failed as did not get CommandResult");
-    }
+    executeCommandAndVerifyStatus(command, 4);
     List<String> transportFilters = new ArrayList<String>();
     transportFilters.add("org.apache.geode.cache30.MyGatewayTransportFilter1");
 
     vm3.invoke(() -> verifyReceiverCreationWithAttributes(true, 10000, 11000, "localhost", 100000,
-        512000, transportFilters, "localhost"));
+        512000, transportFilters, GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
     vm4.invoke(() -> verifyReceiverCreationWithAttributes(true, 10000, 11000, "localhost", 100000,
-        512000, transportFilters, "localhost"));
+        512000, transportFilters, GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
     vm5.invoke(() -> verifyReceiverCreationWithAttributes(true, 10000, 11000, "localhost", 100000,
-        512000, transportFilters, "localhost"));
+        512000, transportFilters, GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
   }
 
   /**
@@ -271,32 +494,20 @@ public class CreateGatewayReceiverCommandDUnitTest extends WANCommandTestBase {
         + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000" + " --"
         + CliStrings.CREATE_GATEWAYRECEIVER__GATEWAYTRANSPORTFILTER
         + "=org.apache.geode.cache30.MyGatewayTransportFilter1,org.apache.geode.cache30.MyGatewayTransportFilter2";
-    CommandResult cmdResult = executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = commandResultToString(cmdResult);
-      getLogWriter().info("testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(4, status.size());// expected size 4 includes the manager node
-      // verify there is no error in the status
-      for (String stat : status) {
-        assertTrue("GatewayReceiver creation failed with: " + stat, !stat.contains("ERROR:"));
-      }
-    } else {
-      fail("testCreateGatewayReceiver failed as did not get CommandResult");
-    }
+    executeCommandAndVerifyStatus(command, 4);
     List<String> transportFilters = new ArrayList<String>();
     transportFilters.add("org.apache.geode.cache30.MyGatewayTransportFilter1");
     transportFilters.add("org.apache.geode.cache30.MyGatewayTransportFilter2");
 
     vm3.invoke(() -> verifyReceiverCreationWithAttributes(!GatewayReceiver.DEFAULT_MANUAL_START,
-        10000, 11000, "localhost", 100000, 512000, transportFilters, "localhost"));
+        10000, 11000, "localhost", 100000, 512000, transportFilters,
+        GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
     vm4.invoke(() -> verifyReceiverCreationWithAttributes(!GatewayReceiver.DEFAULT_MANUAL_START,
-        10000, 11000, "localhost", 100000, 512000, transportFilters, "localhost"));
+        10000, 11000, "localhost", 100000, 512000, transportFilters,
+        GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
     vm5.invoke(() -> verifyReceiverCreationWithAttributes(!GatewayReceiver.DEFAULT_MANUAL_START,
-        10000, 11000, "localhost", 100000, 512000, transportFilters, "localhost"));
+        10000, 11000, "localhost", 100000, 512000, transportFilters,
+        GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
   }
 
   /**
@@ -378,8 +589,11 @@ public class CreateGatewayReceiverCommandDUnitTest extends WANCommandTestBase {
     } else {
       fail("testCreateGatewayReceiver failed as did not get CommandResult");
     }
+
+    // cannot verify Profile/ServerLocation when manualStart is true
+
     vm3.invoke(() -> verifyReceiverCreationWithAttributes(false, 10000, 11000, "localhost", 100000,
-        512000, null, "localhost"));
+        512000, null, GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
   }
 
   /**
@@ -424,10 +638,13 @@ public class CreateGatewayReceiverCommandDUnitTest extends WANCommandTestBase {
     } else {
       fail("testCreateGatewayReceiver failed as did not get CommandResult");
     }
+
+    // cannot verify Profile/ServerLocation when manualStart is true
+
     vm3.invoke(() -> verifyReceiverCreationWithAttributes(false, 10000, 11000, "localhost", 100000,
-        512000, null, "localhost"));
+        512000, null, GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
     vm4.invoke(() -> verifyReceiverCreationWithAttributes(false, 10000, 11000, "localhost", 100000,
-        512000, null, "localhost"));
+        512000, null, GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
   }
 
   /**
@@ -469,12 +686,14 @@ public class CreateGatewayReceiverCommandDUnitTest extends WANCommandTestBase {
       fail("testCreateGatewayReceiver failed as did not get CommandResult");
     }
 
+    // cannot verify Profile/ServerLocation when manualStart is true
+
     vm3.invoke(() -> verifyReceiverCreationWithAttributes(false, 10000, 11000, "localhost", 100000,
-        512000, null, "localhost"));
+        512000, null, GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
     vm4.invoke(() -> verifyReceiverCreationWithAttributes(false, 10000, 11000, "localhost", 100000,
-        512000, null, "localhost"));
+        512000, null, GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
     vm5.invoke(() -> verifyReceiverCreationWithAttributes(false, 10000, 11000, "localhost", 100000,
-        512000, null, "localhost"));
+        512000, null, GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
   }
 
   /**
@@ -516,10 +735,13 @@ public class CreateGatewayReceiverCommandDUnitTest extends WANCommandTestBase {
     } else {
       fail("testCreateGatewayReceiver failed as did not get CommandResult");
     }
+
+    // cannot verify Profile/ServerLocation when manualStart is true
+
     vm3.invoke(() -> verifyReceiverCreationWithAttributes(false, 10000, 11000, "localhost", 100000,
-        512000, null, "localhost"));
+        512000, null, GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
     vm4.invoke(() -> verifyReceiverCreationWithAttributes(false, 10000, 11000, "localhost", 100000,
-        512000, null, "localhost"));
+        512000, null, GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
   }
 
   /**
@@ -560,11 +782,14 @@ public class CreateGatewayReceiverCommandDUnitTest extends WANCommandTestBase {
     } else {
       fail("testCreateGatewayReceiver failed as did not get CommandResult");
     }
+
+    // cannot verify Profile/ServerLocation when manualStart is true
+
     vm3.invoke(() -> verifyReceiverCreationWithAttributes(false, 10000, 11000, "localhost", 100000,
-        512000, null, "localhost"));
+        512000, null, GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
     vm4.invoke(() -> verifyReceiverCreationWithAttributes(false, 10000, 11000, "localhost", 100000,
-        512000, null, "localhost"));
+        512000, null, GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
     vm5.invoke(() -> verifyReceiverCreationWithAttributes(false, 10000, 11000, "localhost", 100000,
-        512000, null, "localhost"));
+        512000, null, GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
   }
 }
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WANCommandTestBase.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WANCommandTestBase.java
index eb5da71..f944064 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WANCommandTestBase.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WANCommandTestBase.java
@@ -14,11 +14,13 @@
  */
 package org.apache.geode.internal.cache.wan.wancommand;
 
+import static org.apache.geode.distributed.ConfigurationProperties.BIND_ADDRESS;
 import static org.apache.geode.distributed.ConfigurationProperties.DISTRIBUTED_SYSTEM_ID;
 import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
 import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
 import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
 import static org.apache.geode.distributed.ConfigurationProperties.REMOTE_LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.SERVER_BIND_ADDRESS;
 import static org.apache.geode.distributed.ConfigurationProperties.START_LOCATOR;
 import static org.apache.geode.test.dunit.Assert.assertEquals;
 import static org.apache.geode.test.dunit.Assert.fail;
@@ -60,6 +62,7 @@ import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.LocalRegion;
 import org.apache.geode.internal.cache.wan.AbstractGatewaySender;
 import org.apache.geode.internal.cache.wan.parallel.ParallelGatewaySenderQueue;
+import org.apache.geode.internal.net.SocketCreator;
 import org.apache.geode.management.ManagementService;
 import org.apache.geode.management.internal.cli.commands.CliCommandTestBase;
 import org.apache.geode.test.dunit.Host;
@@ -142,6 +145,38 @@ public abstract class WANCommandTestBase extends CliCommandTestBase {
     cache = CacheFactory.create(ds);
   }
 
+  public void createCacheWithBindAddress(Integer locPort, String bindAddress, String groups) {
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + locPort + "]");
+    props.setProperty(BIND_ADDRESS, bindAddress);
+    props.setProperty(GROUPS, groups);
+    InternalDistributedSystem ds = getSystem(props);
+    cache = CacheFactory.create(ds);
+  }
+
+  public void createCacheWithServerBindAddress(Integer locPort, String bindAddress, String groups) {
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + locPort + "]");
+    props.setProperty(SERVER_BIND_ADDRESS, bindAddress);
+    props.setProperty(GROUPS, groups);
+    InternalDistributedSystem ds = getSystem(props);
+    cache = CacheFactory.create(ds);
+  }
+
+  public void createCacheWithMultipleBindAddressProperties(Integer locPort, String bindAddress,
+      String serverBindAddress, String groups) {
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "localhost[" + locPort + "]");
+    props.setProperty(BIND_ADDRESS, bindAddress);
+    props.setProperty(SERVER_BIND_ADDRESS, serverBindAddress);
+    props.setProperty(GROUPS, groups);
+    InternalDistributedSystem ds = getSystem(props);
+    cache = CacheFactory.create(ds);
+  }
+
   public void createSender(String dsName, int remoteDsId, boolean isParallel, Integer maxMemory,
       Integer batchSize, boolean isConflation, boolean isPersistent, GatewayEventFilter filter,
       boolean isManualStart) {
@@ -416,7 +451,7 @@ public abstract class WANCommandTestBase extends CliCommandTestBase {
     }
   }
 
-  protected void verifyGatewayReceiverServerLocations(int locatorPort, String hostname) {
+  protected void verifyGatewayReceiverServerLocations(int locatorPort, String expected) {
     PoolFactory pf = PoolManager.createFactory();
     pf.setServerGroup(GatewayReceiver.RECEIVER_GROUP);
     pf.addLocator("localhost", locatorPort);
@@ -424,17 +459,17 @@ public abstract class WANCommandTestBase extends CliCommandTestBase {
     ConnectionSource connectionSource = pool.getConnectionSource();
     List<ServerLocation> serverLocations = connectionSource.getAllServers();
     for (ServerLocation serverLocation : serverLocations) {
-      assertEquals(hostname, serverLocation.getHostName());
+      assertEquals(expected, serverLocation.getHostName());
     }
   }
 
-  protected void verifyGatewayReceiverProfile(String hostname) {
+  protected void verifyGatewayReceiverProfile(String expected) {
     Set<GatewayReceiver> receivers = ((Cache) this.cache).getGatewayReceivers();
     for (GatewayReceiver receiver : receivers) {
       CacheServerImpl server = (CacheServerImpl) receiver.getServer();
       CacheServerAdvisor.CacheServerProfile profile =
           (CacheServerAdvisor.CacheServerProfile) server.getProfile();
-      assertEquals(hostname, profile.getHost());
+      assertEquals(expected, profile.getHost());
     }
   }
 
@@ -452,7 +487,7 @@ public abstract class WANCommandTestBase extends CliCommandTestBase {
       assertEquals("maximumTimeBetweenPings", maxTimeBetweenPings,
           receiver.getMaximumTimeBetweenPings());
       assertEquals("socketBufferSize", socketBufferSize, receiver.getSocketBufferSize());
-      assertEquals("hostnameForSenders", hostnameForSenders, receiver.getHost());
+      assertEquals("hostnameForSenders", hostnameForSenders, receiver.getHostnameForSenders());
 
       // verify GatewayTransportFilters
       if (expectedGatewayTransportFilters != null) {

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