432433434435436437438439440441442
{ 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");
922923924925926927928929930931932
{ boolean caught = false; try { MBeanServer server = MBeanServerFactory.newMBeanServer(); server.registerMBean(new Test(), null); } catch (RuntimeOperationsException e) { if (e.getTargetException() instanceof IllegalArgumentException) caught = true;
944945946947948949950951952953954
{ 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;
966967968969970971972973974975976
{ 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;
988989990991992993994995996997998
{ 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;
11091110111111121113111411151116
public void testBasicUnregister() throws Exception { MBeanServer server = MBeanServerFactory.newMBeanServer(); ObjectName name = new ObjectName("test:foo=bar"); server.registerMBean(new Test(), name); server.unregisterMBean(name); }
11231124112511261127112811291130113111321133
try { MBeanServer server = MBeanServerFactory.newMBeanServer(); ObjectName name = new ObjectName(":foo=bar"); server.registerMBean(new Test(), name); server.unregisterMBean(name); } catch (InstanceNotFoundException e) {
11451146114711481149115011511152115311541155
try { MBeanServer server = MBeanServerFactory.newMBeanServer(); ObjectName name = new ObjectName(":foo=bar"); ObjectInstance oi = server.registerMBean(new Test(), name); name = oi.getObjectName(); server.unregisterMBean(name); }
128612871288128912901291129212931294
new ObjectName("JMImplementation:type=MBeanServerDelegate"), listener, filter, "MyHandback" ); // force notification server.registerMBean(new Test(), new ObjectName(":foo=bar")); assertTrue(listener.notificationCount == 1); }
1328132913301331133213331334133513361337
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); }