Package org.richfaces.test.staging

Examples of org.richfaces.test.staging.StaticServlet


public class ServletTest {

  @Test
  public void testIsApplicable() {
    StaticServlet staticServlet = new StaticServlet();
    RequestChain servlet = new ServletContainer("/foo/*",staticServlet);
    assertTrue(servlet.isApplicable("/foo/bar.jsf"));
    assertFalse(servlet.isApplicable("/foz/bar.jsf"));
    assertFalse(servlet.isApplicable("bar"));
    servlet = new ServletContainer("*.jsf",staticServlet);
 
View Full Code Here


    assertFalse(true);
  }

  @Test
  public void testGetServletPath() {
    StaticServlet staticServlet = new StaticServlet();
    RequestChain servlet = new ServletContainer("/foo/*",staticServlet);
    assertEquals("/foo/", servlet.getServletPath("/foo/bar.jsf"));
    assertNull(servlet.getServletPath("/foz/bar.jsf"));
    servlet = new ServletContainer("*.jsf",staticServlet);
    assertEquals("/foo/bar.jsf", servlet.getServletPath("/foo/bar.jsf"));
View Full Code Here

    assertEquals("/foo/bar.jsf", servlet.getServletPath("/foo/bar.jsf"));
  }

  @Test
  public void testGetPathInfo() {
    StaticServlet staticServlet = new StaticServlet();
    RequestChain servlet = new ServletContainer("/foo/*",staticServlet);
    assertEquals("bar.jsf", servlet.getPathInfo("/foo/bar.jsf"));
    assertNull(servlet.getPathInfo("/foz/bar.jsf"));
    servlet = new ServletContainer("*.jsf",staticServlet);
    assertNull(servlet.getPathInfo("/foo/bar.jsf"));
 
View Full Code Here

  }

  @Test
  public void testInit() throws ServletException {
    StaticServlet staticServlet = new StaticServlet();
    RequestChain servlet = new ServletContainer("/foo/*",staticServlet);
    StagingServletContext context = new StagingServletContext(){

      public String getMimeType(String file){
        return null;
      }

      @Override
      protected ServerResource getServerResource(String path) {
        // TODO Auto-generated method stub
        return null;
      }

      @Override
      protected void valueBound(ServletContextAttributeEvent event) {
        // TODO Auto-generated method stub
       
      }

      @Override
      protected void valueReplaced(ServletContextAttributeEvent event) {
        // TODO Auto-generated method stub
       
      }

      @Override
      protected void valueUnbound(
          ServletContextAttributeEvent servletContextAttributeEvent) {
        // TODO Auto-generated method stub
       
      }
     
    };
    servlet.init(context);
    assertSame(context,staticServlet.getServletContext());
  }
View Full Code Here

TOP

Related Classes of org.richfaces.test.staging.StaticServlet

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.