public void testSimultaneousTypedAndDetypedInvocations() throws Exception
{
MBeanServer server = MBeanServerFactory.createMBeanServer();
ObjectName oname = new ObjectName("test:test=test");
Trivial2MBean mbean = (Trivial2MBean)MBeanProxy.create(
Trivial2.class, Trivial2MBean.class, oname,server
);
// typed proxy interface
mbean.setSomething("Kissa");
assertTrue(mbean.getSomething().equals("Kissa"));
// detyped proxy interface
DynamicMBean mbean2 = (DynamicMBean)mbean;
mbean2.setAttribute(new Attribute("Something", "Koira"));
assertTrue(mbean2.getAttribute("Something").equals("Koira"));
// direct local server invocation
server.setAttribute(oname, new Attribute("Something", "Kissa"));
assertTrue(server.getAttribute(oname, "Something").equals("Kissa"));
// typed proxy interface invocation
mbean.doOperation();
assertTrue(mbean.isOperationInvoked());
mbean.reset();
// detyped proxy invocation
mbean2.invoke("doOperation", null, null);
assertTrue(((Boolean)mbean2.getAttribute("OperationInvoked")).booleanValue());