@Test public void checkNotRegistered() throws MalformedObjectNameException { MBeanServer jolokiaServer = JolokiaMBeanServerUtil.getJolokiaMBeanServer(); Assert.assertNotEquals(ManagementFactory.getPlatformMBeanServer(), jolokiaServer); for (MBeanServer server : MBeanServerFactory.findMBeanServer(null)) { Assert.assertNotEquals(server, jolokiaServer); } }
@Test public void registerMBean() throws MalformedObjectNameException, NotCompliantMBeanException, InstanceAlreadyExistsException, MBeanRegistrationException, InstanceNotFoundException { MBeanServer jolokiaServer = JolokiaMBeanServerUtil.getJolokiaMBeanServer(); Dummy test = new Dummy(); ObjectName name = new ObjectName("jolokia.test:name=test"); JolokiaMBeanServerUtil.registerMBean(test, name); assertTrue(jolokiaServer.isRegistered(name)); JolokiaMBeanServerUtil.unregisterMBean(name); Assert.assertFalse(jolokiaServer.isRegistered(name)); }