@Test()
public void testRegisterMBean() {
MBeanServer mBeanServer = MBeanManagementFactory.getMBeanServer();
initialMBeanCount = mBeanServer.getMBeanCount();
MBeanRegistrator.registerMBean(new CarbonRuntimeService(new RuntimeManager()));
Assert.assertTrue(mBeanServer.getMBeanCount() == initialMBeanCount + 1);
String className = new CarbonRuntimeService(new RuntimeManager()).getClass().getName();
if (className.indexOf('.') != -1) {
className = className.substring(className.lastIndexOf('.') + 1);
}
String objectName = Constants.SERVER_PACKAGE + ":type=" + className;
try {
Assert.assertNotNull(mBeanServer.getMBeanInfo(new ObjectName(objectName)));
} catch (MalformedObjectNameException | InstanceNotFoundException | IntrospectionException |
ReflectionException e) {
log.error("Error when retrieving mBean Inforation", e);
}
}
MBeanRegistratorTest.java 文件源码
java
阅读 18
收藏 0
点赞 0
评论 0
项目:carbon-kernel
作者:
评论列表
文章目录