MockHttpSession session = new MockHttpSession(servletContext);
MockHttpServletRequest request = new MockHttpServletRequest(session);
ExternalContext externalContext = new MockExternalContext(servletContext, request);
ContextAdaptor sessionAdaptor = new ServletSessionImpl(session);
ContextAdaptor requestAdaptor = new ServletRequestImpl(request);
Context appContext = new FacesApplicationContext(externalContext);
appContext.set(
Seam.getComponentName(ConversationEntries.class) + ".component",
new Component(ConversationEntries.class, appContext)
);
appContext.set(
Seam.getComponentName(Manager.class) + ".component",
new Component(Manager.class)
);
appContext.set( Seam.getComponentName(Init.class), new Init() );
Lifecycle.beginRequest(externalContext);
Manager.instance().setLongRunningConversation(true);
testContext( new FacesApplicationContext(externalContext) );
testContext( new WebSessionContext(sessionAdaptor) );
testContext( new WebRequestContext(requestAdaptor) );
testContext( new ServerConversationContext(sessionAdaptor, "1") );
testEquivalence( new ServerConversationContext(sessionAdaptor, "1"), new ServerConversationContext(sessionAdaptor, "1") );
testEquivalence( new WebSessionContext(sessionAdaptor), new WebSessionContext(sessionAdaptor) );
testEquivalence( new FacesApplicationContext(externalContext), new FacesApplicationContext(externalContext) );
testIsolation( new ServerConversationContext(sessionAdaptor, "1"), new ServerConversationContext(sessionAdaptor, "2") );
// testIsolation( new WebSessionContext(externalContext), new WebSessionContext( new MockExternalContext()) );
Lifecycle.endApplication(servletContext);
}