use of org.junit.experimental.categories.Category in project geode by apache.
the class IndexCommandsDUnitTest method testDestroyIndexWithoutIndexName.
// GEODE-1315
@Category(FlakyTest.class)
@Test
public void testDestroyIndexWithoutIndexName() {
setupSystem();
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_INDEX);
csb.addOption(CliStrings.CREATE_INDEX__NAME, indexName);
csb.addOption(CliStrings.CREATE_INDEX__EXPRESSION, "key");
csb.addOption(CliStrings.CREATE_INDEX__REGION, "/StocksParReg");
csb.addOption(CliStrings.CREATE_INDEX__TYPE, "hash");
String commandString = csb.toString();
CommandResult commandResult = executeCommand(commandString);
String resultAsString = commandResultToString(commandResult);
assertEquals(commandResult.getStatus(), Status.OK);
csb = new CommandStringBuilder(CliStrings.LIST_INDEX);
commandString = csb.toString();
commandResult = executeCommand(commandString);
resultAsString = commandResultToString(commandResult);
assertEquals(Status.OK, commandResult.getStatus());
assertEquals(true, resultAsString.contains(indexName));
assertEquals(true, resultAsString.contains(VM1Name));
csb = new CommandStringBuilder(CliStrings.DESTROY_INDEX);
csb.addOption(CliStrings.DESTROY_INDEX__GROUP, group1);
commandString = csb.toString();
commandResult = executeCommand(commandString);
resultAsString = commandResultToString(commandResult);
assertEquals(Status.OK, commandResult.getStatus());
csb = new CommandStringBuilder(CliStrings.LIST_INDEX);
commandString = csb.toString();
commandResult = executeCommand(commandString);
resultAsString = commandResultToString(commandResult);
assertEquals(Status.OK, commandResult.getStatus());
csb = new CommandStringBuilder(CliStrings.CREATE_INDEX);
csb.addOption(CliStrings.CREATE_INDEX__NAME, indexName);
csb.addOption(CliStrings.CREATE_INDEX__EXPRESSION, "key");
csb.addOption(CliStrings.CREATE_INDEX__REGION, "/StocksParReg");
csb.addOption(CliStrings.CREATE_INDEX__TYPE, "hash");
commandString = csb.toString();
commandResult = executeCommand(commandString);
resultAsString = commandResultToString(commandResult);
assertEquals(Status.OK, commandResult.getStatus());
csb = new CommandStringBuilder(CliStrings.DESTROY_INDEX);
csb.addOption(CliStrings.DESTROY_INDEX__REGION, "StocksParReg");
commandString = csb.toString();
commandResult = executeCommand(commandString);
resultAsString = commandResultToString(commandResult);
assertEquals(Status.OK, commandResult.getStatus());
csb = new CommandStringBuilder(CliStrings.LIST_INDEX);
commandString = csb.toString();
commandResult = executeCommand(commandString);
resultAsString = commandResultToString(commandResult);
assertEquals(Status.OK, commandResult.getStatus());
assertTrue(resultAsString.contains(CliStrings.LIST_INDEX__INDEXES_NOT_FOUND_MESSAGE));
}
use of org.junit.experimental.categories.Category in project geode by apache.
the class ListAndDescribeRegionDUnitTest method testDescribeRegionWithCompressionCodec.
/**
* Asserts that a describe region command issued on a region with compression returns the correct
* non default region attribute for compression and the correct codec value.
*/
// GEODE-1033: HeadlesssGFSH, random port, Snappy dependency
@Category(FlakyTest.class)
@Test
public void testDescribeRegionWithCompressionCodec() {
final String regionName = "compressedRegion";
VM vm = Host.getHost(0).getVM(1);
setupSystem();
// Create compressed region
vm.invoke(new SerializableRunnable() {
@Override
public void run() {
createCompressedRegion(regionName);
}
});
// Test the describe command; look for compression
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.DESCRIBE_REGION);
csb.addOption(CliStrings.DESCRIBE_REGION__NAME, regionName);
String commandString = csb.toString();
CommandResult commandResult = executeCommand(commandString);
String commandResultAsString = commandResultToString(commandResult);
assertEquals(Status.OK, commandResult.getStatus());
assertTrue(commandResultAsString.contains(regionName));
assertTrue(commandResultAsString.contains(RegionAttributesNames.COMPRESSOR));
assertTrue(commandResultAsString.contains(RegionEntryContext.DEFAULT_COMPRESSION_PROVIDER));
// Destroy compressed region
vm.invoke(new SerializableRunnable() {
@Override
public void run() {
Region region = getCache().getRegion(regionName);
assertNotNull(region);
region.destroyRegion();
}
});
}
use of org.junit.experimental.categories.Category in project geode by apache.
the class MiscellaneousCommandsDUnitTest method testShutDownForTIMEOUT.
// GEODE-1385, 1518: time sensitive, HeadlessGfsh
@Category(FlakyTest.class)
@Test
public void testShutDownForTIMEOUT() {
setupForShutDown();
ThreadUtils.sleep(2500);
final VM vm0 = Host.getHost(0).getVM(0);
vm0.invoke(new SerializableRunnable() {
public void run() {
System.setProperty("ThrowTimeoutException", "true");
}
});
String command = "shutdown --time-out=15";
CommandResult cmdResult = executeCommand(command);
if (cmdResult != null) {
String cmdResultStr = commandResultToString(cmdResult);
getLogWriter().info("testShutDownForTIMEOUT cmdResultStr = " + cmdResultStr);
CommandResult result = (CommandResult) ResultBuilder.createInfoResult(CliStrings.SHUTDOWN_TIMEDOUT);
String expectedResult = commandResultToString(result);
assertEquals(expectedResult, cmdResultStr);
}
vm0.invoke(new SerializableRunnable() {
public void run() {
System.clearProperty("ThrowTimeoutException");
}
});
}
use of org.junit.experimental.categories.Category in project geode by apache.
the class MiscellaneousCommandsDUnitTest method testChangeLogLevelForMembers.
// GEODE-1605
@Category(FlakyTest.class)
@Test
public void testChangeLogLevelForMembers() {
final VM vm0 = Host.getHost(0).getVM(0);
final VM vm1 = Host.getHost(0).getVM(1);
setupForChangeLogLelvel();
String serverName1 = (String) vm0.invoke(new SerializableCallable() {
@Override
public Object call() throws Exception {
cachedLogLevel = System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "log-level");
return GemFireCacheImpl.getInstance().getDistributedSystem().getDistributedMember().getId();
}
});
String serverName2 = (String) vm1.invoke(new SerializableCallable() {
@Override
public Object call() throws Exception {
cachedLogLevel = System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "log-level");
return GemFireCacheImpl.getInstance().getDistributedSystem().getDistributedMember().getId();
}
});
String commandString = CliStrings.CHANGE_LOGLEVEL + " --" + CliStrings.CHANGE_LOGLEVEL__LOGLEVEL + "=finer" + " --" + CliStrings.CHANGE_LOGLEVEL__MEMBER + "=" + serverName1 + "," + serverName2;
CommandResult commandResult = executeCommand(commandString);
getLogWriter().info("testChangeLogLevel commandResult=" + commandResult);
assertTrue(Status.OK.equals(commandResult.getStatus()));
CompositeResultData resultData = (CompositeResultData) commandResult.getResultData();
SectionResultData section = resultData.retrieveSection("section");
assertNotNull(section);
TabularResultData tableRsultData = section.retrieveTable("ChangeLogLevel");
assertNotNull(tableRsultData);
List<String> columns = tableRsultData.retrieveAllValues(CliStrings.CHANGE_LOGLEVEL__COLUMN_MEMBER);
List<String> status = tableRsultData.retrieveAllValues(CliStrings.CHANGE_LOGLEVEL__COLUMN_STATUS);
assertEquals(columns.size(), 2);
assertEquals(status.size(), 2);
assertTrue(columns.contains(serverName1));
assertTrue(columns.contains(serverName2));
assertTrue(status.contains("true"));
}
use of org.junit.experimental.categories.Category in project geode by apache.
the class GemfireDataCommandsDUnitTest method testSimulateForEntireDS.
// GEODE-1561
@Category(FlakyTest.class)
@Test
public void testSimulateForEntireDS() {
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("testSimulateForEntireDS verified MBean and executing command");
String command = "rebalance --simulate=true";
CommandResult cmdResult = executeCommand(command);
getLogWriter().info("testSimulateForEntireDS just after executing " + cmdResult);
if (cmdResult != null) {
String stringResult = commandResultToString(cmdResult);
getLogWriter().info("testSimulateForEntireDS stringResult : " + stringResult);
assertEquals(Result.Status.OK, cmdResult.getStatus());
} else {
fail("testRebalanceForIncludeRegionFunction failed as did not get CommandResult");
}
}
Aggregations