Package org.beangle.web.filter

Examples of org.beangle.web.filter.MockFilter


    assertTrue(filters.get(1) instanceof UsernamePasswordAuthenticationFilter);
    assertTrue(filters.get(2) instanceof MockFilter);
  }

  private void doNormalOperation(FilterChainProxy filterChainProxy) throws Exception {
    MockFilter filter = (MockFilter) applicationContext.getBean("mockFilter", MockFilter.class);
    assertFalse(filter.isInitialized());
    assertFalse(filter.isDoFiltered());
    assertFalse(filter.isDestroyed());

    filter.init(new MockFilterConfig());
    assertTrue(filter.isInitialized());
    assertFalse(filter.isDoFiltered());
    assertFalse(filter.isDestroyed());

    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setServletPath("/foo/secure/super/somefile.html");
    request.setContextPath("/");

    MockHttpServletResponse response = new MockHttpServletResponse();

    filterChainProxy.doFilter(request, response, new MockFilterChain());
    assertTrue(filter.isInitialized());
    assertTrue(filter.isDoFiltered());
    assertFalse(filter.isDestroyed());

    request.setServletPath("/a/path/which/doesnt/match/any/filter.html");
    filterChainProxy.doFilter(request, response, new MockFilterChain());

    filter.destroy();
    assertTrue(filter.isInitialized());
    assertTrue(filter.isDoFiltered());
    assertTrue(filter.isDestroyed());
  }
View Full Code Here

TOP

Related Classes of org.beangle.web.filter.MockFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.