use of com.github.bordertech.wcomponents.MockContainer in project wcomponents by BorderTech.
the class WServlet_Test method testServiceNormalRequest.
@Test
public void testServiceNormalRequest() throws ServletException, IOException {
MockServletConfig config = new MockServletConfig();
config.setInitParameter(WServlet.WServletHelper.ONGOING_URL_SUFFIX, "foo");
MockContainer content = new MockContainer();
content.add(new WText(LABEL_TEXT));
content.setLocked(true);
MyWServlet servlet = new MyWServlet(content);
servlet.init(config);
MockHttpSession session1 = new MockHttpSession();
MockHttpSession session2 = new MockHttpSession();
sendRequest(session1, servlet);
sendRequest(session2, servlet);
sendRequest(session1, servlet);
// check handle request / paint counts for each session
UIContext uic = getContextForSession(servlet, session1);
setActiveContext(uic);
Assert.assertEquals("Incorrect handle request count for session1", 2, content.getHandleRequestCount());
Assert.assertEquals("Incorrect paint count for session1", 2, content.getPaintCount());
uic = getContextForSession(servlet, session2);
setActiveContext(uic);
Assert.assertEquals("Incorrect handle request count for session2", 1, content.getHandleRequestCount());
Assert.assertEquals("Incorrect paint count for session2", 1, content.getPaintCount());
}
Aggregations