//manager.setDaemon(false);
//manager.setThreaded(false);
//manager.setJMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9913/jmxrmi");
//manager.init();
AnnotationTestInstrumentation im = new AnnotationTestInstrumentation();
ObjectName name = new ObjectName("org.apache.cxf:type=foo,name=bar");
im.setName("John Smith");
manager.register(im, name);
Object val = manager.getMBeanServer().getAttribute(name, NAME_ATTRIBUTE);
assertEquals("Incorrect result", "John Smith", val);
try {
manager.register(im, name);
fail("Registering with existing name should fail.");
} catch (JMException jmex) {
//Expected
}
manager.register(im, name, true);
val = manager.getMBeanServer().getAttribute(name, NAME_ATTRIBUTE);
assertEquals("Incorrect result", "John Smith", val);
manager.unregister(name);
im.setName("Foo Bar");
name = manager.register(im);
val = manager.getMBeanServer().getAttribute(name, NAME_ATTRIBUTE);
assertEquals("Incorrect result", "Foo Bar", val);