public void testPlatformMBeanDeployment()
throws Exception
{
ManagementView mgtView = getManagementView();
//mgtView.reloadProfile();
ManagedDeployment mbeans = mgtView.getDeployment("JDK PlatformMBeans");
assertNotNull(mbeans);
log.debug("Root component names: "+mbeans.getComponents().keySet());
//
ManagedComponent clMC = mbeans.getComponent(ManagementFactory.CLASS_LOADING_MXBEAN_NAME);
assertNotNull(clMC);
ManagedComponent memoryMC = mbeans.getComponent(ManagementFactory.MEMORY_MXBEAN_NAME);
assertNotNull(memoryMC);
ManagedComponent osMC = mbeans.getComponent(ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME);
assertNotNull(osMC);
ManagedComponent runtimeMC = mbeans.getComponent(ManagementFactory.RUNTIME_MXBEAN_NAME);
assertNotNull(runtimeMC);
ManagedComponent threadMC = mbeans.getComponent(ManagementFactory.THREAD_MXBEAN_NAME);
assertNotNull(threadMC);
List<ManagedDeployment> submbeans = mbeans.getChildren();
assertNotNull(submbeans);
assertEquals("3", 3, submbeans.size());
HashMap<String, ManagedDeployment> map = new HashMap<String, ManagedDeployment>();
for(ManagedDeployment md : submbeans)
map.put(md.getName(), md);
// the garbage collector beans deployment
ManagedDeployment gcMD = map.get("GarbageCollectorMXBeans");
assertNotNull(gcMD);
Map<String, ManagedComponent> gcMCs = gcMD.getComponents();
assertNotNull(gcMCs);
assertTrue(gcMCs.size() > 0);
// the memory manager beans deployment
ManagedDeployment mmMD = map.get("MemoryManagerMXBeans");
assertNotNull(mmMD);
Map<String, ManagedComponent> mmMCs = mmMD.getComponents();
assertNotNull(mmMCs);
assertTrue(mmMCs.size() > 0);
// the memory pool beans deployment
ManagedDeployment mpoolMD = map.get("MemoryPoolMXBeans");
assertNotNull(mpoolMD);
Map<String, ManagedComponent> mpoolMCs = mpoolMD.getComponents();
assertNotNull(mpoolMCs);
assertTrue(mpoolMCs.size() > 0);
}