public Result testRoleNotFound() throws Exception {
MBeanServer server = MBeanServerFactory.createMBeanServer();
ObjectName unitName = new ObjectName("a:b=c");
server.registerMBean(new Unit(), unitName);
RelationService rService = new RelationService(true);
server.registerMBean(rService, new ObjectName("a:b=d"));
RoleInfo[] rInfo = { new RoleInfo("role", classPath) };
rService.createRelationType("relationType", rInfo);
RoleList unitRoles = new RoleList();
/* role name differs from role info contains */
unitRoles.add(new Role("another role", Collections
.singletonList(unitName)));
/* catch RoleNotFoundException */
try {
rService.createRelation("relation", "relationType", unitRoles);
return failed("");
} catch (RoleNotFoundException e) {
return passed();
} catch (Throwable t) {
return failed(t.toString());
}
}
java类javax.management.relation.RoleNotFoundException的实例源码
StructureTest.java 文件源码
项目:freeVM
阅读 19
收藏 0
点赞 0
评论 0
ERelationMBean.java 文件源码
项目:freeVM
阅读 23
收藏 0
点赞 0
评论 0
void unregisterMBean(ObjectName mBeanName, String roleName)
throws RoleNotFoundException, InvalidRoleValueException,
RelationServiceNotRegisteredException,
RelationTypeNotFoundException, RelationNotFoundException,
IllegalArgumentException;