use of org.apache.geode.management.internal.cli.remote.CommandProcessor in project geode by apache.
the class ConfigCommandsDUnitTest method testDescribeConfig.
@Test
public void testDescribeConfig() throws Exception {
setUpJmxManagerOnVm0ThenConnect(null);
final String controllerName = "Member2";
/*
* Create properties for the controller VM
*/
final Properties localProps = new Properties();
localProps.setProperty(MCAST_PORT, "0");
localProps.setProperty(LOG_LEVEL, "info");
localProps.setProperty(STATISTIC_SAMPLING_ENABLED, "true");
localProps.setProperty(ENABLE_TIME_STATISTICS, "true");
localProps.setProperty(NAME, controllerName);
localProps.setProperty(GROUPS, "G1");
getSystem(localProps);
Cache cache = getCache();
int[] ports = getRandomAvailableTCPPorts(1);
CacheServer cs = getCache().addCacheServer();
cs.setPort(ports[0]);
cs.setMaxThreads(10);
cs.setMaxConnections(9);
cs.start();
try {
RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean();
List<String> jvmArgs = runtimeBean.getInputArguments();
getLogWriter().info("#SB Actual JVM Args : ");
for (String jvmArg : jvmArgs) {
getLogWriter().info("#SB JVM " + jvmArg);
}
InternalDistributedSystem system = (InternalDistributedSystem) cache.getDistributedSystem();
DistributionConfig config = system.getConfig();
config.setArchiveFileSizeLimit(1000);
String command = CliStrings.DESCRIBE_CONFIG + " --member=" + controllerName;
CommandProcessor cmdProcessor = new CommandProcessor();
cmdProcessor.createCommandStatement(command, Collections.EMPTY_MAP).process();
CommandResult cmdResult = executeCommand(command);
String resultStr = commandResultToString(cmdResult);
getLogWriter().info("#SB Hiding the defaults\n" + resultStr);
assertEquals(true, cmdResult.getStatus().equals(Status.OK));
assertEquals(true, resultStr.contains("G1"));
assertEquals(true, resultStr.contains(controllerName));
assertEquals(true, resultStr.contains(ARCHIVE_FILE_SIZE_LIMIT));
assertEquals(true, !resultStr.contains("copy-on-read"));
cmdResult = executeCommand(command + " --" + CliStrings.DESCRIBE_CONFIG__HIDE__DEFAULTS + "=false");
resultStr = commandResultToString(cmdResult);
getLogWriter().info("#SB No hiding of defaults\n" + resultStr);
assertEquals(true, cmdResult.getStatus().equals(Status.OK));
assertEquals(true, resultStr.contains("is-server"));
assertEquals(true, resultStr.contains(controllerName));
assertEquals(true, resultStr.contains("copy-on-read"));
} finally {
cs.stop();
}
}
use of org.apache.geode.management.internal.cli.remote.CommandProcessor in project geode by apache.
the class MemberCommandsDUnitTest method testListMemberAll.
/**
* Tests the execution of "list member" command which should list out all the members in the DS
*
* @throws IOException
* @throws ClassNotFoundException
*/
@Test
public void testListMemberAll() throws IOException, ClassNotFoundException {
setupSystem();
CommandProcessor commandProcessor = new CommandProcessor();
Result result = commandProcessor.createCommandStatement(CliStrings.LIST_MEMBER, EMPTY_ENV).process();
getLogWriter().info("#SB" + getResultAsString(result));
assertEquals(true, result.getStatus().equals(Status.OK));
}
use of org.apache.geode.management.internal.cli.remote.CommandProcessor in project geode by apache.
the class MemberCommandsDUnitTest method testListMemberWithGroups.
/**
* Tests list member --group=G1
*
* @throws IOException
* @throws ClassNotFoundException
*/
@Test
public void testListMemberWithGroups() throws IOException, ClassNotFoundException {
setupSystem();
CommandProcessor commandProcessor = new CommandProcessor();
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.LIST_MEMBER);
csb.addOption(CliStrings.LIST_MEMBER__GROUP, "G1");
Result result = commandProcessor.createCommandStatement(csb.toString(), EMPTY_ENV).process();
getLogWriter().info("#SB" + getResultAsString(result));
assertEquals(true, result.getStatus().equals(Status.OK));
}
use of org.apache.geode.management.internal.cli.remote.CommandProcessor in project geode by apache.
the class MemberCommandsDUnitTest method testDescribeMember.
/**
* Tests the "describe member" command for all the members in the DS
*
* @throws IOException
* @throws ClassNotFoundException
*/
@Test
public void testDescribeMember() throws IOException, ClassNotFoundException {
setupSystem();
CommandProcessor commandProcessor = new CommandProcessor();
GemFireCacheImpl cache = (GemFireCacheImpl) CacheFactory.getAnyInstance();
Set<DistributedMember> members = cache.getDistributedSystem().getAllOtherMembers();
Iterator<DistributedMember> iters = members.iterator();
while (iters.hasNext()) {
DistributedMember member = iters.next();
Result result = commandProcessor.createCommandStatement("describe member --name=" + member.getId(), EMPTY_ENV).process();
assertEquals(true, result.getStatus().equals(Status.OK));
getLogWriter().info("#SB" + getResultAsString(result));
// assertIndexDetailsEquals(true, result.getStatus().equals(Status.OK));
}
}
use of org.apache.geode.management.internal.cli.remote.CommandProcessor in project geode by apache.
the class MemberCommandsDUnitTest method testListMemberWithNoCache.
/**
* Tests the execution of "list member" command, when no cache is created
*
* @throws IOException
* @throws ClassNotFoundException
*/
@Test
public void testListMemberWithNoCache() throws IOException, ClassNotFoundException {
final Host host = Host.getHost(0);
final VM[] servers = { host.getVM(0), host.getVM(1) };
final int[] openPorts = AvailablePortHelper.getRandomAvailableTCPPorts(1);
final File logFile = new File(getUniqueName() + "-locator" + openPorts[0] + ".log");
Locator locator = Locator.startLocator(openPorts[0], logFile);
try {
final Properties props = createProperties(host, openPorts[0]);
CommandProcessor commandProcessor = new CommandProcessor();
Result result = commandProcessor.createCommandStatement(CliStrings.LIST_MEMBER, EMPTY_ENV).process();
getLogWriter().info("#SB" + getResultAsString(result));
assertEquals(true, result.getStatus().equals(Status.ERROR));
} finally {
// fix for bug 46562
locator.stop();
}
}
Aggregations