You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2017/08/01 21:03:18 UTC

[24/50] [abbrv] geode git commit: GEODE-3271: Separating WanCommands into multiple command classes

http://git-wip-us.apache.org/repos/asf/geode/blob/e1befef4/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/ResumeGatewaySenderCommandDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/ResumeGatewaySenderCommandDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/ResumeGatewaySenderCommandDUnitTest.java
new file mode 100644
index 0000000..61d512f
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/ResumeGatewaySenderCommandDUnitTest.java
@@ -0,0 +1,263 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.geode.internal.cache.wan.wancommand;
+
+import static org.apache.geode.test.dunit.LogWriterUtils.getLogWriter;
+import static org.apache.geode.test.dunit.Wait.pause;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.CommandResult;
+import org.apache.geode.management.internal.cli.result.TabularResultData;
+import org.apache.geode.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class ResumeGatewaySenderCommandDUnitTest extends WANCommandTestBase {
+  @Test
+  public void testResumeGatewaySender_ErrorConditions() {
+    Integer punePort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(punePort);
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+
+    vm3.invoke(() -> createCache(punePort));
+    vm3.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+
+    final DistributedMember vm1Member = vm3.invoke(this::getMember);
+    String command = CliStrings.RESUME_GATEWAYSENDER + " --" + CliStrings.RESUME_GATEWAYSENDER__ID
+        + "=ln --" + CliStrings.MEMBER + "=" + vm1Member.getId() + " --" + CliStrings.GROUP
+        + "=SenderGroup1";
+    CommandResult cmdResult = executeCommand(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter()
+          .info("testResumeGatewaySender_ErrorConditions stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
+    } else {
+      fail("testPauseGatewaySender failed as did not get CommandResult");
+    }
+  }
+
+  @Test
+  public void testResumeGatewaySender() {
+    Integer punePort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(punePort);
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+
+    vm3.invoke(() -> createCache(punePort));
+    vm3.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm4.invoke(() -> createCache(punePort));
+    vm4.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm5.invoke(() -> createCache(punePort));
+    vm5.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm3.invoke(() -> startSender("ln"));
+    vm4.invoke(() -> startSender("ln"));
+    vm5.invoke(() -> startSender("ln"));
+    vm3.invoke(() -> verifySenderState("ln", true, false));
+    vm4.invoke(() -> verifySenderState("ln", true, false));
+    vm5.invoke(() -> verifySenderState("ln", true, false));
+    vm3.invoke(() -> pauseSender("ln"));
+    vm4.invoke(() -> pauseSender("ln"));
+    vm5.invoke(() -> pauseSender("ln"));
+    vm3.invoke(() -> verifySenderState("ln", true, true));
+    vm4.invoke(() -> verifySenderState("ln", true, true));
+    vm5.invoke(() -> verifySenderState("ln", true, true));
+
+    pause(10000);
+    String command =
+        CliStrings.RESUME_GATEWAYSENDER + " --" + CliStrings.RESUME_GATEWAYSENDER__ID + "=ln";
+    CommandResult cmdResult = executeCommand(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testResumeGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(5, status.size());
+      assertTrue(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testResumeGatewaySender failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> verifySenderState("ln", true, false));
+    vm4.invoke(() -> verifySenderState("ln", true, false));
+    vm5.invoke(() -> verifySenderState("ln", true, false));
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on a member
+   */
+  @Test
+  public void testResumeGatewaySender_onMember() {
+    Integer punePort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(punePort);
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+
+    vm3.invoke(() -> createCache(punePort));
+    vm3.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm3.invoke(() -> startSender("ln"));
+    vm3.invoke(() -> verifySenderState("ln", true, false));
+    vm3.invoke(() -> pauseSender("ln"));
+    vm3.invoke(() -> verifySenderState("ln", true, true));
+
+    final DistributedMember vm1Member = vm3.invoke(this::getMember);
+    pause(10000);
+    String command = CliStrings.RESUME_GATEWAYSENDER + " --" + CliStrings.RESUME_GATEWAYSENDER__ID
+        + "=ln --" + CliStrings.MEMBER + "=" + vm1Member.getId();
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testResumeGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains("is resumed on member"));
+    } else {
+      fail("testResumeGatewaySender failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> verifySenderState("ln", true, false));
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on a group of members
+   */
+  @Test
+  public void testResumeGatewaySender_Group() {
+    Integer punePort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(punePort);
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+
+    vm3.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1"));
+    vm3.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm4.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1"));
+    vm4.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm5.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1"));
+    vm5.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+
+    vm3.invoke(() -> startSender("ln"));
+    vm4.invoke(() -> startSender("ln"));
+    vm5.invoke(() -> startSender("ln"));
+
+    vm3.invoke(() -> verifySenderState("ln", true, false));
+    vm4.invoke(() -> verifySenderState("ln", true, false));
+    vm5.invoke(() -> verifySenderState("ln", true, false));
+
+    vm3.invoke(() -> pauseSender("ln"));
+    vm4.invoke(() -> pauseSender("ln"));
+    vm5.invoke(() -> pauseSender("ln"));
+
+    vm3.invoke(() -> verifySenderState("ln", true, true));
+    vm4.invoke(() -> verifySenderState("ln", true, true));
+    vm5.invoke(() -> verifySenderState("ln", true, true));
+
+    pause(10000);
+    String command = CliStrings.RESUME_GATEWAYSENDER + " --" + CliStrings.RESUME_GATEWAYSENDER__ID
+        + "=ln --" + CliStrings.GROUP + "=SenderGroup1";
+    CommandResult cmdResult = executeCommand(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testResumeGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(3, status.size());
+      assertFalse(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testResumeGatewaySender failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> verifySenderState("ln", true, false));
+    vm4.invoke(() -> verifySenderState("ln", true, false));
+    vm5.invoke(() -> verifySenderState("ln", true, false));
+  }
+
+  /**
+   * Test to validate the scenario gateway sender is started when one or more sender members belongs
+   * to multiple groups
+   */
+  @Test
+  public void testResumeGatewaySender_MultipleGroup() {
+    Integer punePort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(punePort);
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+
+    vm3.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1"));
+    vm3.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm4.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1"));
+    vm4.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm5.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1, SenderGroup2"));
+    vm5.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm6.invoke(() -> createCacheWithGroups(punePort, "SenderGroup2"));
+    vm6.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm7.invoke(() -> createCacheWithGroups(punePort, "SenderGroup3"));
+    vm7.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm3.invoke(() -> startSender("ln"));
+    vm4.invoke(() -> startSender("ln"));
+    vm5.invoke(() -> startSender("ln"));
+    vm6.invoke(() -> startSender("ln"));
+    vm7.invoke(() -> startSender("ln"));
+    vm3.invoke(() -> verifySenderState("ln", true, false));
+    vm4.invoke(() -> verifySenderState("ln", true, false));
+    vm5.invoke(() -> verifySenderState("ln", true, false));
+    vm6.invoke(() -> verifySenderState("ln", true, false));
+    vm7.invoke(() -> verifySenderState("ln", true, false));
+    vm3.invoke(() -> pauseSender("ln"));
+    vm4.invoke(() -> pauseSender("ln"));
+    vm5.invoke(() -> pauseSender("ln"));
+    vm6.invoke(() -> pauseSender("ln"));
+    vm7.invoke(() -> pauseSender("ln"));
+    vm3.invoke(() -> verifySenderState("ln", true, true));
+    vm4.invoke(() -> verifySenderState("ln", true, true));
+    vm5.invoke(() -> verifySenderState("ln", true, true));
+    vm6.invoke(() -> verifySenderState("ln", true, true));
+    vm7.invoke(() -> verifySenderState("ln", true, true));
+
+    pause(10000);
+    String command = CliStrings.RESUME_GATEWAYSENDER + " --" + CliStrings.RESUME_GATEWAYSENDER__ID
+        + "=ln --" + CliStrings.GROUP + "=SenderGroup1,SenderGroup2";
+    CommandResult cmdResult = executeCommand(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testResumeGatewaySender 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("testResumeGatewaySender failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> verifySenderState("ln", true, false));
+    vm4.invoke(() -> verifySenderState("ln", true, false));
+    vm5.invoke(() -> verifySenderState("ln", true, false));
+    vm6.invoke(() -> verifySenderState("ln", true, false));
+    vm7.invoke(() -> verifySenderState("ln", true, true));
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/e1befef4/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StartGatewayReceiverCommandDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StartGatewayReceiverCommandDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StartGatewayReceiverCommandDUnitTest.java
new file mode 100644
index 0000000..e84b8e3
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StartGatewayReceiverCommandDUnitTest.java
@@ -0,0 +1,224 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.wan.wancommand;
+
+import static org.apache.geode.test.dunit.Assert.assertEquals;
+import static org.apache.geode.test.dunit.Assert.assertFalse;
+import static org.apache.geode.test.dunit.Assert.assertTrue;
+import static org.apache.geode.test.dunit.Assert.fail;
+import static org.apache.geode.test.dunit.LogWriterUtils.getLogWriter;
+import static org.apache.geode.test.dunit.Wait.pause;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.CommandResult;
+import org.apache.geode.management.internal.cli.result.TabularResultData;
+import org.apache.geode.test.dunit.Host;
+import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.geode.test.junit.categories.FlakyTest;
+
+@Category(DistributedTest.class)
+public class StartGatewayReceiverCommandDUnitTest extends WANCommandTestBase {
+  /**
+   * Test wan commands for error in input 1> start gateway-sender command needs only one of member
+   * or group.
+   */
+  @Test
+  public void testStartGatewayReceiver_ErrorConditions() {
+    VM puneLocator = Host.getLocator();
+    int punePort = puneLocator.invoke(this::getLocatorPort);
+    propsSetUp(punePort);
+
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+    vm3.invoke(() -> createReceiver(punePort));
+
+    final DistributedMember vm1Member = vm3.invoke(this::getMember);
+    String command = CliStrings.START_GATEWAYRECEIVER + " --" + CliStrings.MEMBER + "="
+        + vm1Member.getId() + " --" + CliStrings.GROUP + "=RG1";
+    CommandResult cmdResult = executeCommand(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter()
+          .info("testStartGatewayReceiver_ErrorConditions stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
+    } else {
+      fail("testStartGatewayReceiver_ErrorConditions failed as did not get CommandResult");
+    }
+  }
+
+  @Category(FlakyTest.class) // GEODE-1448
+  @Test
+  public void testStartGatewayReceiver() {
+    VM puneLocator = Host.getLocator();
+    int punePort = puneLocator.invoke(this::getLocatorPort);
+    propsSetUp(punePort);
+
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+    vm3.invoke(() -> createReceiver(punePort));
+    vm4.invoke(() -> createReceiver(punePort));
+    vm5.invoke(() -> createReceiver(punePort));
+    vm3.invoke(() -> verifyReceiverState(false));
+    vm4.invoke(() -> verifyReceiverState(false));
+    vm5.invoke(() -> verifyReceiverState(false));
+
+    pause(10000);
+    String command = CliStrings.START_GATEWAYRECEIVER;
+    CommandResult cmdResult = executeCommand(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testStartGatewayReceiver stringResult : " + strCmdResult + ">>>>");
+      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(4, status.size());
+      assertTrue(status.contains("Error"));
+    } else {
+      fail("testStartGatewayReceiver failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> verifyReceiverState(true));
+    vm4.invoke(() -> verifyReceiverState(true));
+    vm5.invoke(() -> verifyReceiverState(true));
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on a member
+   */
+  @Test
+  public void testStartGatewayReceiver_onMember() {
+    VM puneLocator = Host.getLocator();
+    int punePort = puneLocator.invoke(this::getLocatorPort);
+    propsSetUp(punePort);
+
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+    vm3.invoke(() -> createReceiver(punePort));
+    vm4.invoke(() -> createReceiver(punePort));
+    vm5.invoke(() -> createReceiver(punePort));
+    vm3.invoke(() -> verifyReceiverState(false));
+    vm4.invoke(() -> verifyReceiverState(false));
+    vm5.invoke(() -> verifyReceiverState(false));
+
+    final DistributedMember vm1Member = vm3.invoke(() -> getMember());
+    pause(10000);
+    String command =
+        CliStrings.START_GATEWAYRECEIVER + " --" + CliStrings.MEMBER + "=" + vm1Member.getId();
+    CommandResult cmdResult = executeCommand(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter()
+          .info("testStartGatewayReceiver_onMember stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains("is started on member"));
+    } else {
+      fail("testStartGatewayReceiver failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> verifyReceiverState(true));
+    vm4.invoke(() -> verifyReceiverState(false));
+    vm5.invoke(() -> verifyReceiverState(false));
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on a group of members
+   */
+  @Test
+  public void testStartGatewayReceiver_Group() {
+    VM puneLocator = Host.getLocator();
+    int punePort = puneLocator.invoke(this::getLocatorPort);
+    propsSetUp(punePort);
+
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+    vm3.invoke(() -> createReceiverWithGroup(punePort, "RG1"));
+    vm4.invoke(() -> createReceiverWithGroup(punePort, "RG1"));
+    vm5.invoke(() -> createReceiverWithGroup(punePort, "RG1"));
+    vm3.invoke(() -> verifyReceiverState(false));
+    vm4.invoke(() -> verifyReceiverState(false));
+    vm5.invoke(() -> verifyReceiverState(false));
+
+    pause(10000);
+    String command = CliStrings.START_GATEWAYRECEIVER + " --" + CliStrings.GROUP + "=RG1";
+    CommandResult cmdResult = executeCommand(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testStartGatewayReceiver_Group stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(3, status.size());
+      assertFalse(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testStartGatewayReceiver_Group failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> verifyReceiverState(true));
+    vm4.invoke(() -> verifyReceiverState(true));
+    vm5.invoke(() -> verifyReceiverState(true));
+  }
+
+  /**
+   * Test to validate the scenario gateway sender is started when one or more sender members belongs
+   * to multiple groups
+   * 
+   */
+  @Test
+  public void testStartGatewayReceiver_MultipleGroup() {
+    VM puneLocator = Host.getLocator();
+    int punePort = puneLocator.invoke(this::getLocatorPort);
+    propsSetUp(punePort);
+
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+    vm3.invoke(() -> createReceiverWithGroup(punePort, "RG1"));
+    vm4.invoke(() -> createReceiverWithGroup(punePort, "RG1"));
+    vm5.invoke(() -> createReceiverWithGroup(punePort, "RG1, RG2"));
+    vm6.invoke(() -> createReceiverWithGroup(punePort, "RG1, RG2"));
+    vm7.invoke(() -> createReceiverWithGroup(punePort, "RG3"));
+    vm3.invoke(() -> verifyReceiverState(false));
+    vm4.invoke(() -> verifyReceiverState(false));
+    vm5.invoke(() -> verifyReceiverState(false));
+    vm6.invoke(() -> verifyReceiverState(false));
+    vm7.invoke(() -> verifyReceiverState(false));
+
+    pause(10000);
+    String command = CliStrings.START_GATEWAYRECEIVER + " --" + CliStrings.GROUP + "=RG1,RG2";
+    CommandResult cmdResult = executeCommand(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testStartGatewayReceiver_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("testStartGatewayReceiver failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> verifyReceiverState(true));
+    vm4.invoke(() -> verifyReceiverState(true));
+    vm5.invoke(() -> verifyReceiverState(true));
+    vm6.invoke(() -> verifyReceiverState(true));
+    vm7.invoke(() -> verifyReceiverState(false));
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/e1befef4/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StartGatewaySenderCommandDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StartGatewaySenderCommandDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StartGatewaySenderCommandDUnitTest.java
new file mode 100644
index 0000000..57b3072
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StartGatewaySenderCommandDUnitTest.java
@@ -0,0 +1,275 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.wan.wancommand;
+
+import static org.apache.geode.test.dunit.Assert.assertEquals;
+import static org.apache.geode.test.dunit.Assert.assertFalse;
+import static org.apache.geode.test.dunit.Assert.assertTrue;
+import static org.apache.geode.test.dunit.Assert.fail;
+import static org.apache.geode.test.dunit.LogWriterUtils.getLogWriter;
+import static org.apache.geode.test.dunit.Wait.pause;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.CommandResult;
+import org.apache.geode.management.internal.cli.result.TabularResultData;
+import org.apache.geode.test.dunit.IgnoredException;
+import org.apache.geode.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class StartGatewaySenderCommandDUnitTest extends WANCommandTestBase {
+  /**
+   * Test wan commands for error in input 1> start gateway-sender command needs only one of member
+   * or group.
+   */
+  @Test
+  public void testStartGatewaySender_ErrorConditions() {
+    Integer punePort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(punePort);
+
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+    vm3.invoke(() -> createCache(punePort));
+    vm3.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+
+    final DistributedMember vm1Member = vm3.invoke(this::getMember);
+    String command = CliStrings.START_GATEWAYSENDER + " --" + CliStrings.START_GATEWAYSENDER__ID
+        + "=ln --" + CliStrings.MEMBER + "=" + vm1Member.getId() + " --" + CliStrings.GROUP
+        + "=SenserGroup1";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testStartGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
+    } else {
+      fail("testStartGatewaySender failed as did not get CommandResult");
+    }
+  }
+
+  @Test
+  public void testStartGatewaySender() {
+    Integer punePort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(punePort);
+
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+    vm3.invoke(() -> createCache(punePort));
+    vm3.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm4.invoke(() -> createCache(punePort));
+    vm4.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm5.invoke(() -> createCache(punePort));
+    vm5.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm3.invoke(() -> verifySenderState("ln", false, false));
+    vm4.invoke(() -> verifySenderState("ln", false, false));
+    vm5.invoke(() -> verifySenderState("ln", false, false));
+
+    pause(10000);
+    String command =
+        CliStrings.START_GATEWAYSENDER + " --" + CliStrings.START_GATEWAYSENDER__ID + "=ln";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testStartGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(5, status.size());
+      assertTrue(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testStartGatewaySender failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> verifySenderState("ln", true, false));
+    vm4.invoke(() -> verifySenderState("ln", true, false));
+    vm5.invoke(() -> verifySenderState("ln", true, false));
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on a member
+   */
+  @Test
+  public void testStartGatewaySender_onMember() {
+    Integer punePort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(punePort);
+
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+    vm3.invoke(() -> createCache(punePort));
+    vm3.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm3.invoke(() -> verifySenderState("ln", false, false));
+
+    final DistributedMember vm1Member = vm3.invoke(this::getMember);
+    pause(10000);
+    String command = CliStrings.START_GATEWAYSENDER + " --" + CliStrings.START_GATEWAYSENDER__ID
+        + "=ln --" + CliStrings.MEMBER + "=" + vm1Member.getId();
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testStartGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains("is started on member"));
+    } else {
+      fail("testStartGatewaySender failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> verifySenderState("ln", true, false));
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on a group of members
+   */
+  @Test
+  public void testStartGatewaySender_Group() {
+    Integer punePort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(punePort);
+
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+    vm3.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1"));
+    vm3.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm4.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1"));
+    vm4.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm5.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1"));
+    vm5.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm3.invoke(() -> verifySenderState("ln", false, false));
+    vm4.invoke(() -> verifySenderState("ln", false, false));
+    vm5.invoke(() -> verifySenderState("ln", false, false));
+
+    pause(10000);
+    String command = CliStrings.START_GATEWAYSENDER + " --" + CliStrings.START_GATEWAYSENDER__ID
+        + "=ln --" + CliStrings.GROUP + "=SenderGroup1";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testStartGatewaySender_Group stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(3, status.size());
+      assertFalse(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testStartGatewaySender failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> verifySenderState("ln", true, false));
+    vm4.invoke(() -> verifySenderState("ln", true, false));
+    vm5.invoke(() -> verifySenderState("ln", true, false));
+  }
+
+  /**
+   * Test to validate the scenario gateway sender is started when one or more sender members belongs
+   * to multiple groups
+   */
+  @Test
+  public void testStartGatewaySender_MultipleGroup() {
+    Integer punePort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(punePort);
+
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+    vm3.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1"));
+    vm3.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm4.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1"));
+    vm4.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm5.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1, SenderGroup2"));
+    vm5.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm6.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1, SenderGroup2"));
+    vm6.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm7.invoke(() -> createCacheWithGroups(punePort, "SenderGroup3"));
+    vm7.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm3.invoke(() -> verifySenderState("ln", false, false));
+    vm4.invoke(() -> verifySenderState("ln", false, false));
+    vm5.invoke(() -> verifySenderState("ln", false, false));
+    vm6.invoke(() -> verifySenderState("ln", false, false));
+    vm7.invoke(() -> verifySenderState("ln", false, false));
+
+    pause(10000);
+    String command = CliStrings.START_GATEWAYSENDER + " --" + CliStrings.START_GATEWAYSENDER__ID
+        + "=ln --" + CliStrings.GROUP + "=SenderGroup1,SenderGroup2";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testStartGatewaySender_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("testStartGatewaySender failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> verifySenderState("ln", true, false));
+    vm4.invoke(() -> verifySenderState("ln", true, false));
+    vm5.invoke(() -> verifySenderState("ln", true, false));
+    vm6.invoke(() -> verifySenderState("ln", true, false));
+    vm7.invoke(() -> verifySenderState("ln", false, false));
+  }
+
+  /**
+   * Test to validate the test scenario when one of the member ion group does not have the sender.
+   */
+  @Test
+  public void testStartGatewaySender_Group_MissingSenderFromGroup() {
+    Integer punePort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(punePort);
+
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+    vm3.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1"));
+    vm3.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm4.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1"));
+    vm5.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1"));
+    vm5.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm3.invoke(() -> verifySenderState("ln", false, false));
+    vm5.invoke(() -> verifySenderState("ln", false, false));
+
+    pause(10000);
+    String command = CliStrings.START_GATEWAYSENDER + " --" + CliStrings.START_GATEWAYSENDER__ID
+        + "=ln --" + CliStrings.GROUP + "=SenderGroup1";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      assertTrue(strCmdResult.contains("Error"));
+      assertTrue(strCmdResult.contains("is not available"));
+      getLogWriter().info("testStartGatewaySender_Group stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(3, status.size());
+      assertTrue(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testStartGatewaySender failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> verifySenderState("ln", true, false));
+    vm5.invoke(() -> verifySenderState("ln", true, false));
+  }
+
+  private CommandResult executeCommandWithIgnoredExceptions(String command) {
+    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
+    try {
+      return executeCommand(command);
+    } finally {
+      exln.remove();
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/e1befef4/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StatusGatewayReceiverCommandDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StatusGatewayReceiverCommandDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StatusGatewayReceiverCommandDUnitTest.java
new file mode 100644
index 0000000..32206c5
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StatusGatewayReceiverCommandDUnitTest.java
@@ -0,0 +1,206 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.geode.internal.cache.wan.wancommand;
+
+import static org.apache.geode.test.dunit.LogWriterUtils.getLogWriter;
+import static org.apache.geode.test.dunit.Wait.pause;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.CommandResult;
+import org.apache.geode.management.internal.cli.result.CompositeResultData;
+import org.apache.geode.management.internal.cli.result.TabularResultData;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.geode.test.junit.categories.FlakyTest;
+
+@Category(DistributedTest.class)
+public class StatusGatewayReceiverCommandDUnitTest extends WANCommandTestBase {
+  @Test
+  public void testGatewayReceiverStatus() {
+    Integer lnPort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(lnPort);
+    Integer nyPort = vm2.invoke(() -> createFirstRemoteLocator(2, lnPort));
+
+    vm6.invoke(() -> createAndStartReceiver(nyPort));
+    vm3.invoke(() -> createAndStartReceiver(lnPort));
+    vm4.invoke(() -> createAndStartReceiver(lnPort));
+    vm5.invoke(() -> createAndStartReceiver(lnPort));
+
+    pause(10000);
+    String command = CliStrings.STATUS_GATEWAYRECEIVER;
+    CommandResult cmdResult = executeCommand(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testGatewayReceiverStatus : " + strCmdResult + ">>>>> ");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      TabularResultData tableResultData = ((CompositeResultData) cmdResult.getResultData())
+          .retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_AVAILABLE)
+          .retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(3, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_NOT_RUNNING));
+      tableResultData = ((CompositeResultData) cmdResult.getResultData())
+          .retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_NOT_AVAILABLE)
+          .retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      List<String> result_hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
+      assertEquals(2, result_hosts.size());
+    } else {
+      fail("testGatewayReceiverStatus failed as did not get CommandResult");
+    }
+    vm3.invoke(this::stopReceiver);
+    vm4.invoke(this::stopReceiver);
+    vm5.invoke(this::stopReceiver);
+    pause(10000);
+    command = CliStrings.STATUS_GATEWAYRECEIVER;
+    cmdResult = executeCommand(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testGatewayReceiverStatus : " + strCmdResult + ">>>>> ");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+
+      TabularResultData tableResultData = ((CompositeResultData) cmdResult.getResultData())
+          .retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_AVAILABLE)
+          .retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(3, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_RUNNING));
+      tableResultData = ((CompositeResultData) cmdResult.getResultData())
+          .retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_NOT_AVAILABLE)
+          .retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      List<String> result_hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
+      assertEquals(2, result_hosts.size());
+    } else {
+      fail("testGatewayReceiverStatus failed as did not get CommandResult");
+    }
+  }
+
+  @Category(FlakyTest.class) // GEODE-1395
+  @Test
+  public void testGatewayReceiverStatus_OnMember() {
+    Integer lnPort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(lnPort);
+    Integer nyPort = vm2.invoke(() -> createFirstRemoteLocator(2, lnPort));
+
+    vm6.invoke(() -> createAndStartReceiver(nyPort));
+    vm3.invoke(() -> createAndStartReceiver(lnPort));
+    vm4.invoke(() -> createAndStartReceiver(lnPort));
+    vm5.invoke(() -> createAndStartReceiver(lnPort));
+
+    final DistributedMember vm3Member = vm3.invoke(this::getMember);
+    pause(10000);
+    String command =
+        CliStrings.STATUS_GATEWAYRECEIVER + " --" + CliStrings.MEMBER + "=" + vm3Member.getId();
+    CommandResult cmdResult = executeCommand(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testGatewayReceiverStatus : " + strCmdResult + ">>>>> ");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      TabularResultData tableResultData = ((CompositeResultData) cmdResult.getResultData())
+          .retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_AVAILABLE)
+          .retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(1, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_NOT_RUNNING));
+    } else {
+      fail("testGatewayReceiverStatus failed as did not get CommandResult");
+    }
+    vm3.invoke(this::stopReceiver);
+    vm4.invoke(this::stopReceiver);
+    vm5.invoke(this::stopReceiver);
+
+    pause(10000);
+    command =
+        CliStrings.STATUS_GATEWAYRECEIVER + " --" + CliStrings.MEMBER + "=" + vm3Member.getId();
+    cmdResult = executeCommand(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testGatewayReceiverStatus : " + strCmdResult + ">>>>> ");
+      TabularResultData tableResultData = ((CompositeResultData) cmdResult.getResultData())
+          .retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_AVAILABLE)
+          .retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(1, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_RUNNING));
+    } else {
+      fail("testGatewayReceiverStatus failed as did not get CommandResult");
+    }
+  }
+
+  @Test
+  public void testGatewayReceiverStatus_OnGroups() {
+    Integer lnPort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(lnPort);
+    Integer nyPort = vm2.invoke(() -> createFirstRemoteLocator(2, lnPort));
+
+    vm7.invoke(() -> createAndStartReceiver(nyPort));
+    vm3.invoke(() -> createAndStartReceiverWithGroup(lnPort, "RG1, RG2"));
+    vm4.invoke(() -> createAndStartReceiverWithGroup(lnPort, "RG1, RG2"));
+    vm5.invoke(() -> createAndStartReceiverWithGroup(lnPort, "RG1"));
+    vm6.invoke(() -> createAndStartReceiverWithGroup(lnPort, "RG2"));
+
+    pause(10000);
+    String command = CliStrings.STATUS_GATEWAYRECEIVER + " --" + CliStrings.GROUP + "=RG1";
+    CommandResult cmdResult = executeCommand(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testGatewayReceiverStatus : " + strCmdResult + ">>>>> ");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      TabularResultData tableResultData = ((CompositeResultData) cmdResult.getResultData())
+          .retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_AVAILABLE)
+          .retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(3, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_NOT_RUNNING));
+    } else {
+      fail("testGatewayReceiverStatus failed as did not get CommandResult");
+    }
+    vm3.invoke(this::stopReceiver);
+    vm4.invoke(this::stopReceiver);
+    vm5.invoke(this::stopReceiver);
+
+    pause(10000);
+    command = CliStrings.STATUS_GATEWAYRECEIVER + " --" + CliStrings.GROUP + "=RG1";
+    cmdResult = executeCommand(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testGatewayReceiverStatus_OnGroups : " + strCmdResult + ">>>>> ");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      TabularResultData tableResultData = ((CompositeResultData) cmdResult.getResultData())
+          .retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER_AVAILABLE)
+          .retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(3, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_RUNNING));
+    } else {
+      fail("testGatewayReceiverStatus failed as did not get CommandResult");
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/e1befef4/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StatusGatewaySenderCommandDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StatusGatewaySenderCommandDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StatusGatewaySenderCommandDUnitTest.java
new file mode 100644
index 0000000..064bfe7
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StatusGatewaySenderCommandDUnitTest.java
@@ -0,0 +1,251 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.wan.wancommand;
+
+import static org.apache.geode.test.dunit.Assert.assertEquals;
+import static org.apache.geode.test.dunit.Assert.assertFalse;
+import static org.apache.geode.test.dunit.Assert.fail;
+import static org.apache.geode.test.dunit.LogWriterUtils.getLogWriter;
+import static org.apache.geode.test.dunit.Wait.pause;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.CommandResult;
+import org.apache.geode.management.internal.cli.result.CompositeResultData;
+import org.apache.geode.management.internal.cli.result.TabularResultData;
+import org.apache.geode.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class StatusGatewaySenderCommandDUnitTest extends WANCommandTestBase {
+  @Test
+  public void testGatewaySenderStatus() {
+    Integer lnPort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(lnPort);
+    Integer nyPort = vm2.invoke(() -> createFirstRemoteLocator(2, lnPort));
+
+    vm6.invoke(() -> createAndStartReceiver(nyPort));
+    vm3.invoke(() -> createCache(lnPort));
+    vm3.invoke(() -> createSender("ln_Serial", 2, false, 100, 400, false, false, null, true));
+    vm3.invoke(() -> createSender("ln_Parallel", 2, true, 100, 400, false, false, null, true));
+    vm4.invoke(() -> createCache(lnPort));
+    vm4.invoke(() -> createSender("ln_Serial", 2, false, 100, 400, false, false, null, true));
+    vm4.invoke(() -> createSender("ln_Parallel", 2, true, 100, 400, false, false, null, true));
+    vm5.invoke(() -> createCache(lnPort));
+    vm5.invoke(() -> createSender("ln_Serial", 2, false, 100, 400, false, false, null, true));
+    vm5.invoke(() -> createSender("ln_Parallel", 2, true, 100, 400, false, false, null, true));
+
+    pause(10000);
+    String command = CliStrings.STATUS_GATEWAYSENDER + " --" + CliStrings.STATUS_GATEWAYSENDER__ID
+        + "=ln_Serial";
+    CommandResult cmdResult = executeCommand(command);
+
+    if (cmdResult != null) {
+      TabularResultData tableResultData = ((CompositeResultData) cmdResult.getResultData())
+          .retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_AVAILABLE)
+          .retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(3, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_RUNNING));
+      tableResultData = ((CompositeResultData) cmdResult.getResultData())
+          .retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_NOT_AVAILABLE)
+          .retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> result_hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
+      assertEquals(2, result_hosts.size());
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testGatewaySenderStatus : " + strCmdResult + ">>>>> ");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+    } else {
+      fail("testListGatewaySender failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> startSender("ln_Serial"));
+    vm3.invoke(() -> startSender("ln_Parallel"));
+    vm4.invoke(() -> startSender("ln_Serial"));
+    vm4.invoke(() -> startSender("ln_Parallel"));
+    vm5.invoke(() -> startSender("ln_Serial"));
+    vm5.invoke(() -> startSender("ln_Parallel"));
+
+    pause(10000);
+    command = CliStrings.STATUS_GATEWAYSENDER + " --" + CliStrings.STATUS_GATEWAYSENDER__ID
+        + "=ln_Serial";
+    cmdResult = executeCommand(command);
+
+    if (cmdResult != null) {
+      TabularResultData tableResultData = ((CompositeResultData) cmdResult.getResultData())
+          .retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_AVAILABLE)
+          .retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(3, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_NOT_RUNNING));
+      tableResultData = ((CompositeResultData) cmdResult.getResultData())
+          .retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_NOT_AVAILABLE)
+          .retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> result_hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
+      assertEquals(2, result_hosts.size());
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testGatewaySenderStatus : " + strCmdResult + ">>>>> ");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+    } else {
+      fail("testListGatewaySender failed as did not get CommandResult");
+    }
+  }
+
+  @Test
+  public void testGatewaySenderStatus_OnMember() {
+    Integer lnPort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(lnPort);
+    Integer nyPort = vm2.invoke(() -> createFirstRemoteLocator(2, lnPort));
+
+    vm6.invoke(() -> createAndStartReceiver(nyPort));
+    vm3.invoke(() -> createCache(lnPort));
+    vm3.invoke(() -> createSender("ln_Serial", 2, false, 100, 400, false, false, null, true));
+    vm3.invoke(() -> createSender("ln_Parallel", 2, true, 100, 400, false, false, null, true));
+    vm4.invoke(() -> createCache(lnPort));
+    vm4.invoke(() -> createSender("ln_Serial", 2, false, 100, 400, false, false, null, true));
+    vm4.invoke(() -> createSender("ln_Parallel", 2, true, 100, 400, false, false, null, true));
+    vm5.invoke(() -> createCache(lnPort));
+
+    final DistributedMember vm1Member = vm3.invoke(this::getMember);
+    pause(10000);
+    String command = CliStrings.STATUS_GATEWAYSENDER + " --" + CliStrings.STATUS_GATEWAYSENDER__ID
+        + "=ln_Serial --" + CliStrings.MEMBER + "=" + vm1Member.getId();
+    CommandResult cmdResult = executeCommand(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testGatewaySenderStatus_OnMember : " + strCmdResult + ">>>>> ");
+      TabularResultData tableResultData = ((CompositeResultData) cmdResult.getResultData())
+          .retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_AVAILABLE)
+          .retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(1, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_RUNNING));
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+    } else {
+      fail("testListGatewaySender failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> startSender("ln_Serial"));
+    vm3.invoke(() -> startSender("ln_Parallel"));
+    vm4.invoke(() -> startSender("ln_Serial"));
+    vm4.invoke(() -> startSender("ln_Parallel"));
+
+    pause(10000);
+    command = CliStrings.STATUS_GATEWAYSENDER + " --" + CliStrings.STATUS_GATEWAYSENDER__ID
+        + "=ln_Serial --" + CliStrings.MEMBER + "=" + vm1Member.getId();
+    cmdResult = executeCommand(command);
+
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testGatewaySenderStatus_OnMember : " + strCmdResult + ">>>>> ");
+      TabularResultData tableResultData = ((CompositeResultData) cmdResult.getResultData())
+          .retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_AVAILABLE)
+          .retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(1, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_NOT_RUNNING));
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+    } else {
+      fail("testListGatewaySender failed as did not get CommandResult");
+    }
+    final DistributedMember vm5Member = vm5.invoke(this::getMember);
+    command = CliStrings.STATUS_GATEWAYSENDER + " --" + CliStrings.STATUS_GATEWAYSENDER__ID
+        + "=ln_Serial --" + CliStrings.MEMBER + "=" + vm5Member.getId();
+    cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testGatewaySenderStatus_OnMember : " + strCmdResult + ">>>>> ");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+    } else {
+      fail("testListGatewaySender failed as did not get CommandResult");
+    }
+  }
+
+  @Test
+  public void testGatewaySenderStatus_OnGroups() {
+    Integer lnPort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(lnPort);
+    Integer nyPort = vm2.invoke(() -> createFirstRemoteLocator(2, lnPort));
+
+    vm7.invoke(() -> createAndStartReceiver(nyPort));
+    vm3.invoke(() -> createCacheWithGroups(lnPort, "Serial_Sender, Parallel_Sender"));
+    vm3.invoke(() -> createSender("ln_Serial", 2, false, 100, 400, false, false, null, true));
+    vm3.invoke(() -> createSender("ln_Parallel", 2, true, 100, 400, false, false, null, true));
+    vm4.invoke(() -> createCacheWithGroups(lnPort, "Serial_Sender, Parallel_Sender"));
+    vm4.invoke(() -> createSender("ln_Serial", 2, false, 100, 400, false, false, null, true));
+    vm4.invoke(() -> createSender("ln_Parallel", 2, true, 100, 400, false, false, null, true));
+    vm5.invoke(() -> createCacheWithGroups(lnPort, "Parallel_Sender"));
+    vm5.invoke(() -> createSender("ln_Serial", 2, false, 100, 400, false, false, null, true));
+    vm5.invoke(() -> createSender("ln_Parallel", 2, true, 100, 400, false, false, null, true));
+    vm6.invoke(() -> createCacheWithGroups(lnPort, "Serial_Sender"));
+
+    final DistributedMember vm1Member = vm3.invoke(this::getMember);
+    pause(10000);
+    String command = CliStrings.STATUS_GATEWAYSENDER + " --" + CliStrings.STATUS_GATEWAYSENDER__ID
+        + "=ln_Serial --" + CliStrings.GROUP + "=Serial_Sender";
+    CommandResult cmdResult = executeCommand(command);
+
+    if (cmdResult != null) {
+      TabularResultData tableResultData = ((CompositeResultData) cmdResult.getResultData())
+          .retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_AVAILABLE)
+          .retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(2, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_RUNNING));
+      tableResultData = ((CompositeResultData) cmdResult.getResultData())
+          .retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_NOT_AVAILABLE)
+          .retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> result_hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
+      assertEquals(1, result_hosts.size());
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testGatewaySenderStatus_OnGroups : " + strCmdResult + ">>>>> ");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+    } else {
+      fail("testListGatewaySender failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> startSender("ln_Serial"));
+    vm3.invoke(() -> startSender("ln_Parallel"));
+    vm4.invoke(() -> startSender("ln_Serial"));
+    vm4.invoke(() -> startSender("ln_Parallel"));
+
+    pause(10000);
+    command = CliStrings.STATUS_GATEWAYSENDER + " --" + CliStrings.STATUS_GATEWAYSENDER__ID
+        + "=ln_Serial --" + CliStrings.GROUP + "=Serial_Sender";
+    cmdResult = executeCommand(command);
+
+    if (cmdResult != null) {
+      TabularResultData tableResultData = ((CompositeResultData) cmdResult.getResultData())
+          .retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_AVAILABLE)
+          .retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
+      assertEquals(2, result_Status.size());
+      assertFalse(result_Status.contains(CliStrings.GATEWAY_NOT_RUNNING));
+      tableResultData = ((CompositeResultData) cmdResult.getResultData())
+          .retrieveSection(CliStrings.SECTION_GATEWAY_SENDER_NOT_AVAILABLE)
+          .retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
+      List<String> result_hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
+      assertEquals(1, result_hosts.size());
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testGatewaySenderStatus_OnGroups : " + strCmdResult + ">>>>> ");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+    } else {
+      fail("testListGatewaySender failed as did not get CommandResult");
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/e1befef4/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StopGatewayReceiverCommandDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StopGatewayReceiverCommandDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StopGatewayReceiverCommandDUnitTest.java
new file mode 100644
index 0000000..70b94be
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StopGatewayReceiverCommandDUnitTest.java
@@ -0,0 +1,221 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.wan.wancommand;
+
+import static org.apache.geode.test.dunit.Assert.assertEquals;
+import static org.apache.geode.test.dunit.Assert.assertFalse;
+import static org.apache.geode.test.dunit.Assert.assertTrue;
+import static org.apache.geode.test.dunit.Assert.fail;
+import static org.apache.geode.test.dunit.LogWriterUtils.getLogWriter;
+import static org.apache.geode.test.dunit.Wait.pause;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.CommandResult;
+import org.apache.geode.management.internal.cli.result.TabularResultData;
+import org.apache.geode.test.dunit.Host;
+import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.geode.test.junit.categories.FlakyTest;
+
+@Category(DistributedTest.class)
+public class StopGatewayReceiverCommandDUnitTest extends WANCommandTestBase {
+  /**
+   * Test wan commands for error in input 1> start gateway-sender command needs only one of member
+   * or group.
+   */
+  @Test
+  public void testStopGatewayReceiver_ErrorConditions() {
+    VM puneLocator = Host.getLocator();
+    int punePort = puneLocator.invoke(this::getLocatorPort);
+    propsSetUp(punePort);
+
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+    vm3.invoke(() -> createReceiver(punePort));
+
+    final DistributedMember vm1Member = vm3.invoke(this::getMember);
+    String command = CliStrings.STOP_GATEWAYRECEIVER + " --" + CliStrings.MEMBER + "="
+        + vm1Member.getId() + " --" + CliStrings.GROUP + "=RG1";
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter()
+          .info("testStopGatewayReceiver_ErrorConditions stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
+    } else {
+      fail("testStopGatewayReceiver_ErrorConditions failed as did not get CommandResult");
+    }
+  }
+
+  @Category(FlakyTest.class) // GEODE-1418
+  @Test
+  public void testStopGatewayReceiver() {
+    VM puneLocator = Host.getLocator();
+    int punePort = puneLocator.invoke(this::getLocatorPort);
+    propsSetUp(punePort);
+
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+    vm3.invoke(() -> createAndStartReceiver(punePort));
+    vm4.invoke(() -> createAndStartReceiver(punePort));
+    vm5.invoke(() -> createAndStartReceiver(punePort));
+    vm3.invoke(() -> verifyReceiverState(true));
+    vm4.invoke(() -> verifyReceiverState(true));
+    vm5.invoke(() -> verifyReceiverState(true));
+
+    pause(10000);
+    String command = CliStrings.STOP_GATEWAYRECEIVER;
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testStopGatewayReceiver stringResult : " + strCmdResult + ">>>>");
+      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(4, status.size());
+      assertTrue(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));
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on a member
+   */
+  @Test
+  public void testStopGatewayReceiver_onMember() {
+    VM puneLocator = Host.getLocator();
+    int punePort = puneLocator.invoke(this::getLocatorPort);
+    propsSetUp(punePort);
+
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+    vm3.invoke(() -> createAndStartReceiver(punePort));
+    vm4.invoke(() -> createAndStartReceiver(punePort));
+    vm5.invoke(() -> createAndStartReceiver(punePort));
+    vm3.invoke(() -> verifyReceiverState(true));
+    vm4.invoke(() -> verifyReceiverState(true));
+    vm5.invoke(() -> verifyReceiverState(true));
+
+    final DistributedMember vm1Member = vm3.invoke(this::getMember);
+    pause(10000);
+    String command =
+        CliStrings.STOP_GATEWAYRECEIVER + " --" + CliStrings.MEMBER + "=" + vm1Member.getId();
+    CommandResult cmdResult = executeCommand(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter()
+          .info("testStopGatewayReceiver_onMember stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains("stopped on member"));
+    } else {
+      fail("testStopGatewayReceiver failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> verifyReceiverState(false));
+    vm4.invoke(() -> verifyReceiverState(true));
+    vm5.invoke(() -> verifyReceiverState(true));
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on a group of members
+   */
+  @Test
+  public void testStopGatewayReceiver_Group() {
+    VM puneLocator = Host.getLocator();
+    int punePort = puneLocator.invoke(this::getLocatorPort);
+    propsSetUp(punePort);
+
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+    vm3.invoke(() -> createAndStartReceiverWithGroup(punePort, "RG1"));
+    vm4.invoke(() -> createAndStartReceiverWithGroup(punePort, "RG1"));
+    vm5.invoke(() -> createAndStartReceiverWithGroup(punePort, "RG1"));
+    vm3.invoke(() -> verifyReceiverState(true));
+    vm4.invoke(() -> verifyReceiverState(true));
+    vm5.invoke(() -> verifyReceiverState(true));
+
+    pause(10000);
+    String command = CliStrings.STOP_GATEWAYRECEIVER + " --" + CliStrings.GROUP + "=RG1";
+    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(3, status.size());
+      assertFalse(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testStopGatewayReceiver_Group failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> verifyReceiverState(false));
+    vm4.invoke(() -> verifyReceiverState(false));
+    vm5.invoke(() -> verifyReceiverState(false));
+  }
+
+  /**
+   * 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 punePort = puneLocator.invoke(this::getLocatorPort);
+    propsSetUp(punePort);
+
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+    vm3.invoke(() -> createAndStartReceiverWithGroup(punePort, "RG1"));
+    vm4.invoke(() -> createAndStartReceiverWithGroup(punePort, "RG1"));
+    vm5.invoke(() -> createAndStartReceiverWithGroup(punePort, "RG1"));
+    vm6.invoke(() -> createAndStartReceiverWithGroup(punePort, "RG1, RG2"));
+    vm7.invoke(() -> createAndStartReceiverWithGroup(punePort, "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));
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/e1befef4/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StopGatewaySenderCommandDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StopGatewaySenderCommandDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StopGatewaySenderCommandDUnitTest.java
new file mode 100644
index 0000000..53dd6cf
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StopGatewaySenderCommandDUnitTest.java
@@ -0,0 +1,236 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.wan.wancommand;
+
+import static org.apache.geode.test.dunit.Assert.assertEquals;
+import static org.apache.geode.test.dunit.Assert.assertFalse;
+import static org.apache.geode.test.dunit.Assert.assertTrue;
+import static org.apache.geode.test.dunit.Assert.fail;
+import static org.apache.geode.test.dunit.LogWriterUtils.getLogWriter;
+import static org.apache.geode.test.dunit.Wait.pause;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.CommandResult;
+import org.apache.geode.management.internal.cli.result.TabularResultData;
+import org.apache.geode.test.dunit.IgnoredException;
+import org.apache.geode.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class StopGatewaySenderCommandDUnitTest extends WANCommandTestBase {
+  @Test
+  public void testStopGatewaySender_ErrorConditions() {
+    Integer punePort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(punePort);
+
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+    vm3.invoke(() -> createCache(punePort));
+    vm3.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+
+    final DistributedMember vm1Member = vm3.invoke(this::getMember);
+    String command = CliStrings.STOP_GATEWAYSENDER + " --" + CliStrings.STOP_GATEWAYSENDER__ID
+        + "=ln --" + CliStrings.MEMBER + "=" + vm1Member.getId() + " --" + CliStrings.GROUP
+        + "=SenderGroup1";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testStopGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
+    } else {
+      fail("testStopGatewaySender failed as did not get CommandResult");
+    }
+  }
+
+  @Test
+  public void testStopGatewaySender() {
+    Integer punePort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(punePort);
+
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+    vm3.invoke(() -> createCache(punePort));
+    vm3.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm4.invoke(() -> createCache(punePort));
+    vm4.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm5.invoke(() -> createCache(punePort));
+    vm5.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm3.invoke(() -> startSender("ln"));
+    vm4.invoke(() -> startSender("ln"));
+    vm5.invoke(() -> startSender("ln"));
+    vm3.invoke(() -> verifySenderState("ln", true, false));
+    vm4.invoke(() -> verifySenderState("ln", true, false));
+    vm5.invoke(() -> verifySenderState("ln", true, false));
+
+    pause(10000);
+    String command =
+        CliStrings.STOP_GATEWAYSENDER + " --" + CliStrings.STOP_GATEWAYSENDER__ID + "=ln";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testStopGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(5, status.size());
+      assertTrue(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testStopGatewaySender failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> verifySenderState("ln", false, false));
+    vm4.invoke(() -> verifySenderState("ln", false, false));
+    vm5.invoke(() -> verifySenderState("ln", false, false));
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on a member
+   */
+  @Test
+  public void testStopGatewaySender_onMember() {
+    Integer punePort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(punePort);
+
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+    vm3.invoke(() -> createCache(punePort));
+    vm3.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm3.invoke(() -> startSender("ln"));
+    vm3.invoke(() -> verifySenderState("ln", true, false));
+
+    final DistributedMember vm1Member = vm3.invoke(this::getMember);
+    pause(10000);
+    String command = CliStrings.STOP_GATEWAYSENDER + " --" + CliStrings.STOP_GATEWAYSENDER__ID
+        + "=ln --" + CliStrings.MEMBER + "=" + vm1Member.getId();
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testStopGatewaySender stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      assertTrue(strCmdResult.contains("is stopped on member"));
+    } else {
+      fail("testStopGatewaySender failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> verifySenderState("ln", false, false));
+  }
+
+  /**
+   * test to validate that the start gateway sender starts the gateway sender on a group of members
+   */
+  @Test
+  public void testStopGatewaySender_Group() {
+    Integer punePort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(punePort);
+
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+    vm3.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1"));
+    vm3.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm4.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1"));
+    vm4.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm5.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1"));
+    vm5.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm3.invoke(() -> startSender("ln"));
+    vm4.invoke(() -> startSender("ln"));
+    vm5.invoke(() -> startSender("ln"));
+    vm3.invoke(() -> verifySenderState("ln", true, false));
+    vm4.invoke(() -> verifySenderState("ln", true, false));
+    vm5.invoke(() -> verifySenderState("ln", true, false));
+
+    pause(10000);
+    String command = CliStrings.STOP_GATEWAYSENDER + " --" + CliStrings.STOP_GATEWAYSENDER__ID
+        + "=ln --" + CliStrings.GROUP + "=SenderGroup1";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testStopGatewaySender_Group stringResult : " + strCmdResult + ">>>>");
+      assertEquals(Result.Status.OK, cmdResult.getStatus());
+      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
+      List<String> status = resultData.retrieveAllValues("Result");
+      assertEquals(3, status.size());
+      assertFalse(status.contains("Error"));
+      assertTrue(status.contains("OK"));
+    } else {
+      fail("testStopGatewaySender failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> verifySenderState("ln", false, false));
+    vm4.invoke(() -> verifySenderState("ln", false, false));
+    vm5.invoke(() -> verifySenderState("ln", false, false));
+  }
+
+  /**
+   * Test to validate the scenario gateway sender is started when one or more sender members belongs
+   * to multiple groups
+   */
+  @Test
+  public void testStopGatewaySender_MultipleGroup() {
+    Integer punePort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    propsSetUp(punePort);
+
+    vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+    vm3.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1"));
+    vm3.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm4.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1"));
+    vm4.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm5.invoke(() -> createCacheWithGroups(punePort, "SenderGroup1, SenderGroup2"));
+    vm5.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm6.invoke(() -> createCacheWithGroups(punePort, "SenderGroup2"));
+    vm6.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm7.invoke(() -> createCacheWithGroups(punePort, "SenderGroup3"));
+    vm7.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
+    vm3.invoke(() -> startSender("ln"));
+    vm4.invoke(() -> startSender("ln"));
+    vm5.invoke(() -> startSender("ln"));
+    vm6.invoke(() -> startSender("ln"));
+    vm7.invoke(() -> startSender("ln"));
+    vm3.invoke(() -> verifySenderState("ln", true, false));
+    vm4.invoke(() -> verifySenderState("ln", true, false));
+    vm5.invoke(() -> verifySenderState("ln", true, false));
+    vm6.invoke(() -> verifySenderState("ln", true, false));
+    vm7.invoke(() -> verifySenderState("ln", true, false));
+
+    pause(10000);
+    String command = CliStrings.STOP_GATEWAYSENDER + " --" + CliStrings.STOP_GATEWAYSENDER__ID
+        + "=ln --" + CliStrings.GROUP + "=SenderGroup1,SenderGroup2";
+    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
+    if (cmdResult != null) {
+      String strCmdResult = commandResultToString(cmdResult);
+      getLogWriter().info("testStopGatewaySender_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("testStopGatewaySender failed as did not get CommandResult");
+    }
+    vm3.invoke(() -> verifySenderState("ln", false, false));
+    vm4.invoke(() -> verifySenderState("ln", false, false));
+    vm5.invoke(() -> verifySenderState("ln", false, false));
+    vm6.invoke(() -> verifySenderState("ln", false, false));
+    vm7.invoke(() -> verifySenderState("ln", true, false));
+  }
+
+  private CommandResult executeCommandWithIgnoredExceptions(String command) {
+    final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
+    CommandResult commandResult = executeCommand(command);
+    exln.remove();
+    return commandResult;
+  }
+}