use of org.exoplatform.container.RootContainer in project kernel by exoplatform.
the class TestRootContainerManagedIntegration method _testExplicitObjectName.
public void _testExplicitObjectName() throws Exception {
RootContainer container = createRootContainer("configuration1.xml");
Object expectedObject = container.getComponentInstance("ManagedWithExplicitObjectName");
assertNotNull(expectedObject);
MBeanServer server = container.getMBeanServer();
assertNotNull(server);
Object object = server.getAttribute(ObjectName.getInstance("exo:object=ManagedWithExplicitObjectName"), "Reference");
assertNotNull(object);
assertEquals(expectedObject, object);
}
use of org.exoplatform.container.RootContainer in project kernel by exoplatform.
the class TestRootContainerManagedIntegration method testObjectNameTemplate.
public void testObjectNameTemplate() throws Exception {
RootContainer container = createRootContainer("configuration2.xml");
Object expectedFoo = container.getComponentInstance("Foo");
Object expectedBar = container.getComponentInstance("Bar");
assertNotNull(expectedFoo);
assertNotNull(expectedBar);
MBeanServer server = container.getMBeanServer();
assertNotNull(server);
Object foo = server.getAttribute(ObjectName.getInstance("exo:object=Foo"), "Reference");
assertNotNull(foo);
Object bar = server.getAttribute(ObjectName.getInstance("exo:object=Bar"), "Reference");
assertNotNull(bar);
assertEquals(expectedFoo, foo);
assertEquals(expectedBar, bar);
}
use of org.exoplatform.container.RootContainer in project kernel by exoplatform.
the class TestRootContainerManagedIntegration method _testObjectNameTemplateOverriddenByExplicitObjectName.
public void _testObjectNameTemplateOverriddenByExplicitObjectName() throws Exception {
RootContainer container = createRootContainer("configuration3.xml");
Object expectedObject = container.getComponentInstance("ManagedWithObjectNameTemplateOverriddenByExplicitObjectName");
assertNotNull(expectedObject);
MBeanServer server = container.getMBeanServer();
assertNotNull(server);
Object object = server.getAttribute(ObjectName.getInstance("exo:object=ManagedWithObjectNameTemplateOverriddenByExplicitObjectName"), "Reference");
assertNotNull(object);
assertEquals(expectedObject, object);
}
use of org.exoplatform.container.RootContainer in project kernel by exoplatform.
the class TestRootContainerManagedIntegration method testRootManagedRequestLifeCycle.
public void testRootManagedRequestLifeCycle() throws Exception {
RootContainer container = createRootContainer("configuration5.xml");
ManagedComponentRequestLifeCycle component = (ManagedComponentRequestLifeCycle) container.getComponentInstanceOfType(ManagedComponentRequestLifeCycle.class);
assertNotNull(component);
MBeanServer server = container.getMBeanServer();
server.invoke(new ObjectName("exo:object=ManagedComponentRequestLifeCycle"), "foo", new Object[0], new String[0]);
assertEquals(1, component.startCount);
assertEquals(1, component.fooCount);
assertEquals(1, component.endCount);
assertSame(container, component.startContainer);
assertSame(container, component.endContainer);
}
use of org.exoplatform.container.RootContainer in project kernel by exoplatform.
the class TestRootContainerManagedIntegration method testManagementAwareManagingOtherBeans.
public void testManagementAwareManagingOtherBeans() throws Exception {
RootContainer container = createRootContainer("configuration4.xml");
ManagedManagementAware aware = (ManagedManagementAware) container.getComponentInstance("ManagedManagementAware");
aware.context.register(new ManagedWithObjectNameTemplate("juu"));
container.getMBeanServer().getObjectInstance(new ObjectName("exo:object=juu"));
}
Aggregations