Package net.sourceforge.pebble.mock

Examples of net.sourceforge.pebble.mock.MockFilterChain


   * @throws Exception
   */
  public void testUriInsertedIntoRequestScope() throws Exception {
    request.setAttribute(Constants.BLOG_KEY, BlogManager.getInstance().getMultiBlog());
    request.setRequestUri("/somecontext");
    filter.doFilter(request, response, new MockFilterChain());
    assertEquals("/", request.getAttribute(Constants.EXTERNAL_URI));

    request.setRequestUri("/somecontext/rss.xml");
    filter.doFilter(request, response, new MockFilterChain());
    assertEquals("/rss.xml", request.getAttribute(Constants.EXTERNAL_URI));

    request.setRequestUri("/somecontext/blog1/rss.xml");
    filter.doFilter(request, response, new MockFilterChain());
    assertEquals("/rss.xml", request.getAttribute(Constants.EXTERNAL_URI));

    request.setRequestUri("/somecontext/blog1/images/myImage.jpg");
    filter.doFilter(request, response, new MockFilterChain());
    assertEquals("/images/myImage.jpg", request.getAttribute(Constants.EXTERNAL_URI));
  }
View Full Code Here


    filter.destroy();
  }

  public void testUrlTransformed() throws Exception {
    request.setAttribute(Constants.EXTERNAL_URI, "/");
    filter.doFilter(request, response, new MockFilterChain());
    assertEquals("/viewHomePage.action", request.getAttribute(Constants.INTERNAL_URI));
  }
View Full Code Here

   * @throws Exception
   */
  public void testUriInsertedIntoRequestScope() throws Exception {
    request.setAttribute(Constants.BLOG_KEY, blog);
    request.setRequestUri("/somecontext");
    filter.doFilter(request, response, new MockFilterChain());
    assertEquals("/", request.getAttribute(Constants.EXTERNAL_URI));

    request.setRequestUri("/somecontext/rss.xml");
    filter.doFilter(request, response, new MockFilterChain());
    assertEquals("/rss.xml", request.getAttribute(Constants.EXTERNAL_URI));

    request.setRequestUri("/somecontext/images/myImage.jpg");
    filter.doFilter(request, response, new MockFilterChain());
    assertEquals("/images/myImage.jpg", request.getAttribute(Constants.EXTERNAL_URI));
  }
View Full Code Here

   *
   * @throws Exception
   */
  public void testBlogInsertedIntoRequestScope() throws Exception {
    request.setRequestUri("/somecontext");
    filter.doFilter(request, response, new MockFilterChain());
    assertEquals(blog, request.getAttribute(Constants.BLOG_KEY));

    request.setRequestUri("/somecontext/rss.xml");
    filter.doFilter(request, response, new MockFilterChain());
    assertEquals(blog, request.getAttribute(Constants.BLOG_KEY));

    request.setRequestUri("/somecontext/images/myImage.jpg");
    filter.doFilter(request, response, new MockFilterChain());
    assertEquals(blog, request.getAttribute(Constants.BLOG_KEY));
  }
View Full Code Here

   *
   * @throws Exception
   */
  public void testBlogInsertedIntoRequestScope() throws Exception {
    request.setRequestUri("/somecontext");
    filter.doFilter(request, response, new MockFilterChain());
    assertTrue(request.getAttribute(Constants.BLOG_KEY) instanceof MultiBlog);

    request.setRequestUri("/somecontext/blog1");
    filter.doFilter(request, response, new MockFilterChain());
    assertEquals(blog1, request.getAttribute(Constants.BLOG_KEY));

    request.setRequestUri("/somecontext/rss.xml");
    filter.doFilter(request, response, new MockFilterChain());
    assertTrue(request.getAttribute(Constants.BLOG_KEY) instanceof MultiBlog);

    request.setRequestUri("/somecontext/blog1/rss.xml");
    filter.doFilter(request, response, new MockFilterChain());
    assertEquals(blog1, request.getAttribute(Constants.BLOG_KEY));
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.pebble.mock.MockFilterChain

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.