AnnotationTest.java 文件源码

java
阅读 30 收藏 0 点赞 0 评论 0

项目:openjdk-jdk10 作者:
public static void main(String[] args) throws Exception {
    System.out.println("Testing that annotations are correctly " +
                       "reflected in Descriptor entries");

    MBeanServer mbs =
        java.lang.management.ManagementFactory.getPlatformMBeanServer();
    ObjectName on = new ObjectName("a:b=c");

    Thing thing = new Thing();
    mbs.registerMBean(thing, on);
    check(mbs, on);
    mbs.unregisterMBean(on);

    ThingImpl thingImpl = new ThingImpl();
    mbs.registerMBean(thingImpl, on);
    Descriptor d = mbs.getMBeanInfo(on).getDescriptor();
    if (!d.getFieldValue("mxbean").equals("true")) {
        System.out.println("NOT OK: expected MXBean");
        failed = "Expected MXBean";
    }
    check(mbs, on);

    if (failed == null)
        System.out.println("Test passed");
    else
        throw new Exception("TEST FAILED: " + failed);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号