public void testContexts() {
MockServletContext servletContext = new MockServletContext();
ServletLifecycle.beginApplication(servletContext);
MockHttpSession session = new MockHttpSession(servletContext);
MockHttpServletRequest request = new MockHttpServletRequest(session);
final ExternalContext externalContext = new MockExternalContext(
servletContext, request);
final Map sessionAdaptor = new ServletRequestSessionMap(request);
Map requestAdaptor = new ServletRequestMap(request);
Context appContext = new ApplicationContext(externalContext
.getApplicationMap());
installComponent(appContext, ConversationEntries.class);
installComponent(appContext, Manager.class);
appContext.set(Seam.getComponentName(Init.class), new Init());
FacesLifecycle.beginRequest(externalContext);
Manager.instance().setLongRunningConversation(true);
testContext(new ApplicationContext(externalContext.getApplicationMap()));
testContext(new SessionContext(sessionAdaptor));
testContext(new EventContext(requestAdaptor));
testContext(new ServerConversationContext(sessionAdaptor, "1"));
testEquivalence(new ContextCreator() {
public Context createContext() {
return new ServerConversationContext(sessionAdaptor, "1");
}
});
testEquivalence(new ContextCreator() {
public Context createContext() {
return new SessionContext(sessionAdaptor);
}
});
testEquivalence(new ContextCreator() {
public Context createContext() {
return new ApplicationContext(externalContext.getApplicationMap());
}
});
testIsolation(new ServerConversationContext(sessionAdaptor, "1"),
new ServerConversationContext(sessionAdaptor, "2"));
// testIsolation( new WebSessionContext(externalContext), new