{
ManagementView mgtView = getManagementView();
mgtView.reload();
ComponentType type = new ComponentType("MCBean", "ServerInfo");
getLog().debug("MCBeans: "+mgtView.getComponentsForType(type));
ManagedComponent mc = mgtView.getComponent("jboss.system:type=ServerInfo", type);
assertNotNull(mc);
// Serach by alias for the jmx name
AliasMatcher matcher = new AliasMatcher();
Set<ManagedComponent> mcs = mgtView.getMatchingComponents("jboss.system:type=ServerInfo", type, matcher);
log.debug("jboss.system:type=ServerInfo components: "+mcs);
assertEquals("Found one MC for alias", 1, mcs.size());
Map<String, ManagedProperty> props = mc.getProperties();
getLog().info(props);
// , activeThreadGroupCount, hostAddress, OSVersion, javaVMName, totalMemory, activeThreadCount, alias, hostName, javaVMVendor, javaVendor, javaVMVersion, OSName, javaVersion
// maxMemory
ManagedProperty maxMemory = props.get("maxMemory");
long maxMemoryValue = getLong(maxMemory);
assertTrue("maxMemory > 1MB", maxMemoryValue > 1024*1024);
// freeMemory
ManagedProperty freeMemory = props.get("freeMemory");
long freeMemoryValue = getLong(freeMemory);
assertTrue("freeMemory > 1MB", freeMemoryValue > 1024*1024);
// TotalMemory
ManagedProperty totalMemory = props.get("totalMemory");
long totalMemoryValue = getLong(totalMemory);
assertTrue("totalMemory > 1MB", totalMemoryValue > 1024*1024);
// availableProcessors
ManagedProperty availableProcessors = props.get("availableProcessors");
long availableProcessorsValue = getLong(availableProcessors);
assertTrue("availableProcessors > 0", availableProcessorsValue > 0);
// ActiveThreadCount
ManagedProperty activeThreadCount = props.get("activeThreadCount");
long activeThreadCountValue = getLong(activeThreadCount);
assertTrue("activeThreadCount > 0", activeThreadCountValue > 0);
// ActiveThreadGroupCount
ManagedProperty activeThreadGroupCount = props.get("activeThreadGroupCount");
long activeThreadGroupCountValue = getLong(activeThreadGroupCount);
assertTrue("activeThreadGroupCount > 0", activeThreadGroupCountValue > 0);
// Operations
Set<ManagedOperation> ops = mc.getOperations();
log.info("ServerInfo.ops: "+ ops);
ManagedOperation listThreadCpuUtilization = ManagedOperationMatcher.findOperation(ops, "listThreadCpuUtilization");
assertNotNull(listThreadCpuUtilization);
MetaValue listThreadCpuUtilizationMV = listThreadCpuUtilization.invoke();
// TODO