AdapterManager extends ComponentManagerImpl<Adapter> implements AdapterManagerMBean, AdapterRuntimeManager { @Override public void registerMBean() throws CoreException { registerSelf(); for (ChannelRuntimeManager c : channelManagers) { c.registerMBean(); } for (ChildRuntimeInfoComponent cmb : childRuntimeInfoComponents) { cmb.registerMBean(); } } private  AdapterManager();  AdapterManager(Adapter owner); @Override ObjectName createObjectName(); @Override long requestStartTime(); @Override long requestStopTime(); @Override Collection<ObjectName> getChildren(); @Override boolean addChild(ChannelRuntimeManager cmb); @Override boolean removeChild(ChannelRuntimeManager cmb); @Override boolean addChildren(Collection<ChannelRuntimeManager> coll); @Override boolean removeChildren(Collection<ChannelRuntimeManager> coll); @Override Adapter getWrappedComponent(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Override Collection<BaseComponentMBean> getAllDescendants(); @Override Collection<ObjectName> getChildRuntimeInfoComponents(); @Override boolean addChildJmxComponent(ChildRuntimeInfoComponent comp); @Override boolean removeChildJmxComponent(ChildRuntimeInfoComponent comp); @Override String createObjectHierarchyString(); @Override boolean addSharedConnection(String xmlString); @Override boolean addAndBindSharedConnection(String xmlString); @Override boolean removeSharedConnection(String connectionId); @Override boolean containsSharedConnection(String connectionId); @Override Collection<String> getSharedConnectionIds(); @Override boolean addSharedService(String xmlString); @Override boolean addAndBindSharedService(String xmlString); @Override boolean removeSharedService(String serviceId); @Override boolean containsSharedService(String serviceId); @Override Collection<String> getSharedServiceIds(); @Override boolean removeSharedComponent(String id); @Override ObjectName addChannel(String xml); @Override boolean removeChannel(String id); @Override void setMessageErrorHandler(String xml); @Override void setFailedMessageRetrier(String xml); @Override void registerMBean(); @Override void unregisterMBean(); @Override void childUpdated(); @Override String getAdapterBuildVersion(); @Override List<String> getModuleVersions(); @Override List<String> getArtifactIdentifiers(); @Override void sendLifecycleEvent(AdapterLifecycleEvent event); @Override MBeanNotificationInfo[] getNotificationInfo(); @Override void forceClose();  }
@Test public void testRegisterMBean() throws Exception { String adapterName = this.getClass().getSimpleName() + "." + getName(); Adapter adapter = createAdapter(adapterName); Channel channel = createChannel("c1"); Workflow workflow = createWorkflow("w1"); workflow.getInterceptors().add(new MessageMetricsInterceptor()); channel.getWorkflowList().add(workflow); adapter.getChannelList().add(channel); AdapterManager adapterManager = new AdapterManager(adapter); List<BaseComponentMBean> mBeans = new ArrayList<BaseComponentMBean>(); mBeans.add(adapterManager); mBeans.addAll(adapterManager.getAllDescendants()); try { adapterManager.registerMBean(); assertTrue(JmxHelper.findMBeanServer().isRegistered(adapterManager.createObjectName())); for (BaseComponentMBean baseMBean : adapterManager.getAllDescendants()) { assertTrue(JmxHelper.findMBeanServer().isRegistered(baseMBean.createObjectName())); } adapterManager.unregisterMBean(); assertFalse(JmxHelper.findMBeanServer().isRegistered(adapterManager.createObjectName())); for (BaseComponentMBean baseMBean : adapterManager.getAllDescendants()) { assertFalse(JmxHelper.findMBeanServer().isRegistered(baseMBean.createObjectName())); } register(mBeans); assertTrue(JmxHelper.findMBeanServer().isRegistered(adapterManager.createObjectName())); for (BaseComponentMBean baseMBean : adapterManager.getAllDescendants()) { assertTrue(JmxHelper.findMBeanServer().isRegistered(baseMBean.createObjectName())); } } finally { } }