use of org.exoplatform.container.management.ManagementContextImpl in project kernel by exoplatform.
the class TestPortalContainerManagedIntegration method testManagementContext.
public void testManagementContext() {
URL rootURL = TestPortalContainerManagedIntegration.class.getResource("root-configuration.xml");
URL portalURL = TestPortalContainerManagedIntegration.class.getResource("portal-configuration.xml");
//
RootContainer root = new ContainerBuilder().withRoot(rootURL).withPortal(portalURL).build();
ManagementContextImpl rootManagementContext = (ManagementContextImpl) root.getManagementContext();
//
PortalContainer portal = PortalContainer.getInstance();
ManagementContextImpl portalManagementContext = (ManagementContextImpl) portal.getManagementContext();
assertSame(root.getManagementContext(), portalManagementContext.getParent());
assertNotNull(portalManagementContext.findContainer());
//
SimpleManagementAware rootManagementAware = (SimpleManagementAware) root.getComponentInstance("RootManagementAware");
ManagementContextImpl rootManagementAwareContext = (ManagementContextImpl) rootManagementAware.context;
assertSame(rootManagementContext, rootManagementAwareContext.getParent());
//
SimpleManagementAware portalManagementAware = (SimpleManagementAware) portal.getComponentInstance("PortalManagementAware");
ManagementContextImpl portalManagementAwareContext = (ManagementContextImpl) portalManagementAware.context;
assertSame(portalManagementContext, portalManagementAwareContext.getParent());
}
Aggregations