use of org.apache.geode.management.internal.cli.result.CommandResult in project geode by apache.
the class WanCommandStatusDUnitTest method testGatewayReceiverStatus_OnMember.
// GEODE-1395
@Category(FlakyTest.class)
@Test
public void testGatewayReceiverStatus_OnMember() {
Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId(1));
Properties props = getDistributedSystemProperties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
setUpJmxManagerOnVm0ThenConnect(props);
Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator(2, lnPort));
vm6.invoke(() -> createAndStartReceiver(nyPort));
vm3.invoke(() -> createAndStartReceiver(lnPort));
vm4.invoke(() -> createAndStartReceiver(lnPort));
vm5.invoke(() -> createAndStartReceiver(lnPort));
final DistributedMember vm3Member = (DistributedMember) vm3.invoke(() -> getMember());
pause(10000);
String command = CliStrings.STATUS_GATEWAYRECEIVER + " --" + CliStrings.STATUS_GATEWAYRECEIVER__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 = (TabularResultData) cmdResult.getResultData();
// List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
// assertIndexDetailsEquals(1, result_Status.size());
// assertFalse(strCmdResult.contains(CliStrings.GATEWAY_NOT_RUNNING));
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(() -> stopReceiver());
vm4.invoke(() -> stopReceiver());
vm5.invoke(() -> stopReceiver());
pause(10000);
command = CliStrings.STATUS_GATEWAYRECEIVER + " --" + CliStrings.STATUS_GATEWAYRECEIVER__MEMBER + "=" + vm3Member.getId();
cmdResult = executeCommand(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
getLogWriter().info("testGatewayReceiverStatus : " + strCmdResult + ">>>>> ");
// TabularResultData tableResultData =
// (TabularResultData) cmdResult.getResultData();
// List<String> result_Status = tableResultData.retrieveAllValues(CliStrings.RESULT_STATUS);
// assertIndexDetailsEquals(1, result_Status.size());
// assertFalse(result_Status.contains(CliStrings.GATEWAY_RUNNING));
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");
}
}
use of org.apache.geode.management.internal.cli.result.CommandResult in project geode by apache.
the class WanCommandStatusDUnitTest method testGatewayReceiverStatus_OnGroups.
@Test
public void testGatewayReceiverStatus_OnGroups() {
Integer lnPort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId(1));
Properties props = getDistributedSystemProperties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "localhost[" + lnPort + "]");
setUpJmxManagerOnVm0ThenConnect(props);
Integer nyPort = (Integer) 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.STATUS_GATEWAYRECEIVER__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(() -> stopReceiver());
vm4.invoke(() -> stopReceiver());
vm5.invoke(() -> stopReceiver());
pause(10000);
command = CliStrings.STATUS_GATEWAYRECEIVER + " --" + CliStrings.STATUS_GATEWAYRECEIVER__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");
}
}
use of org.apache.geode.management.internal.cli.result.CommandResult in project geode by apache.
the class WanCommandPauseResumeDUnitTest method testResumeGatewaySender_onMember.
/**
* test to validate that the start gateway sender starts the gateway sender on a member
*/
@Test
public void testResumeGatewaySender_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));
vm3.invoke(() -> pauseSender("ln"));
vm3.invoke(() -> verifySenderState("ln", true, true));
final DistributedMember vm1Member = (DistributedMember) vm3.invoke(() -> getMember());
pause(10000);
String command = CliStrings.RESUME_GATEWAYSENDER + " --" + CliStrings.RESUME_GATEWAYSENDER__ID + "=ln --" + CliStrings.RESUME_GATEWAYSENDER__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));
}
use of org.apache.geode.management.internal.cli.result.CommandResult in project geode by apache.
the class WanCommandPauseResumeDUnitTest method testPauseGatewaySender.
@Test
public void testPauseGatewaySender() {
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.PAUSE_GATEWAYSENDER + " --" + CliStrings.PAUSE_GATEWAYSENDER__ID + "=ln";
CommandResult cmdResult = executeCommand(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
getLogWriter().info("testPauseGatewaySender 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("testPauseGatewaySender failed as did not get CommandResult");
}
vm3.invoke(() -> verifySenderState("ln", true, true));
vm4.invoke(() -> verifySenderState("ln", true, true));
vm5.invoke(() -> verifySenderState("ln", true, true));
}
use of org.apache.geode.management.internal.cli.result.CommandResult in project geode by apache.
the class WanCommandPauseResumeDUnitTest method testPauseGatewaySender_onMember.
/**
* test to validate that the start gateway sender starts the gateway sender on a member
*/
@Test
public void testPauseGatewaySender_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.PAUSE_GATEWAYSENDER + " --" + CliStrings.PAUSE_GATEWAYSENDER__ID + "=ln --" + CliStrings.PAUSE_GATEWAYSENDER__MEMBER + "=" + vm1Member.getId();
CommandResult cmdResult = executeCommand(command);
if (cmdResult != null) {
String strCmdResult = commandResultToString(cmdResult);
getLogWriter().info("testPauseGatewaySender stringResult : " + strCmdResult + ">>>>");
assertEquals(Result.Status.OK, cmdResult.getStatus());
assertTrue(strCmdResult.contains("is paused on member"));
} else {
fail("testPauseGatewaySender failed as did not get CommandResult");
}
vm3.invoke(() -> verifySenderState("ln", true, true));
}
Aggregations