.extensions(
TestObserverOne.class,
TestObserverTwo.class,
TestObserverTree.class).create();
ManagerTestContext context = manager.getContext(ManagerTestContext.class);
try
{
context.activate();
context.getObjectStore().add(Object.class, new Object());
manager.fire("some string event");
Assert.assertTrue(manager.getExtension(TestObserverOne.class).wasCalled);
Assert.assertTrue(manager.getExtension(TestObserverTwo.class).wasCalled);
Assert.assertTrue(manager.getExtension(TestObserverTree.class).wasCalled);
Assert.assertNotNull(
"Verify instance was bound to context",
context.getObjectStore().get(Object.class));
ManagerTest2Context containerContext = manager.getContext(ManagerTest2Context.class);
Assert.assertFalse(containerContext.isActive());
containerContext.activate("A");
try
{
Assert.assertNotNull(
"Should have set a Double in container scope",
containerContext.getObjectStore().get(Double.class));
}
finally
{
containerContext.deactivate();
containerContext.destroy("A");
}
}
finally
{
context.deactivate();
context.destroy();
}
}