public void testNoCredentialsResultsInError() throws Exception {
   final MockRequestContext context = new MockRequestContext();
   context.setExternalContext(
       new ServletExternalContext(
           new MockServletContext(), new MockHttpServletRequest(), new MockHttpServletResponse()));
   assertEquals("error", this.action.execute(context).getId());
 }
 public void testCredentialsResultsInSuccess() throws Exception {
   final MockRequestContext context = new MockRequestContext();
   final MockHttpServletRequest request = new MockHttpServletRequest();
   request.setAttribute(
       "javax.servlet.request.X509Certificate", new X509Certificate[] {VALID_CERTIFICATE});
   context.setExternalContext(
       new ServletExternalContext(
           new MockServletContext(), request, new MockHttpServletResponse()));
   assertEquals("success", this.action.execute(context).getId());
 }
コード例 #3
0
  @Test
  public void verifySettingContextPath() throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    request.setContextPath(CONST_CONTEXT_PATH);
    final MockRequestContext context = new MockRequestContext();
    context.setExternalContext(
        new ServletExternalContext(
            new MockServletContext(), request, new MockHttpServletResponse()));

    this.action.doExecute(context);

    assertEquals(CONST_CONTEXT_PATH + '/', this.warnCookieGenerator.getCookiePath());
    assertEquals(CONST_CONTEXT_PATH + '/', this.tgtCookieGenerator.getCookiePath());
  }