ExoContainer extends AbstractContainer { public synchronized void start(boolean init) { if (init) { initialize(); } start(); } 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 testStart() { URL rootURL = getClass().getResource("test-exo-container.xml"); URL portalURL = getClass().getResource("empty-config.xml"); assertNotNull(rootURL); assertNotNull(portalURL); new ContainerBuilder().withRoot(rootURL).withPortal(portalURL).profiledBy("testStart").build(); RootContainer container = RootContainer.getInstance(); PortalContainer pcontainer = PortalContainer.getInstance(); container.stop(); container.dispose(); assertNotNull(container.getComponentInstanceOfType(TS1.class)); assertNotNull(container.getComponentInstanceOfType(TS2.class)); assertNotNull(container.getComponentInstanceOfType(TS3.class)); assertNotNull(container.getComponentInstanceOfType(TS4.class)); assertNotNull(pcontainer.getComponentInstanceOfType(TS1.class)); assertNotNull(pcontainer.getComponentInstanceOfType(TS2.class)); assertNotNull(pcontainer.getComponentInstanceOfType(TS3.class)); assertNotNull(pcontainer.getComponentInstanceOfType(TS4.class)); TS1 ts1rc = container.getComponentInstanceOfType(TS1.class); TS1 ts1pc = pcontainer.getComponentInstanceOfType(TS1.class); assertSame(ts1rc, ts1pc); assertEquals(1, ts1pc.started); assertEquals(1, ts1pc.stopped); TS2 ts2rc = container.getComponentInstanceOfType(TS2.class); TS2 ts2pc = pcontainer.getComponentInstanceOfType(TS2.class); assertSame(ts2rc, ts2pc); assertEquals(1, ts2rc.disposed); TS3 ts3rc = container.getComponentInstanceOfType(TS3.class); TS3 ts3pc = pcontainer.getComponentInstanceOfType(TS3.class); assertNotSame(ts3rc, ts3pc); assertEquals(1, ts3rc.started); assertEquals(1, ts3pc.started); assertEquals(1, ts3rc.stopped); assertEquals(1, ts3pc.stopped); TS4 ts4rc = container.getComponentInstanceOfType(TS4.class); TS4 ts4pc = pcontainer.getComponentInstanceOfType(TS4.class); assertNotSame(ts4rc, ts4pc); assertEquals(1, ts4rc.disposed); assertEquals(1, ts4pc.disposed); }