MBeanServerConnectionFactoryBeanTests.java 文件源码

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

项目:spring4-understanding 作者:
@Test
public void testTestValidConnection() throws Exception {
    Assume.group(TestGroup.JMXMP);
    JMXConnectorServer connectorServer = getConnectorServer();
    connectorServer.start();

    try {
        MBeanServerConnectionFactoryBean bean = new MBeanServerConnectionFactoryBean();
        bean.setServiceUrl(serviceUrl);
        bean.afterPropertiesSet();

        try {
            MBeanServerConnection connection = bean.getObject();
            assertNotNull("Connection should not be null", connection);

            // perform simple MBean count test
            assertEquals("MBean count should be the same", getServer().getMBeanCount(), connection.getMBeanCount());
        } finally {
            bean.destroy();
        }
    } finally {
        connectorServer.stop();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号