MBeanServerFactory.releaseMBeanServer(server);
}
public void testFindMBeanServer() throws Exception
{
addPermission(new MBeanServerPermission("createMBeanServer"));
MBeanServer server = MBeanServerFactory.createMBeanServer();
try
{
MBeanServerFactory.findMBeanServer(null);
fail();
}
catch (SecurityException ignored)
{
}
addPermission(new MBeanServerPermission("findMBeanServer"));
ArrayList list = MBeanServerFactory.findMBeanServer(null);
if (!list.contains(server)) fail();
// Clean up
addPermission(new MBeanServerPermission("releaseMBeanServer"));
MBeanServerFactory.releaseMBeanServer(server);
}