use of org.apache.webbeans.test.AbstractUnitTest in project openwebbeans by apache.
the class OwbRequestContextControllerTest method check.
@Test
public void check() {
startContainer();
final ContextsService cs = getWebBeansContext().getContextsService();
// it is started by AbstractUnitTest
cs.endContext(RequestScoped.class, null);
final RequestContextController controller = getInstance(RequestContextController.class);
assertNull(cs.getCurrentContext(RequestScoped.class));
assertTrue(controller.activate());
final RequestContextController i2 = getInstance(RequestContextController.class);
assertFalse(i2.activate());
final RequestContextController i3 = getInstance(RequestContextController.class);
assertFalse(i3.activate());
assertTrue(cs.getCurrentContext(RequestScoped.class).isActive());
i2.deactivate();
// skip i3 to ensure we deactivate by the "owner"
controller.deactivate();
assertNull(cs.getCurrentContext(RequestScoped.class));
}
Aggregations