AdapterManager extends ComponentManagerImpl<Adapter> implements AdapterManagerMBean, AdapterRuntimeManager { @Override public boolean addChild(ChannelRuntimeManager cmb) throws CoreException { return addChild(cmb, false); } 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 testAddChild() throws Exception { String adapterName = this.getClass().getSimpleName() + "." + getName(); Adapter adapter = createAdapter(adapterName); AdapterManager adapterManager = new AdapterManager(adapter); Channel c1 = createChannel(getName() + "_1"); Channel c2 = createChannel(getName() + "_2"); ChannelManager child1 = new ChannelManager(c1, adapterManager); ChannelManager child2 = new ChannelManager(c2, adapterManager); assertEquals(2, adapterManager.getChildren().size()); try { adapterManager.addChild(child1); } catch (IllegalArgumentException expected) { assertTrue(expected.getMessage().startsWith("duplicate Channel ID")); } assertEquals(2, adapterManager.getChildren().size()); try { adapterManager.addChild(null); fail(); } catch (IllegalArgumentException expected) { } assertEquals(2, adapterManager.getChildren().size()); assertEquals(2, adapter.getChannelList().size()); Adapter marshalledAdapter = (Adapter) new XStreamMarshaller().unmarshal(adapterManager.getConfiguration()); assertRoundtripEquality(adapter, marshalledAdapter); }