Package org.exoplatform.container

Examples of org.exoplatform.container.RootContainer


      URL portalURL = getClass().getResource("test-exo-container2.xml");
      assertNotNull(rootURL);
      assertNotNull(portalURL);
      //
      new ContainerBuilder().withRoot(rootURL).withPortal(portalURL).profiledBy("class").build();
      RootContainer root = RootContainer.getInstance();
      testIntegration(root);
   }
View Full Code Here


      URL portalURL = getClass().getResource("test-exo-container2.xml");
      assertNotNull(rootURL);
      assertNotNull(portalURL);
      //
      new ContainerBuilder().withRoot(rootURL).withPortal(portalURL).profiledBy("file").build();
      RootContainer root = RootContainer.getInstance();
      testIntegration(root);
   }
View Full Code Here

      URL portalURL = getClass().getResource("test-exo-container2.xml");
      assertNotNull(rootURL);
      assertNotNull(portalURL);
      //
      new ContainerBuilder().withRoot(rootURL).withPortal(portalURL).build();
      RootContainer root = RootContainer.getInstance();
      testIntegration(root);
      ComponentAdapter<H> adapterH = root.getComponentAdapterOfType(H.class);
      assertNull(adapterH);
      PortalContainer portal = PortalContainer.getInstance();
      adapterH = portal.getComponentAdapterOfType(H.class);
      assertNotNull(adapterH);
      H h = root.getComponentInstanceOfType(H.class);
      assertNull(h);
      h = portal.getComponentInstanceOfType(H.class);
      assertNotNull(h);
      assertSame(h, portal.getComponentInstanceOfType(H.class));
      assertSame(h, adapterH.getComponentInstance());
      List<ComponentAdapter<H>> adapters = root.getComponentAdaptersOfType(H.class);
      assertTrue(adapters == null || adapters.isEmpty());
      adapters = portal.getComponentAdaptersOfType(H.class);
      assertNotNull(adapters);
      assertEquals(1, adapters.size());
      assertSame(h, adapters.get(0).getComponentInstance());
      List<H> allH = root.getComponentInstancesOfType(H.class);
      assertTrue(allH == null || allH.isEmpty());
      allH = portal.getComponentInstancesOfType(H.class);
      assertNotNull(allH);
      assertEquals(1, allH.size());
      assertSame(h, allH.get(0));
View Full Code Here

{

   public void testProviderRegistration()
   {
      URL url = getClass().getResource("configuration1.xml");
      RootContainer container = new ContainerBuilder().withRoot(url).build();
      ManagementProviderImpl provider = (ManagementProviderImpl)container.getComponentInstanceOfType(ManagementProviderImpl.class);
      assertNotNull(provider);
   }
View Full Code Here

   }

   public void testManagedRegistrationAfterProviderRegistration()
   {
      URL url = getClass().getResource("configuration1.xml");
      RootContainer container = new ContainerBuilder().withRoot(url).build();
      ManagementProviderImpl provider = (ManagementProviderImpl)container.getComponentInstanceOfType(ManagementProviderImpl.class);
      assertEquals(1, provider.managedResources.size());
      Object foo = container.getComponentInstance("Foo");
      assertNotNull(foo);
      assertEquals(2, provider.managedResources.size());
      ManagedResource fooMR = provider.managedResources.get(1);
      assertSame(foo, fooMR.resource);
      assertEquals(Collections.<ScopedData>emptyList(), fooMR.context.getScopingData(ScopedData.class));
View Full Code Here

   }

   public void testManagedRegistrationBeforeProviderRegistration()
   {
      URL url = getClass().getResource("configuration2.xml");
      RootContainer container = new ContainerBuilder().withRoot(url).build();
      ManagementProviderImpl provider = (ManagementProviderImpl)container.getComponentInstanceOfType(ManagementProviderImpl.class);
      assertNull(provider);
      Object foo = container.getComponentInstance("Foo");
      assertNotNull(foo);
      provider = new ManagementProviderImpl();
      container.registerComponentInstance(provider);
      assertEquals(2, provider.managedResources.size());
      ManagedResource fooMR = provider.managedResources.get(1);
      assertSame(foo, fooMR.resource);
      assertEquals(Collections.<ScopedData>emptyList(), fooMR.context.getScopingData(ScopedData.class));
      fooMR.register();
View Full Code Here

   }

   public void testManagementAware()
   {
      URL url = getClass().getResource("configuration1.xml");
      RootContainer container = new ContainerBuilder().withRoot(url).build();
      ManagementProviderImpl provider = (ManagementProviderImpl)container.getComponentInstanceOfType(ManagementProviderImpl.class);
      Foo foo = (Foo)container.getComponentInstance("Foo");
      assertEquals(2, provider.managedResources.size());
      ManagedResource fooMR = provider.managedResources.get(1);
      fooMR.register();
      assertTrue(foo.isAware());
View Full Code Here

   public void testContainerScopedRegistration()
   {
      URL rootURL = getClass().getResource("root-configuration.xml");
      URL portal1URL = getClass().getResource("portal-configuration1.xml");
      URL portal2URL = getClass().getResource("portal-configuration2.xml");
      RootContainer root = new ContainerBuilder().withRoot(rootURL).withPortal("portal1", portal1URL).withPortal("portal2", portal2URL).build();
      Foo fooRoot = (Foo)root.getComponentInstanceOfType(Foo.class);
      ManagementProviderImpl provider = (ManagementProviderImpl)root.getComponentInstanceOfType(ManagementProviderImpl.class);
      PortalContainer portal1 = root.getPortalContainer("portal1");
      Foo fooPortal1 = (Foo)portal1.getComponentInstanceOfType(Foo.class);
      ManagementProviderImpl provider1 = (ManagementProviderImpl)portal1.getComponentInstanceOfType(ManagementProviderImpl.class);
      PortalContainer portal2 = root.getPortalContainer("portal2");
      Foo fooPortal2 = (Foo)portal2.getComponentInstanceOfType(Foo.class);
      ManagementProviderImpl provider2 = (ManagementProviderImpl)portal2.getComponentInstanceOfType(ManagementProviderImpl.class);

      //
      assertEquals(6, provider.managedResources.size());
View Full Code Here

   protected void setUp() throws Exception
   {
      super.setUp();

      // create new root each test to have portal container clear
      final RootContainer root = new RootContainer();
      SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
      {
         public Void run()
         {
            RootContainer singleton = RootContainer.getInstance();
            root.registerComponentInstance(ConfigurationManager.class,
               singleton.getComponentInstance(ConfigurationManager.class));
            root.start(true);
            return null;
         }
      });
View Full Code Here

public class TestManagedBy extends AbstractTestContainer
{

   public void testFoo() throws Exception
   {
      RootContainer root = createRootContainer("managedby-configuration.xml");

      MBeanServer server = root.getMBeanServer();

      ManagedByManager mbm = (ManagedByManager)root.getComponentInstance("ManagedByManager");

      assertNotNull(mbm);

      ObjectInstance instance = server.getObjectInstance(new ObjectName("exo:object=ManagedByManager"));
View Full Code Here

TOP

Related Classes of org.exoplatform.container.RootContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.