use of org.apache.geode.management.internal.cli.result.CommandResult in project geode by apache.
the class GemfireDataCommandsDUnitTest method doTestSelectWithGfshEnvVariables.
public void doTestSelectWithGfshEnvVariables(boolean statusActive) {
Random random = new Random(System.nanoTime());
int randomInteger = random.nextInt(COUNT);
String query = "query --query=\"select ID , status , createTime , pk, floatMinValue from ${DATA_REGION} where ID <= ${PORTFOLIO_ID}" + " and status='${STATUS}'" + "\" --interactive=false";
executeCommand("set variable --name=DATA_REGION --value=" + DATA_REGION_NAME_PATH);
executeCommand("set variable --name=PORTFOLIO_ID --value=" + randomInteger);
executeCommand("set variable --name=STATUS --value=" + (statusActive ? "active" : "inactive"));
CommandResult cmdResult = executeCommand(query);
printCommandOutput(cmdResult);
validateSelectResult(cmdResult, true, -1, null);
IgnoredException ex = addIgnoredException(QueryInvalidException.class.getSimpleName(), Host.getHost(0).getVM(0));
try {
query = "query --query=\"select ID , status , createTime , pk, floatMinValue from ${DATA_REGION2} where ID <= ${PORTFOLIO_ID2}" + " and status='${STATUS2}'" + "\" --interactive=false";
cmdResult = executeCommand(query);
printCommandOutput(cmdResult);
validateSelectResult(cmdResult, false, 0, null);
} finally {
ex.remove();
}
}
use of org.apache.geode.management.internal.cli.result.CommandResult in project geode by apache.
the class GemfireDataCommandsDUnitTest method testRecursiveLocateEntryCommand.
@Test
public void testRecursiveLocateEntryCommand() {
final String keyPrefix = "testKey";
final String valuePrefix = "testValue";
setupForGetPutRemoveLocateEntry("testRecursiveLocateEntry");
final VM vm1 = Host.getHost(0).getVM(1);
final VM vm2 = Host.getHost(0).getVM(2);
SerializableRunnable putKeys = new SerializableRunnable() {
@Override
public void run() {
Cache cache = getCache();
Region region = cache.getRegion(DATA_REGION_NAME_PATH);
Region region2 = cache.getRegion(DATA_REGION_NAME_CHILD_1_PATH);
Region region3 = cache.getRegion(DATA_REGION_NAME_CHILD_1_2_PATH);
assertNotNull(region);
region.clear();
for (int i = 0; i < COUNT; i++) {
String key = keyPrefix + i;
String value = valuePrefix + i;
region.put(key, value);
region2.put(key, value);
region3.put(key, value);
}
}
};
vm1.invoke(putKeys);
for (int i = 0; i < COUNT; i++) {
String key = keyPrefix + i;
String command = "locate entry";
command = command + " " + "--key=" + key + " --region=" + DATA_REGION_NAME_PATH + " --recursive=true";
CommandResult cmdResult = executeCommand(command);
printCommandOutput(cmdResult);
assertEquals(Result.Status.OK, cmdResult.getStatus());
validateResult(cmdResult, true);
// 3 Regions X 2 members = 6
validateLocationsResult(cmdResult, 6);
}
}
use of org.apache.geode.management.internal.cli.result.CommandResult in project geode by apache.
the class GemfireDataCommandsDUnitTest method testRebalanceCommandForSimulate.
@Test
public void testRebalanceCommandForSimulate() {
setupTestRebalanceForEntireDS();
// check if DistributedRegionMXBean is available so that command will not fail
final VM manager = Host.getHost(0).getVM(0);
manager.invoke(checkRegionMBeans);
getLogWriter().info("testRebalanceCommandForSimulate verified Mbean and executing command");
String command = "rebalance --simulate=true --include-region=" + "/" + REBALANCE_REGION_NAME;
CommandResult cmdResult = executeCommand(command);
getLogWriter().info("testRebalanceCommandForSimulate just after executing " + cmdResult);
if (cmdResult != null) {
String stringResult = commandResultToString(cmdResult);
getLogWriter().info("testRebalanceCommandForSimulate stringResult : " + stringResult);
assertEquals(Result.Status.OK, cmdResult.getStatus());
} else {
fail("testRebalanceCommandForSimulate failed as did not get CommandResult");
}
}
use of org.apache.geode.management.internal.cli.result.CommandResult in project geode by apache.
the class GemfireDataCommandsDUnitTest method testRebalanceForEntireDS.
// GEODE-1487
@Category(FlakyTest.class)
@Test
public void testRebalanceForEntireDS() {
setupTestRebalanceForEntireDS();
// check if DistributedRegionMXBean is available so that command will not fail
final VM manager = Host.getHost(0).getVM(0);
manager.invoke(checkRegionMBeans);
getLogWriter().info("testRebalanceForEntireDS verified Mbean and executin command");
String command = "rebalance";
CommandResult cmdResult = executeCommand(command);
getLogWriter().info("testRebalanceForEntireDS just after executing " + cmdResult);
if (cmdResult != null) {
String stringResult = commandResultToString(cmdResult);
getLogWriter().info("testRebalanceForEntireDS stringResult : " + stringResult);
assertEquals(Result.Status.OK, cmdResult.getStatus());
} else {
fail("testRebalanceForIncludeRegionFunction failed as did not get CommandResult");
}
}
use of org.apache.geode.management.internal.cli.result.CommandResult in project geode by apache.
the class GemfireDataCommandsDUnitTest method testRebalanceForIncludeRegionFunction.
@Test
public void testRebalanceForIncludeRegionFunction() {
// setup();
setupWith2Regions();
// check if DistributedRegionMXBean is available so that command will not fail
final VM manager = Host.getHost(0).getVM(0);
manager.invoke(checkRegionMBeans);
getLogWriter().info("testRebalanceForIncludeRegionFunction verified Mbean and executin command");
String command = "rebalance --include-region=" + "/" + REBALANCE_REGION_NAME + ",/" + REBALANCE_REGION2_NAME;
CommandResult cmdResult = executeCommand(command);
getLogWriter().info("testRebalanceForIncludeRegionFunction just after executing " + cmdResult);
if (cmdResult != null) {
String stringResult = commandResultToString(cmdResult);
getLogWriter().info("testRebalanceForIncludeRegionFunction stringResult : " + stringResult);
assertEquals(Result.Status.OK, cmdResult.getStatus());
} else {
fail("testRebalanceForIncludeRegionFunction failed as did not get CommandResult");
}
}
Aggregations