Ejemplo n.º 1
0
  @Test
  public void testDoFilter_attachesHttpSessionToUISession() throws Exception {
    UISessionImpl deserializedUISession = new UISessionImpl(null, null);
    HttpSession httpSession = mockHttpSession();
    setUISession(httpSession, deserializedUISession);
    request.setSession(httpSession);

    rwtClusterSupport.doFilter(request, response, chain);

    assertSame(httpSession, deserializedUISession.getHttpSession());
  }
Ejemplo n.º 2
0
  @Test
  public void testDoFilter_marksUISessionAsChanged() throws Exception {
    HttpSession httpSession = mockHttpSession();
    request.setSession(httpSession);
    UISessionImpl deserializedUISession = new UISessionImpl(null, httpSession);
    setUISession(httpSession, deserializedUISession);

    rwtClusterSupport.doFilter(request, response, chain);

    verify(httpSession).setAttribute(anyString(), same(deserializedUISession));
  }
Ejemplo n.º 3
0
  @Test
  public void testDoFilter_attachesApplicationContextToUISession() throws Exception {
    ApplicationContextImpl applicationContext = mock(ApplicationContextImpl.class);
    HttpSession httpSession = mockHttpSession(mockServletContext(applicationContext));
    request.setSession(httpSession);
    UISessionImpl deserializedUISession = new UISessionImpl(null, httpSession);
    setUISession(httpSession, deserializedUISession);

    rwtClusterSupport.doFilter(request, response, chain);

    assertSame(applicationContext, deserializedUISession.getApplicationContext());
  }
Ejemplo n.º 4
0
  @Test
  public void testDoFilter_marksUISessionAsChangedWithConnectionId() throws Exception {
    HttpSession httpSession = mockHttpSession();
    request.setSession(httpSession);
    request.setParameter("cid", "foo");
    UISessionImpl deserializedUISession = new UISessionImpl(null, httpSession, "foo");
    setUISession(httpSession, deserializedUISession);

    rwtClusterSupport.doFilter(request, response, chain);

    verify(httpSession).setAttribute(endsWith("foo"), same(deserializedUISession));
  }
Ejemplo n.º 5
0
  @Test
  public void testDoFilter_doesNotFailWithoutHttpSession() throws Exception {
    request.setSession(null);

    rwtClusterSupport.doFilter(request, response, chain);
  }
Ejemplo n.º 6
0
  @Test
  public void testDoFilter_passesParametersToFilterChain() throws Exception {
    rwtClusterSupport.doFilter(request, response, chain);

    verify(chain).doFilter(same(request), same(response));
  }