geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StopGatewayReceiverCommandDUnitTest.java
@Test
  public void testStopGatewayReceiver_MultipleGroup() {
    VM puneLocator = Host.getLocator();
    int dsIdPort = puneLocator.invoke(this::getLocatorPort);
    propsSetUp(dsIdPort);

    vm2.invoke(() -> createFirstRemoteLocator(2, dsIdPort));
    vm3.invoke(() -> createAndStartReceiverWithGroup(dsIdPort, "RG1"));
    vm4.invoke(() -> createAndStartReceiverWithGroup(dsIdPort, "RG1"));
    vm5.invoke(() -> createAndStartReceiverWithGroup(dsIdPort, "RG1"));
    vm6.invoke(() -> createAndStartReceiverWithGroup(dsIdPort, "RG1, RG2"));
    vm7.invoke(() -> createAndStartReceiverWithGroup(dsIdPort, "RG3"));
    vm3.invoke(() -> verifyReceiverState(true));
    vm4.invoke(() -> verifyReceiverState(true));
    vm5.invoke(() -> verifyReceiverState(true));
    vm6.invoke(() -> verifyReceiverState(true));
    vm7.invoke(() -> verifyReceiverState(true));

    pause(10000);
    String command = CliStrings.STOP_GATEWAYRECEIVER + " --" + CliStrings.GROUP + "=RG1,RG2";
    CommandResult cmdResult = executeCommand(command);
    if (cmdResult != null) {
      String strCmdResult = commandResultToString(cmdResult);
      getLogWriter().info("testStopGatewayReceiver_Group stringResult : " + strCmdResult + ">>>>");
      assertEquals(Result.Status.OK, cmdResult.getStatus());
      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
      List<String> status = resultData.retrieveAllValues("Result");
      assertEquals(4, status.size());
      assertFalse(status.contains("Error"));
      assertTrue(status.contains("OK"));
    } else {
      fail("testStopGatewayReceiver failed as did not get CommandResult");
    }
    vm3.invoke(() -> verifyReceiverState(false));
    vm4.invoke(() -> verifyReceiverState(false));
    vm5.invoke(() -> verifyReceiverState(false));
    vm6.invoke(() -> verifyReceiverState(false));
    vm7.invoke(() -> verifyReceiverState(true));
  }
/**
   * Test to validate the scenario gateway sender is started when one or more sender members belongs
   * to multiple groups
   * 
   */
Test to validate the scenario gateway sender is started when one or more sender members belongs
to multiple groups
Test to validate the scenario gateway sender is started when one or more sender members belongs to multiple groups
@Test
  public void testStopGatewayReceiver_MultipleGroup() {
    VM puneLocator = Host.getLocator();
    int dsIdPort = puneLocator.invoke(this::getLocatorPort);
    propsSetUp(dsIdPort);
    vm2.invoke(() -> createFirstRemoteLocator(2, dsIdPort));
    vm3.invoke(() -> createAndStartReceiverWithGroup(dsIdPort, "RG1"));
    vm4.invoke(() -> createAndStartReceiverWithGroup(dsIdPort, "RG1"));
    vm5.invoke(() -> createAndStartReceiverWithGroup(dsIdPort, "RG1"));
    vm6.invoke(() -> createAndStartReceiverWithGroup(dsIdPort, "RG1, RG2"));
    vm7.invoke(() -> createAndStartReceiverWithGroup(dsIdPort, "RG3"));
    vm3.invoke(() -> verifyReceiverState(true));
    vm4.invoke(() -> verifyReceiverState(true));
    vm5.invoke(() -> verifyReceiverState(true));
    vm6.invoke(() -> verifyReceiverState(true));
    vm7.invoke(() -> verifyReceiverState(true));
    pause(10000);
    String command = CliStrings.STOP_GATEWAYRECEIVER + " --" + CliStrings.GROUP + "=RG1,RG2";
    CommandResult cmdResult = executeCommand(command);
    if (cmdResult != null) {
      String strCmdResult = commandResultToString(cmdResult);
      getLogWriter().info("testStopGatewayReceiver_Group stringResult : " + strCmdResult + ">>>>");
      assertEquals(Result.Status.OK, cmdResult.getStatus());
      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
      List<String> status = resultData.retrieveAllValues("Result");
      assertEquals(4, status.size());
      assertFalse(status.contains("Error"));
      assertTrue(status.contains("OK"));
    } else {
      fail("testStopGatewayReceiver failed as did not get CommandResult");
    }
    vm3.invoke(() -> verifyReceiverState(false));
    vm4.invoke(() -> verifyReceiverState(false));
    vm5.invoke(() -> verifyReceiverState(false));
    vm6.invoke(() -> verifyReceiverState(false));
    vm7.invoke(() -> verifyReceiverState(true));
  }
@ Test public void testStopGatewayReceiver_MultipleGroup ( ) { VM puneLocator = Host . getLocator ( ) ; int dsIdPort = puneLocator . invoke ( this :: getLocatorPort ) ; propsSetUp ( dsIdPort ) ; vm2 . invoke ( ( ) -> createFirstRemoteLocator ( 2 , dsIdPort ) ) ; vm3 . invoke ( ( ) -> createAndStartReceiverWithGroup ( dsIdPort , "RG1" ) ) ; vm4 . invoke ( ( ) -> createAndStartReceiverWithGroup ( dsIdPort , "RG1" ) ) ; vm5 . invoke ( ( ) -> createAndStartReceiverWithGroup ( dsIdPort , "RG1" ) ) ; vm6 . invoke ( ( ) -> createAndStartReceiverWithGroup ( dsIdPort , "RG1, RG2" ) ) ; vm7 . invoke ( ( ) -> createAndStartReceiverWithGroup ( dsIdPort , "RG3" ) ) ; vm3 . invoke ( ( ) -> verifyReceiverState ( true ) ) ; vm4 . invoke ( ( ) -> verifyReceiverState ( true ) ) ; vm5 . invoke ( ( ) -> verifyReceiverState ( true ) ) ; vm6 . invoke ( ( ) -> verifyReceiverState ( true ) ) ; vm7 . invoke ( ( ) -> verifyReceiverState ( true ) ) ; pause ( 10000 ) ; String command = CliStrings . STOP_GATEWAYRECEIVER + " --" + CliStrings . GROUP + "=RG1,RG2" ; CommandResult cmdResult = executeCommand ( command ) ; if ( cmdResult != null ) { String strCmdResult = commandResultToString ( cmdResult ) ; getLogWriter ( ) . info ( "testStopGatewayReceiver_Group stringResult : " + strCmdResult + ">>>>" ) ; assertEquals ( Result . Status . OK , cmdResult . getStatus ( ) ) ; TabularResultData resultData = ( TabularResultData ) cmdResult . getResultData ( ) ; List < String > status = resultData . retrieveAllValues ( "Result" ) ; assertEquals ( 4 , status . size ( ) ) ; assertFalse ( status . contains ( "Error" ) ) ; assertTrue ( status . contains ( "OK" ) ) ; } else { fail ( "testStopGatewayReceiver failed as did not get CommandResult" ) ; } vm3 . invoke ( ( ) -> verifyReceiverState ( false ) ) ; vm4 . invoke ( ( ) -> verifyReceiverState ( false ) ) ; vm5 . invoke ( ( ) -> verifyReceiverState ( false ) ) ; vm6 . invoke ( ( ) -> verifyReceiverState ( false ) ) ; vm7 . invoke ( ( ) -> verifyReceiverState ( true ) ) ; }
Test to validate the scenario gateway sender is started when one or more sender members belongs
 to multiple groups
Test to validate the scenario gateway sender is started when one or more sender members belongs to multiple groups