Search in sources :

Example 6 with ContainerBuilder

use of org.exoplatform.container.ContainerBuilder in project kernel by exoplatform.

the class TestManagementProvider method testManagedRegistrationBeforeProviderRegistration.

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();
    assertEquals(Collections.singletonList(fooMR.data), fooMR.context.getScopingData(ScopedData.class));
}
Also used : ContainerBuilder(org.exoplatform.container.ContainerBuilder) RootContainer(org.exoplatform.container.RootContainer) URL(java.net.URL)

Example 7 with ContainerBuilder

use of org.exoplatform.container.ContainerBuilder in project kernel by exoplatform.

the class TestSpringContainer method testIntegrationClass.

public void testIntegrationClass() {
    URL rootURL = getClass().getResource("test-exo-container.xml");
    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);
}
Also used : ContainerBuilder(org.exoplatform.container.ContainerBuilder) RootContainer(org.exoplatform.container.RootContainer) URL(java.net.URL)

Example 8 with ContainerBuilder

use of org.exoplatform.container.ContainerBuilder in project kernel by exoplatform.

the class TestSpringContainer method testIntegrationFile.

public void testIntegrationFile() {
    URL rootURL = getClass().getResource("test-exo-container.xml");
    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);
}
Also used : ContainerBuilder(org.exoplatform.container.ContainerBuilder) RootContainer(org.exoplatform.container.RootContainer) URL(java.net.URL)

Example 9 with ContainerBuilder

use of org.exoplatform.container.ContainerBuilder in project kernel by exoplatform.

the class TestXSD_1_1 method testInitParams.

public void testInitParams() throws Exception {
    URL url = getClass().getResource("../../../../xsd_1_1/test-validation.xml");
    assertNotNull(url);
    RootContainer container = new ContainerBuilder().withRoot(url).build();
    container.getComponentInstanceOfType(TestValidation.class);
}
Also used : ContainerBuilder(org.exoplatform.container.ContainerBuilder) RootContainer(org.exoplatform.container.RootContainer) URL(java.net.URL)

Example 10 with ContainerBuilder

use of org.exoplatform.container.ContainerBuilder in project kernel by exoplatform.

the class TestXSD_1_2 method testInitParams.

public void testInitParams() throws Exception {
    URL url = getClass().getResource("../../../../xsd_1_2/test-validation.xml");
    assertNotNull(url);
    RootContainer container = new ContainerBuilder().withRoot(url).build();
    container.getComponentInstanceOfType(TestValidation.class);
}
Also used : ContainerBuilder(org.exoplatform.container.ContainerBuilder) RootContainer(org.exoplatform.container.RootContainer) URL(java.net.URL)

Aggregations

URL (java.net.URL)15 ContainerBuilder (org.exoplatform.container.ContainerBuilder)15 RootContainer (org.exoplatform.container.RootContainer)14 PortalContainer (org.exoplatform.container.PortalContainer)4 ComponentAdapter (org.exoplatform.container.spi.ComponentAdapter)2 SimpleManagementAware (org.exoplatform.container.jmx.support.SimpleManagementAware)1 ManagementContextImpl (org.exoplatform.container.management.ManagementContextImpl)1