ExoContainer extends AbstractContainer { protected Collection<ExternalComponentPlugins> getExternalComponentPluginsUnused() { Configuration configuration = getConfiguration(); if (configuration == null) return null; Collection<ExternalComponentPlugins> result = null; for (Iterator<ExternalComponentPlugins> it = configuration.getExternalComponentPluginsIterator(); it.hasNext();) { ExternalComponentPlugins plugins = it.next(); boolean toAdd = false; String target = plugins.getTargetComponent(); if (target == null) toAdd = true; else if (configuration.getComponent(target) == null) { try { Class<?> c = ClassLoading.loadClass(target, ExoContainer.class); if (c.isAnnotation()) { } else if (getComponentAdapterOfType(c) == null) { toAdd = true; } } catch (ClassNotFoundException e) { if (LOG.isTraceEnabled()) LOG.trace("The class {} could not be found", target); } } if (toAdd) { if (result == null) { result = new ArrayList<ExternalComponentPlugins>(); } result.add(plugins); } } return result; } ExoContainer();  ExoContainer(ExoContainer parent); static Set<String> getProfilesFromProperty(); static Set<String> getProfiles(); static boolean hasProfileInProperty(String profileName); static boolean hasProfile(String profileName); ExoContainerContext getContext(); synchronized void dispose(); synchronized void start(boolean init); synchronized void initialize(); synchronized void start(); synchronized void stop(); void addComponentLifecylePlugin(ComponentLifecyclePlugin plugin); void addContainerLifecylePlugin(ContainerLifecyclePlugin plugin); ComponentAdapter<T> registerComponentImplementation(Class<T> componentImplementation); ComponentAdapter<T> registerComponentInstance(T componentInstance); T createComponent(Class<T> clazz); ComponentAdapter<?> getComponentAdapter(Object componentKey); Object getComponentInstance(Object componentKey); @Managed @ManagedName("RegisteredComponentNames") @ManagedDescription("Return the list of the registered component names") Set<String> getRegisteredComponentNames(); ExoContainer getParent(); boolean canBeStarted(); boolean canBeStopped(); boolean canBeDisposed(); ContextManager getContextManager(); boolean isContextManagerLoaded(); T getComponentInstanceOfType(Class<T> componentType); T getComponentInstanceOfType(Class<T> componentType, boolean autoRegistration); ComponentAdapter<T> getComponentAdapterOfType(Class<T> componentType); ComponentAdapter<T> getComponentAdapterOfType(Class<T> componentType, boolean autoRegistration); T getComponentInstance(Object componentKey, Class<T> bindType); T getComponentInstance(Object componentKey, Class<T> bindType, boolean autoRegistration); ComponentAdapter<T> getComponentAdapter(Object componentKey, Class<T> bindType); ComponentAdapter<T> getComponentAdapter(Object componentKey, Class<T> bindType, boolean autoRegistration);  }
@Test public void testGetExternalComponentPluginsUnused() { final URL rootURL = getClass().getResource("empty-config.xml"); final URL portalURL = getClass().getResource("test-exo-container.xml"); assertNotNull(rootURL); assertNotNull(portalURL); new ContainerBuilder().withRoot(rootURL).withPortal(portalURL).build(); ExoContainer container = PortalContainer.getInstance(); assertNull(container.getExternalComponentPluginsUnused()); new ContainerBuilder().withRoot(rootURL).withPortal(portalURL) .profiledBy("testGetExternalComponentPluginsUnused").build(); container = PortalContainer.getInstance(); assertNotNull(container.getExternalComponentPluginsUnused()); assertEquals(1, container.getExternalComponentPluginsUnused().size()); new ContainerBuilder().withRoot(rootURL).withPortal(portalURL).profiledBy("testAutoRegistration").build(); container = PortalContainer.getInstance(); assertNull(container.getExternalComponentPluginsUnused()); new ContainerBuilder().withRoot(rootURL).withPortal(portalURL) .profiledBy("testAutoRegistration", "testGetExternalComponentPluginsUnused").build(); container = PortalContainer.getInstance(); assertNotNull(container.getExternalComponentPluginsUnused()); assertEquals(1, container.getExternalComponentPluginsUnused().size()); }