use of org.apache.geode.management.internal.cli.result.TabularResultData in project geode by apache.
the class WanCommandGatewaySenderStopDUnitTest method testStopGatewaySender_Group.
/**
* 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));
}
use of org.apache.geode.management.internal.cli.result.TabularResultData in project geode by apache.
the class WanCommandListDUnitTest method testListGatewaySender.
@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");
}
}
use of org.apache.geode.management.internal.cli.result.TabularResultData in project geode by apache.
the class WanCommandListDUnitTest method testListGatewaySenderGatewayReceiver_group.
@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");
}
}
use of org.apache.geode.management.internal.cli.result.TabularResultData in project geode by apache.
the class WanCommandCreateGatewayReceiverDUnitTest method testCreateGatewayReceiver_onGroup_Scenario2.
/**
* GatewayReceiver with given attributes on the given group. Only 2 of 3 members are part of the
* group.
*/
@Test
public void testCreateGatewayReceiver_onGroup_Scenario2() {
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(() -> createCacheWithGroups(punePort, "receiverGroup1"));
vm4.invoke(() -> createCacheWithGroups(punePort, "receiverGroup1"));
vm5.invoke(() -> createCacheWithGroups(punePort, "receiverGroup2"));
String command = CliStrings.CREATE_GATEWAYRECEIVER + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART + "=true" + " --" + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost" + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000" + " --" + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000" + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000" + " --" + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000" + " --" + CliStrings.CREATE_GATEWAYRECEIVER__GROUP + "=receiverGroup1";
CommandResult cmdResult = executeCommand(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
getLogWriter().info("testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
List<String> status = resultData.retrieveAllValues("Status");
//
assertEquals(2, status.size());
// verify there is no error in the status
for (int i = 0; i < status.size(); i++) {
assertTrue("GatewayReceiver creation failed with: " + status.get(i), status.get(i).indexOf("ERROR:") == -1);
}
} else {
fail("testCreateGatewayReceiver failed as did not get CommandResult");
}
vm3.invoke(() -> verifyReceiverCreationWithAttributes(false, 10000, 11000, "localhost", 100000, 512000, null));
vm4.invoke(() -> verifyReceiverCreationWithAttributes(false, 10000, 11000, "localhost", 100000, 512000, null));
}
use of org.apache.geode.management.internal.cli.result.TabularResultData in project geode by apache.
the class WanCommandCreateGatewayReceiverDUnitTest method testCreateGatewayReceiver_onMultipleMembers.
/**
* GatewayReceiver with given attributes on multiple members.
*/
// GEODE-1355
@Category(FlakyTest.class)
@Test
public void testCreateGatewayReceiver_onMultipleMembers() {
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(() -> createCache(punePort));
vm4.invoke(() -> createCache(punePort));
vm5.invoke(() -> createCache(punePort));
final DistributedMember vm3Member = (DistributedMember) vm3.invoke(() -> getMember());
final DistributedMember vm4Member = (DistributedMember) vm4.invoke(() -> getMember());
String command = CliStrings.CREATE_GATEWAYRECEIVER + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MANUALSTART + "=true" + " --" + CliStrings.CREATE_GATEWAYRECEIVER__BINDADDRESS + "=localhost" + " --" + CliStrings.CREATE_GATEWAYRECEIVER__STARTPORT + "=10000" + " --" + CliStrings.CREATE_GATEWAYRECEIVER__ENDPORT + "=11000" + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MAXTIMEBETWEENPINGS + "=100000" + " --" + CliStrings.CREATE_GATEWAYRECEIVER__SOCKETBUFFERSIZE + "=512000" + " --" + CliStrings.CREATE_GATEWAYRECEIVER__MEMBER + "=" + vm3Member.getId() + "," + vm4Member.getId();
CommandResult cmdResult = executeCommand(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
getLogWriter().info("testCreateGatewayReceiver stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
List<String> status = resultData.retrieveAllValues("Status");
assertEquals(2, status.size());
// verify there is no error in the status
for (int i = 0; i < status.size(); i++) {
assertTrue("GatewayReceiver creation failed with: " + status.get(i), status.get(i).indexOf("ERROR:") == -1);
}
} else {
fail("testCreateGatewayReceiver failed as did not get CommandResult");
}
vm3.invoke(() -> verifyReceiverCreationWithAttributes(false, 10000, 11000, "localhost", 100000, 512000, null));
vm4.invoke(() -> verifyReceiverCreationWithAttributes(false, 10000, 11000, "localhost", 100000, 512000, null));
}
Aggregations