/**
* Tests the registration of MBeans via contribution
*/
public void testContribution() throws Exception
{
Registry registry = buildFrameworkRegistry("testMBeanRegistry.xml");
List mBeanList = registry.getConfiguration("hivemind.management.MBeans");
// Training
ServicePoint sp1 = ((MBeanRegistrationContribution) mBeanList.get(0)).getServicePoint();
Object mBean1 = registry.getService("test.management.MBean1", Runnable.class);
ObjectName on1 = objectNameBuilder.createServiceObjectName(sp1);
server.registerMBean(mBean1, on1);
serverControl.setReturnValue(new ObjectInstance(on1, mBean1.getClass().getName()));
ObjectName on2 = new ObjectName("hivemind:name=bean1");
server.registerMBean(mBean1, on2);
serverControl.setReturnValue(new ObjectInstance(on1, mBean1.getClass().getName()));
replayControls();
new MBeanRegistryImpl(errorHandler, log, server, objectNameBuilder, mBeanList);
verifyControls();
assertTrue("start method has not been called", ((MBeanTestService) mBean1).isStartCalled());
registry.shutdown();
}