You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by hi...@apache.org on 2016/09/13 22:44:11 UTC
[23/61] [abbrv] incubator-geode git commit: GEODE-37 change package
name from com.gemstone.gemfire (for
./geode-wan/src/test/java/com/gemstone/gemfire)to org.apache.geode for(to
./geode-wan/src/test/java/org/apache/geode)
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewayReceiverStopDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewayReceiverStopDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewayReceiverStopDUnitTest.java
deleted file mode 100644
index c627353..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewayReceiverStopDUnitTest.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.cache.wan.wancommand;
-
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.management.cli.Result;
-import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
-import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
-import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.List;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.MCAST_PORT;
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
-import static com.gemstone.gemfire.test.dunit.Wait.pause;
-
-@Category(DistributedTest.class)
-public class WanCommandGatewayReceiverStopDUnitTest extends WANCommandTestBase {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 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 = (Integer) puneLocator.invoke(() -> getLocatorPort());
-
- Properties props = getDistributedSystemProperties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(LOCATORS, "localhost[" + punePort + "]");
- setUpJmxManagerOnVm0ThenConnect(props);
-
- Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
- vm3.invoke(() -> createReceiver( punePort ));
-
- final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
-
- String command = CliStrings.STOP_GATEWAYRECEIVER + " --"
- + CliStrings.STOP_GATEWAYRECEIVER__MEMBER + "=" + vm1Member.getId()
- + " --" + CliStrings.STOP_GATEWAYRECEIVER__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");
- }
- }
-
- @Test
- public void testStopGatewayReceiver() {
-
- VM puneLocator = Host.getLocator();
- int punePort = (Integer) puneLocator.invoke(() -> getLocatorPort());
-
- Properties props = getDistributedSystemProperties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(LOCATORS, "localhost[" + punePort + "]");
- setUpJmxManagerOnVm0ThenConnect(props);
-
- Integer nyPort = (Integer) 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 = (Integer) puneLocator.invoke(() -> getLocatorPort());
-
- Properties props = getDistributedSystemProperties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(LOCATORS, "localhost[" + punePort + "]");
- setUpJmxManagerOnVm0ThenConnect(props);
-
- Integer nyPort = (Integer) 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 = (DistributedMember) vm3.invoke(() -> getMember());
- pause(10000);
- String command = CliStrings.STOP_GATEWAYRECEIVER + " --"
- + CliStrings.STOP_GATEWAYRECEIVER__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 = (Integer) puneLocator.invoke(() -> getLocatorPort());
-
- Properties props = getDistributedSystemProperties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(LOCATORS, "localhost[" + punePort + "]");
- setUpJmxManagerOnVm0ThenConnect(props);
-
- Integer nyPort = (Integer) 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.STOP_GATEWAYRECEIVER__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 = (Integer) puneLocator.invoke(() -> getLocatorPort());
-
- Properties props = getDistributedSystemProperties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(LOCATORS, "localhost[" + punePort + "]");
- setUpJmxManagerOnVm0ThenConnect(props);
-
- Integer nyPort = (Integer) 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.STOP_GATEWAYRECEIVER__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/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewaySenderStartDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewaySenderStartDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewaySenderStartDUnitTest.java
deleted file mode 100644
index 74839a9..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewaySenderStartDUnitTest.java
+++ /dev/null
@@ -1,400 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.cache.wan.wancommand;
-
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.management.cli.Result;
-import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
-import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
-import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.List;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
-import static com.gemstone.gemfire.test.dunit.Wait.pause;
-
-@Category(DistributedTest.class)
-public class WanCommandGatewaySenderStartDUnitTest extends WANCommandTestBase {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 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 = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
- Properties props = getDistributedSystemProperties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
- props.setProperty(LOCATORS, "localhost[" + punePort + "]");
- setUpJmxManagerOnVm0ThenConnect(props);
-
- Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
- vm3.invoke(() -> createCache( punePort ));
- vm3.invoke(() -> createSender( "ln",
- 2, false, 100, 400, false, false, null, true ));
-
- final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
-
- String command = CliStrings.START_GATEWAYSENDER + " --"
- + CliStrings.START_GATEWAYSENDER__ID + "=ln --"
- + CliStrings.START_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId() + " --"
- + CliStrings.START_GATEWAYSENDER__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");
- }
- }
-
- private CommandResult executeCommandWithIgnoredExceptions(String command) {
- final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
- try {
- CommandResult commandResult = executeCommand(command);
- return commandResult;
- } finally {
- exln.remove();
- }
- }
-
- @Test
- public void testStartGatewaySender() {
-
- Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
- Properties props = getDistributedSystemProperties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
- props.setProperty(LOCATORS, "localhost[" + punePort + "]");
- setUpJmxManagerOnVm0ThenConnect(props);
-
- Integer nyPort = (Integer) 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 = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
- Properties props = getDistributedSystemProperties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
- props.setProperty(LOCATORS, "localhost[" + punePort + "]");
- setUpJmxManagerOnVm0ThenConnect(props);
-
- Integer nyPort = (Integer) 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 = (DistributedMember) vm3.invoke(() -> getMember());
- pause(10000);
- String command = CliStrings.START_GATEWAYSENDER + " --"
- + CliStrings.START_GATEWAYSENDER__ID + "=ln --"
- + CliStrings.START_GATEWAYSENDER__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 = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
- Properties props = getDistributedSystemProperties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
- props.setProperty(LOCATORS, "localhost[" + punePort + "]");
- setUpJmxManagerOnVm0ThenConnect(props);
-
- Integer nyPort = (Integer) 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.START_GATEWAYSENDER__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 = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
- Properties props = getDistributedSystemProperties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
- props.setProperty(LOCATORS, "localhost[" + punePort + "]");
- setUpJmxManagerOnVm0ThenConnect(props);
-
- Integer nyPort = (Integer) 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.START_GATEWAYSENDER__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 = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
- Properties props = getDistributedSystemProperties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
- props.setProperty(LOCATORS, "localhost[" + punePort + "]");
- setUpJmxManagerOnVm0ThenConnect(props);
-
- Integer nyPort = (Integer) 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.START_GATEWAYSENDER__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 ));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewaySenderStopDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewaySenderStopDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewaySenderStopDUnitTest.java
deleted file mode 100644
index a33d793..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandGatewaySenderStopDUnitTest.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.cache.wan.wancommand;
-
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.management.cli.Result;
-import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
-import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
-import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.List;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
-import static com.gemstone.gemfire.test.dunit.Wait.pause;
-
-@Category(DistributedTest.class)
-public class WanCommandGatewaySenderStopDUnitTest extends WANCommandTestBase {
-
- private static final long serialVersionUID = 1L;
-
- private CommandResult executeCommandWithIgnoredExceptions(String command) {
- final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
- CommandResult commandResult = executeCommand(command);
- exln.remove();
- return commandResult;
- }
-
- @Test
- public void testStopGatewaySender_ErrorConditions() {
-
- Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
- Properties props = getDistributedSystemProperties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
- props.setProperty(LOCATORS, "localhost[" + punePort + "]");
- setUpJmxManagerOnVm0ThenConnect(props);
-
- Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
- vm3.invoke(() -> createCache( punePort ));
- vm3.invoke(() -> createSender( "ln",
- 2, false, 100, 400, false, false, null, true ));
-
- final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
-
- String command = CliStrings.STOP_GATEWAYSENDER + " --"
- + CliStrings.STOP_GATEWAYSENDER__ID + "=ln --"
- + CliStrings.STOP_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId()
- + " --" + CliStrings.STOP_GATEWAYSENDER__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 = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
- Properties props = getDistributedSystemProperties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
- props.setProperty(LOCATORS, "localhost[" + punePort + "]");
- setUpJmxManagerOnVm0ThenConnect(props);
-
- Integer nyPort = (Integer) 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 = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
- Properties props = getDistributedSystemProperties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
- props.setProperty(LOCATORS, "localhost[" + punePort + "]");
- setUpJmxManagerOnVm0ThenConnect(props);
-
- Integer nyPort = (Integer) 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 = (DistributedMember) vm3.invoke(() -> getMember());
- pause(10000);
- String command = CliStrings.STOP_GATEWAYSENDER + " --"
- + CliStrings.STOP_GATEWAYSENDER__ID + "=ln --"
- + CliStrings.STOP_GATEWAYSENDER__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 = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
- Properties props = getDistributedSystemProperties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
- props.setProperty(LOCATORS, "localhost[" + punePort + "]");
- setUpJmxManagerOnVm0ThenConnect(props);
-
- Integer nyPort = (Integer) 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.STOP_GATEWAYSENDER__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 = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
- Properties props = getDistributedSystemProperties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
- props.setProperty(LOCATORS, "localhost[" + punePort + "]");
- setUpJmxManagerOnVm0ThenConnect(props);
-
- Integer nyPort = (Integer) 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.STOP_GATEWAYSENDER__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 ));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f39e2394/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandListDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandListDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandListDUnitTest.java
deleted file mode 100644
index 0c91f33..0000000
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/wancommand/WanCommandListDUnitTest.java
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.cache.wan.wancommand;
-
-import com.gemstone.gemfire.management.cli.Result;
-import com.gemstone.gemfire.management.internal.cli.i18n.CliStrings;
-import com.gemstone.gemfire.management.internal.cli.json.GfJsonException;
-import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
-import com.gemstone.gemfire.management.internal.cli.result.CompositeResultData;
-import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.List;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
-import static com.gemstone.gemfire.test.dunit.Wait.pause;
-
-@Category(DistributedTest.class)
-public class WanCommandListDUnitTest extends WANCommandTestBase {
-
- private static final long serialVersionUID = 1L;
-
- @Test
- public void testListGatewayWithNoSenderReceiver() {
-
- Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
- Properties props = getDistributedSystemProperties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
- props.setProperty(LOCATORS, "localhost[" + punePort + "]");
- setUpJmxManagerOnVm0ThenConnect(props);
-
- Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
- vm3.invoke(() -> createCache( punePort ));
- vm4.invoke(() -> createCache( punePort ));
- vm5.invoke(() -> createCache( punePort ));
-
- pause(10000);
- String command = CliStrings.LIST_GATEWAY;
- CommandResult cmdResult = executeCommand(command);
- if (cmdResult != null) {
- String strCmdResult = commandResultToString(cmdResult);
- getLogWriter().info("testListGatewaySender : : " + strCmdResult);
- assertEquals(Result.Status.ERROR, cmdResult.getStatus());
- } else {
- fail("testListGatewaySender failed as did not get CommandResult");
- }
- }
-
- @Test
- public void testListGatewaySender() {
-
- Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
- Properties props = getDistributedSystemProperties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
- props.setProperty(LOCATORS, "localhost[" + punePort + "]");
- setUpJmxManagerOnVm0ThenConnect(props);
-
- Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, punePort ));
-
- vm6.invoke(() -> createAndStartReceiver( nyPort ));
- vm7.invoke(() -> createAndStartReceiver( nyPort ));
-
- vm3.invoke(() -> createCache( punePort ));
- vm3.invoke(() -> createSender(
- "ln_Serial", 2, false, 100, 400, false, false, null, false ));
- vm3.invoke(() -> createSender(
- "ln_Parallel", 2, true, 100, 400, false, false, null, false ));
-
- vm4.invoke(() -> createCache( punePort ));
- vm4.invoke(() -> createSender(
- "ln_Parallel", 2, true, 100, 400, false, false, null, false ));
- vm4.invoke(() -> createSender(
- "ln_Serial", 2, false, 100, 400, false, false, null, false ));
-
- vm5.invoke(() -> createCache( punePort ));
- vm5.invoke(() -> createSender(
- "ln_Serial", 2, false, 100, 400, false, false, null, false ));
-
- pause(10000);
- String command = CliStrings.LIST_GATEWAY;
- CommandResult cmdResult = executeCommand(command);
- if (cmdResult != null) {
- String strCmdResult = commandResultToString(cmdResult);
- getLogWriter().info("testListGatewaySender" + strCmdResult);
- assertEquals(Result.Status.OK, cmdResult.getStatus());
-
- TabularResultData tableResultData =
- ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
- List<String> result_senderIds = tableResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
- assertTrue(result_senderIds.contains("ln_Serial"));
- assertTrue(result_senderIds.contains("ln_Parallel"));
- assertEquals(5, result_senderIds.size());
-
- assertEquals(null, ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER));
- } else {
- fail("testListGatewaySender failed as did not get CommandResult");
- }
- }
-
- @Test
- public void testListGatewayReceiver() {
-
- Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
- Properties props = getDistributedSystemProperties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
- props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
- setUpJmxManagerOnVm0ThenConnect(props);
-
- Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, lnPort ));
-
- vm3.invoke(() -> createAndStartReceiver( lnPort ));
- vm4.invoke(() -> createAndStartReceiver( lnPort ));
-
- vm5
- .invoke(() -> createCache( nyPort ));
- vm5.invoke(() -> createSender(
- "ln_Serial", 1, false, 100, 400, false, false, null, false ));
- vm6
- .invoke(() -> createCache( nyPort ));
- vm6.invoke(() -> createSender(
- "ln_Serial", 1, false, 100, 400, false, false, null, false ));
- vm6.invoke(() -> createSender(
- "ln_Parallel", 1, true, 100, 400, false, false, null, false ));
-
- pause(10000);
- String command = CliStrings.LIST_GATEWAY;
- CommandResult cmdResult = executeCommand(command);
- if (cmdResult != null) {
- String strCmdResult = commandResultToString(cmdResult);
- getLogWriter().info("testListGatewayReceiver" + strCmdResult);
- assertEquals(Result.Status.OK, cmdResult.getStatus());
-
- TabularResultData tableResultData =
- ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
- List<String> ports = tableResultData.retrieveAllValues(CliStrings.RESULT_PORT);
- assertEquals(2, ports.size());
- List<String> hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
- assertEquals(2, hosts.size());
-
- assertEquals(null, ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER));
-
-
- } else {
- fail("testListGatewayReceiver failed as did not get CommandResult");
- }
- }
-
- @Test
- public void testListGatewaySenderGatewayReceiver() throws GfJsonException {
-
- Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
- Properties props = getDistributedSystemProperties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
- props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
- setUpJmxManagerOnVm0ThenConnect(props);
-
- Integer nyPort = (Integer) 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, false ));
- vm3.invoke(() -> createSender(
- "ln_Parallel", 2, true, 100, 400, false, false, null, false ));
-
- vm4.invoke(() -> createCache( lnPort ));
- vm4.invoke(() -> createSender(
- "ln_Parallel", 2, true, 100, 400, false, false, null, false ));
- vm4.invoke(() -> createSender(
- "ln_Serial", 2, false, 100, 400, false, false, null, false ));
-
- vm5.invoke(() -> createAndStartReceiver( lnPort ));
-
- vm7.invoke(() -> createCache( nyPort ));
- vm7.invoke(() -> createSender(
- "ln_Serial", 1, false, 100, 400, false, false, null, false ));
- vm7.invoke(() -> createSender(
- "ln_Parallel", 1, true, 100, 400, false, false, null, false ));
-
- pause(10000);
- String command = CliStrings.LIST_GATEWAY;
- CommandResult cmdResult = executeCommand(command);
-
- if (cmdResult != null) {
- String strCmdResult = commandResultToString(cmdResult);
- getLogWriter().info(
- "testListGatewaySenderGatewayReceiver : " + strCmdResult );
- assertEquals(Result.Status.OK, cmdResult.getStatus());
-
- TabularResultData tableSenderResultData = ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
- List<String> senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
- assertEquals(4, senders.size());
- List<String> hosts = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
- assertEquals(4, hosts.size());
-
-
- TabularResultData tableReceiverResultData = ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
- List<String> ports = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_PORT);
- assertEquals(1, ports.size());
- hosts = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
- assertEquals(1, hosts.size());
- } else {
- fail("testListGatewaySenderGatewayReceiver failed as did not get CommandResult");
- }
- }
-
- @Test
- public void testListGatewaySenderGatewayReceiver_group() {
-
- Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId( 1 ));
-
- Properties props = getDistributedSystemProperties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
- props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
- setUpJmxManagerOnVm0ThenConnect(props);
-
- Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator( 2, lnPort ));
-
- vm6.invoke(() -> createAndStartReceiver( nyPort ));
-
- vm3.invoke(() -> createCacheWithGroups( lnPort, "Serial_Sender, Parallel_Sender"));
- vm3.invoke(() -> createSender(
- "ln_Serial", 2, false, 100, 400, false, false, null, false ));
- vm3.invoke(() -> createSender(
- "ln_Parallel", 2, true, 100, 400, false, false, null, false ));
-
- vm4.invoke(() -> createCacheWithGroups( lnPort,"Serial_Sender, Parallel_Sender"));
- vm4.invoke(() -> createSender(
- "ln_Parallel", 2, true, 100, 400, false, false, null, false ));
- vm4.invoke(() -> createSender(
- "ln_Serial", 2, false, 100, 400, false, false, null, false ));
-
- vm5.invoke(() -> createAndStartReceiverWithGroup( lnPort, "Parallel_Sender,Receiver_Group" ));
- vm5.invoke(() -> createSender(
- "ln_Parallel", 2, true, 100, 400, false, false, null, false ));
-
-
- vm7.invoke(() -> createCache( nyPort ));
- vm7.invoke(() -> createSender(
- "ln_Serial", 1, false, 100, 400, false, false, null, false ));
- vm7.invoke(() -> createSender(
- "ln_Parallel", 1, true, 100, 400, false, false, null, false ));
-
- pause(10000);
- String command = CliStrings.LIST_GATEWAY + " --" + CliStrings.LIST_GATEWAY__GROUP + "=Serial_Sender";
- CommandResult cmdResult = executeCommand(command);
- if (cmdResult != null) {
- String strCmdResult = commandResultToString(cmdResult);
- getLogWriter().info(
- "testListGatewaySenderGatewayReceiver_group : " + strCmdResult );
- assertEquals(Result.Status.OK, cmdResult.getStatus());
-
- TabularResultData tableSenderResultData =
- ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
- List<String> senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
- assertEquals(4, senders.size());
- List<String> hosts = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
- assertEquals(4, hosts.size());
-
- } else {
- fail("testListGatewaySenderGatewayReceiver_group failed as did not get CommandResult");
- }
-
- command = CliStrings.LIST_GATEWAY + " --" + CliStrings.LIST_GATEWAY__GROUP + "=Parallel_Sender";
- cmdResult = executeCommand(command);
- if (cmdResult != null) {
- TabularResultData tableSenderResultData =
- ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
- List<String> senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
- assertEquals(5, senders.size());
-
- TabularResultData tableReceiverResultData =
- ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
- List<String> ports = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_PORT);
- assertEquals(1, ports.size());
-
- String strCmdResult = commandResultToString(cmdResult);
- getLogWriter().info(
- "testListGatewaySenderGatewayReceiver_group : " + strCmdResult );
- assertEquals(Result.Status.OK, cmdResult.getStatus());
- } else {
- fail("testListGatewaySenderGatewayReceiver_group failed as did not get CommandResult");
- }
-
- command = CliStrings.LIST_GATEWAY + " --" + CliStrings.LIST_GATEWAY__GROUP + "=Receiver_Group";
- cmdResult = executeCommand(command);
- if (cmdResult != null) {
- String strCmdResult = commandResultToString(cmdResult);
- getLogWriter().info(
- "testListGatewaySenderGatewayReceiver_group : " + strCmdResult );
- assertEquals(Result.Status.OK, cmdResult.getStatus());
-
- TabularResultData tableSenderResultData =
- ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
- List<String> senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
- assertEquals(1, senders.size());
-
- TabularResultData tableReceiverResultData =
- ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
- List<String> ports = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_PORT);
- assertEquals(1, ports.size());
-
- } else {
- fail("testListGatewaySenderGatewayReceiver_group failed as did not get CommandResult");
- }
-
- command = CliStrings.LIST_GATEWAY + " --" + CliStrings.LIST_GATEWAY__GROUP + "=Serial_Sender,Parallel_Sender";
- cmdResult = executeCommand(command);
- if (cmdResult != null) {
- String strCmdResult = commandResultToString(cmdResult);
- getLogWriter().info(
- "testListGatewaySenderGatewayReceiver_group : " + strCmdResult );
- assertEquals(Result.Status.OK, cmdResult.getStatus());
-
- TabularResultData tableSenderResultData =
- ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
- List<String> senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
- assertEquals(5, senders.size());
-
- TabularResultData tableReceiverResultData =
- ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
- List<String> ports = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_PORT);
- assertEquals(1, ports.size());
- } else {
- fail("testListGatewaySenderGatewayReceiver_group failed as did not get CommandResult");
- }
-
- command = CliStrings.LIST_GATEWAY + " --" + CliStrings.LIST_GATEWAY__GROUP + "=Serial_Sender,Parallel_Sender,Receiver_Group";
- cmdResult = executeCommand(command);
- if (cmdResult != null) {
- String strCmdResult = commandResultToString(cmdResult);
- getLogWriter().info(
- "testListGatewaySenderGatewayReceiver_group : " + strCmdResult );
- assertEquals(Result.Status.OK, cmdResult.getStatus());
-
- TabularResultData tableSenderResultData =
- ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_SENDER).retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
- List<String> senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
- assertEquals(5, senders.size());
-
- TabularResultData tableReceiverResultData =
- ((CompositeResultData)cmdResult.getResultData()).retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER).retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
- List<String> ports = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_PORT);
- assertEquals(1, ports.size());
-
- } else {
- fail("testListGatewaySenderGatewayReceiver_group failed as did not get CommandResult");
- }
-
- }
-}