public void testListGatewayWithNoSenderReceiver() { Integer punePort = (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[" + punePort + "]"); createDefaultSetup(props); Integer nyPort = (Integer) vm2.invoke(() -> WANCommandTestBase.createFirstRemoteLocator(2, punePort)); vm3.invoke(() -> WANCommandTestBase.createCache(punePort)); vm4.invoke(() -> WANCommandTestBase.createCache(punePort)); vm5.invoke(() -> WANCommandTestBase.createCache(punePort)); Wait.pause(10000); String command = CliStrings.LIST_GATEWAY; CommandResult cmdResult = executeCommand(command); if (cmdResult != null) { String strCmdResult = commandResultToString(cmdResult); Log.getLogWriter().info("testListGatewaySender : : " + strCmdResult); assertEquals(Result.Status.ERROR, cmdResult.getStatus()); } else { fail("testListGatewaySender failed as did not get CommandResult"); } }
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"); } }