409410411412413414415416417418419
{ try { MBeanServer server = MBeanServerFactory.newMBeanServer(); ObjectName name = new ObjectName("test:test=test"); server.registerMBean(new Test(), name); server.setAttribute(name, new Attribute("Error", "value")); // should not reach here fail("Error was not thrown");
899900901902903904905906907908909
{ boolean caught = false; try { MBeanServer server = MBeanServerFactory.newMBeanServer(); server.registerMBean(new Test(), null); } catch (RuntimeOperationsException e) { if (e.getTargetException() instanceof IllegalArgumentException) caught = true;
921922923924925926927928929930931
{ boolean caught = false; try { MBeanServer server = MBeanServerFactory.newMBeanServer(); server.registerMBean(new Test(), new ObjectName("Domai?:type=test")); } catch (RuntimeOperationsException e) { if (e.getTargetException() instanceof IllegalArgumentException) caught = true;
943944945946947948949950951952953
{ boolean caught = false; try { MBeanServer server = MBeanServerFactory.newMBeanServer(); server.registerMBean(new Test(), new ObjectName("JMImplementation:type=test")); } catch (RuntimeOperationsException e) { if (e.getTargetException() instanceof IllegalArgumentException) caught = true;
965966967968969970971972973974975
{ boolean caught = false; try { MBeanServer server = MBeanServerFactory.newMBeanServer("JMImplementation"); server.registerMBean(new Test(), new ObjectName(":type=test")); } catch (RuntimeOperationsException e) { if (e.getTargetException() instanceof IllegalArgumentException) caught = true;
10861087108810891090109110921093
public void testBasicUnregister() throws Exception { MBeanServer server = MBeanServerFactory.newMBeanServer(); ObjectName name = new ObjectName("test:foo=bar"); server.registerMBean(new Test(), name); server.unregisterMBean(name); }
11001101110211031104110511061107110811091110
try { MBeanServer server = MBeanServerFactory.newMBeanServer(); ObjectName name = new ObjectName(":foo=bar"); server.registerMBean(new Test(), name); server.unregisterMBean(name); } catch (InstanceNotFoundException e) {
11221123112411251126112711281129113011311132
try { MBeanServer server = MBeanServerFactory.newMBeanServer(); ObjectName name = new ObjectName(":foo=bar"); ObjectInstance oi = server.registerMBean(new Test(), name); name = oi.getObjectName(); server.unregisterMBean(name); }
126312641265126612671268126912701271
new ObjectName("JMImplementation:type=MBeanServerDelegate"), listener, filter, "MyHandback" ); // force notification server.registerMBean(new Test(), new ObjectName(":foo=bar")); assertTrue(listener.notificationCount == 1); }
1305130613071308130913101311131213131314
new ObjectName("JMImplementation:type=MBeanServerDelegate"), listener2, null, "handback2" ); // force notification server.registerMBean(new Test(), new ObjectName(":foo=bar")); assertTrue(listener1.result == 2); assertTrue(listener2.result == 2); }