use of org.apache.webbeans.spi.ContextsService in project deltaspike by apache.
the class OpenWebBeansContextControl method stopConversationScope.
private void stopConversationScope() {
ContextsService contextsService = getContextsService();
contextsService.endContext(ConversationScoped.class, null);
}
use of org.apache.webbeans.spi.ContextsService in project deltaspike by apache.
the class OpenWebBeansContextControl method stopSessionScope.
private void stopSessionScope() {
ContextsService contextsService = getContextsService();
Object mockSession = null;
if (isServletApiAvailable()) {
mockSession = mockSessions.get();
mockSessions.set(null);
mockSessions.remove();
}
contextsService.endContext(SessionScoped.class, mockSession);
}
use of org.apache.webbeans.spi.ContextsService in project deltaspike by apache.
the class OpenWebBeansContextControl method startSingletonScope.
/*
* start scopes
*/
private void startSingletonScope() {
ContextsService contextsService = getContextsService();
Object mockServletContext = null;
if (isServletApiAvailable()) {
mockServletContext = OwbHelper.getMockServletContext();
}
contextsService.startContext(Singleton.class, mockServletContext);
}
use of org.apache.webbeans.spi.ContextsService in project deltaspike by apache.
the class OpenWebBeansContextControl method stopApplicationScope.
private void stopApplicationScope() {
ContextsService contextsService = getContextsService();
Object mockServletContext = null;
if (isServletApiAvailable()) {
mockServletContext = OwbHelper.getMockServletContext();
}
contextsService.endContext(ApplicationScoped.class, mockServletContext);
}
use of org.apache.webbeans.spi.ContextsService in project tomee by apache.
the class EnsureRequestScopeThreadLocalIsCleanUpTest method runAndCheckThreadLocal.
@Test
public void runAndCheckThreadLocal() throws Exception {
final ApplicationComposers composers = new ApplicationComposers(EnsureRequestScopeThreadLocalIsCleanUpTest.class);
composers.before(this);
final CdiAppContextsService contextsService = CdiAppContextsService.class.cast(WebBeansContext.currentInstance().getService(ContextsService.class));
assertNotNull(contextsService.getCurrentContext(RequestScoped.class));
assertNotNull(contextsService.getCurrentContext(SessionScoped.class));
composers.after();
assertNull(contextsService.getCurrentContext(RequestScoped.class));
assertNull(contextsService.getCurrentContext(SessionScoped.class));
}
Aggregations