geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/CreateGatewayReceiverCommandDUnitTest.java
@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 all default attributes and server-bind-address in the gemfire properties
   */
GatewayReceiver with all default attributes and server-bind-address in the gemfire properties
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);
    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));
  }
@ 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 ) ; 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
GatewayReceiver with all default attributes and server - bind - address in the gemfire properties
// verify server-bind-address used if provided as a gemfire property