public void testRegisterMBean() throws Exception
{
addPermission(new MBeanServerPermission("newMBeanServer"));
MBeanServer server = MBeanServerFactory.newMBeanServer();
MBeanServerDelegate mbean = new MBeanServerDelegate();
ObjectName name = new ObjectName(server.getDefaultDomain(), "name", "test");
try
{
server.registerMBean(mbean, name);
fail();
}
catch (SecurityException ignored)
{
}
addPermission(new MBeanPermission(mbean.getClass().getName() + "[" + name.getCanonicalName() + "]", "registerMBean"));
server.registerMBean(mbean, name);
}