Package org.richfaces.test.staging

Examples of org.richfaces.test.staging.ServletContainer


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);
    assertTrue(servlet.isApplicable("/foo/bar.jsf"));
    assertFalse(servlet.isApplicable("bar"));
    try {
      servlet = new ServletContainer(".jsf",staticServlet);
    } catch (IllegalArgumentException e) {
      return;
    }
    assertFalse(true);
  }
View Full Code Here


  }

  @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

  }

  @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

   * The default implementation also tests presense of the "org.ajax4jsf.Filter" class.
   * If this class is avalable, these instance appended to the Faces Servlet call chain.
   * Default mapping to the FacesServlet instance is "*.jsf"
   */
  protected void setupFacesServlet() {
    ServletContainer facesServletContainer = new ServletContainer("*.jsf",
        new FacesServlet());
    facesServletContainer.setName("Faces Servlet");
    try {
      // Check for an ajax4jsf filter.
      Class<? extends Filter> ajaxFilterClass = contextClassLoader
          .loadClass("org.ajax4jsf.Filter").asSubclass(Filter.class);
      Filter ajaxFilter = ajaxFilterClass.newInstance();
View Full Code Here

TOP

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

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.