public void testListGatewayReceiver() { Integer lnPort = (Integer) vm1.invoke(() -> WANCommandTestBase.createFirstLocatorWithDSId(1)); Properties props = getDistributedSystemProperties(); props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); props.setProperty(DistributionConfig.DISTRIBUTED_SYSTEM_ID_NAME, "1"); props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + lnPort + "]"); createDefaultSetup(props); Integer nyPort = (Integer) vm2.invoke(() -> WANCommandTestBase.createFirstRemoteLocator(2, lnPort)); vm3.invoke(() -> WANCommandTestBase.createAndStartReceiver(lnPort)); vm4.invoke(() -> WANCommandTestBase.createAndStartReceiver(lnPort)); vm5.invoke(() -> WANCommandTestBase.createCache(nyPort)); vm5.invoke( () -> WANCommandTestBase.createSender( "ln_Serial", 1, false, 100, 400, false, false, null, false)); vm6.invoke(() -> WANCommandTestBase.createCache(nyPort)); vm6.invoke( () -> WANCommandTestBase.createSender( "ln_Serial", 1, false, 100, 400, false, false, null, false)); vm6.invoke( () -> WANCommandTestBase.createSender( "ln_Parallel", 1, true, 100, 400, false, false, null, false)); Wait.pause(10000); String command = CliStrings.LIST_GATEWAY; CommandResult cmdResult = executeCommand(command); if (cmdResult != null) { String strCmdResult = commandResultToString(cmdResult); Log.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 to validate that the start gateway sender starts the gateway sender on a group of members */ public void testStopGatewayReceiver_Group() { VM puneLocator = Host.getLocator(); int punePort = (Integer) puneLocator.invoke(WANCommandTestBase.class, "getLocatorPort"); Properties props = new Properties(); props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + punePort + "]"); createDefaultSetup(props); Integer nyPort = (Integer) vm2.invoke( WANCommandTestBase.class, "createFirstRemoteLocator", new Object[] {2, punePort}); vm3.invoke( WANCommandTestBase.class, "createAndStartReceiverWithGroup", new Object[] {punePort, "RG1"}); vm4.invoke( WANCommandTestBase.class, "createAndStartReceiverWithGroup", new Object[] {punePort, "RG1"}); vm5.invoke( WANCommandTestBase.class, "createAndStartReceiverWithGroup", new Object[] {punePort, "RG1"}); vm3.invoke(WANCommandTestBase.class, "verifyReceiverState", new Object[] {true}); vm4.invoke(WANCommandTestBase.class, "verifyReceiverState", new Object[] {true}); vm5.invoke(WANCommandTestBase.class, "verifyReceiverState", new Object[] {true}); pause(10000); String command = CliStrings.STOP_GATEWAYRECEIVER + " --" + CliStrings.STOP_GATEWAYRECEIVER__GROUP + "=RG1"; CommandResult cmdResult = executeCommand(command); if (cmdResult != null) { String strCmdResult = commandResultToString(cmdResult); Log.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(WANCommandTestBase.class, "verifyReceiverState", new Object[] {false}); vm4.invoke(WANCommandTestBase.class, "verifyReceiverState", new Object[] {false}); vm5.invoke(WANCommandTestBase.class, "verifyReceiverState", new Object[] {false}); }