geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/CreateGatewayReceiverCommandDUnitTest.java
@Test
  public void testCreateGatewayReceiver_onMember() {
    VM puneLocator = Host.getLocator();
    int dsIdPort = puneLocator.invoke(this::getLocatorPort);
    propsSetUp(dsIdPort);
    vm2.invoke(() -> createFirstRemoteLocator(2, dsIdPort));

    vm3.invoke(() -> createCache(dsIdPort));
    vm4.invoke(() -> createCache(dsIdPort));
    vm5.invoke(() -> createCache(dsIdPort));

    final DistributedMember vm3Member = vm3.invoke(this::getMember);

    String command =
        CliStrings.CREATE_GATEWAYRECEIVER + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART
            + "=true" + " --" + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost"
            + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000" + " --"
            + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000" + " --"
            + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000" + " --"
            + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000" + " --"
            + CliStrings.MEMBER + "=" + vm3Member.getId();
    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(1, status.size());
      // 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");
    }

    // cannot verify Profile/ServerLocation when manualStart is true

    vm3.invoke(() -> verifyReceiverCreationWithAttributes(false, 10000, 11000, "localhost", 100000,
        512000, null, GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
  }
/**
   * GatewayReceiver with given attributes on the given member.
   */
GatewayReceiver with given attributes on the given member.
GatewayReceiver with given attributes on the given member .
@Test
  public void testCreateGatewayReceiver_onMember() {
    VM puneLocator = Host.getLocator();
    int dsIdPort = puneLocator.invoke(this::getLocatorPort);
    propsSetUp(dsIdPort);
    vm2.invoke(() -> createFirstRemoteLocator(2, dsIdPort));
    vm3.invoke(() -> createCache(dsIdPort));
    vm4.invoke(() -> createCache(dsIdPort));
    vm5.invoke(() -> createCache(dsIdPort));
    final DistributedMember vm3Member = vm3.invoke(this::getMember);
    String command =
        CliStrings.CREATE_GATEWAYRECEIVER + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART
            + "=true" + " --" + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost"
            + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000" + " --"
            + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000" + " --"
            + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000" + " --"
            + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000" + " --"
            + CliStrings.MEMBER + "=" + vm3Member.getId();
    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(1, status.size());
      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, GatewayReceiver.DEFAULT_HOSTNAME_FOR_SENDERS));
  }
@ Test public void testCreateGatewayReceiver_onMember ( ) { VM puneLocator = Host . getLocator ( ) ; int dsIdPort = puneLocator . invoke ( this :: getLocatorPort ) ; propsSetUp ( dsIdPort ) ; vm2 . invoke ( ( ) -> createFirstRemoteLocator ( 2 , dsIdPort ) ) ; vm3 . invoke ( ( ) -> createCache ( dsIdPort ) ) ; vm4 . invoke ( ( ) -> createCache ( dsIdPort ) ) ; vm5 . invoke ( ( ) -> createCache ( dsIdPort ) ) ; final DistributedMember vm3Member = vm3 . invoke ( this :: getMember ) ; String command = CliStrings . CREATE_GATEWAYRECEIVER + " --" + CliStrings . CREATE_GATEWAYRECEIVER__MANUALSTART + "=true" + " --" + CliStrings . CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost" + " --" + CliStrings . CREATE_GATEWAYRECEIVER__STARTPORT + "=10000" + " --" + CliStrings . CREATE_GATEWAYRECEIVER__ENDPORT + "=11000" + " --" + CliStrings . CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000" + " --" + CliStrings . CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000" + " --" + CliStrings . MEMBER + "=" + vm3Member . getId ( ) ; 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 ( 1 , status . size ( ) ) ; 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 , GatewayReceiver . DEFAULT_HOSTNAME_FOR_SENDERS ) ) ; }
GatewayReceiver with given attributes on the given member.
GatewayReceiver with given attributes on the given member .
// verify there is no error in the status // cannot verify Profile/ServerLocation when manualStart is true