Package com.mockobjects.servlet

Examples of com.mockobjects.servlet.MockServletConfig


                return parameters.keys();
            }
        };

        // create a servlet config
        final MockServletConfig config = new MockServletConfig();
        config.setServletContext(context);

        // create a servlet
        Servlet servlet = new HttpServlet()
        {
            public ServletConfig getServletConfig()
View Full Code Here


*/
public class TestServletConfiguration extends TestAbstractConfiguration
{
    protected AbstractConfiguration getConfiguration()
    {
        final MockServletConfig config = new MockServletConfig();
        config.setInitParameter("key1", "value1");
        config.setInitParameter("key2", "value2");
        config.setInitParameter("list", "value1, value2");

        Servlet servlet = new HttpServlet() {
            public ServletConfig getServletConfig()
            {
                return config;
View Full Code Here

        return new ServletConfiguration(servlet);
    }

    protected AbstractConfiguration getEmptyConfiguration()
    {
        return new ServletConfiguration(new MockServletConfig());
    }
View Full Code Here

  public ServletResourceLocatorTest(String arg0) {
    super(arg0);
  }

  private MockServletConfig getServletConfig() {
    MockServletConfig config = new MockServletConfig();
    config.setServletContext(new MyMockServletContext());
    return config;
  }
View Full Code Here

    }
    new ServletResourceLocator(getServletConfig(), null);
  }

  public void testGetResource_exceptions() {
    MockServletConfig config = getServletConfig();
    ServletResourceLocator servletLocator = new ServletResourceLocator(
        config, null);

    try {
      try {
View Full Code Here

  /**
   * Test that getResource loads based on the servlet config param -
   * <init-param>
   */
  public void testGetResource_initparam() {
    MockServletConfig config = getServletConfig();
    MyMockServletContext context = ((MyMockServletContext) config
        .getServletContext());
    InputStream stream = new ByteArrayInputStream(new byte[] {});
    ServletResourceLocator servletLocator = new ServletResourceLocator(
        config, null);

    config.setInitParameter("paraX", "paraX-config");
    context.stream = stream;
    context.setInitParameter("paraX", "paraX-context");
    try {
      InputStream res = servletLocator.getResource("paraX", null);
      assertEquals(stream, res);
View Full Code Here

  /**
   * Test that getResource loads based on the servlet context param -
   * <context-param>
   */
  public void testGetResource_contextparam() {
    MockServletConfig config = getServletConfig();
    MyMockServletContext context = ((MyMockServletContext) config
        .getServletContext());
    InputStream stream = new ByteArrayInputStream(new byte[] {});
    ServletResourceLocator servletLocator = new ServletResourceLocator(
        config, null);

View Full Code Here

  /**
   * Test that getResource loads based on the supplied default param
   */
  public void testGetResource_defaultparam() {
    MockServletConfig config = getServletConfig();
    MyMockServletContext context = ((MyMockServletContext) config
        .getServletContext());
    InputStream stream = new ByteArrayInputStream(new byte[] {});
    ServletResourceLocator servletLocator = new ServletResourceLocator(
        config, null);

View Full Code Here

  /**
   * Test that getResource loads from the external resource locator by making
   * the resource stream load from the context fail.
   */
  public void testGetResource_fromURLResourceLocator() {
    MockServletConfig config = getServletConfig();
    MyMockServletContext context = ((MyMockServletContext) config
        .getServletContext());
    MockExternalResourceLocator resLocator = new MockExternalResourceLocator();
    ServletResourceLocator servletLocator = new ServletResourceLocator(
        config, resLocator);

View Full Code Here

  public ServletParamUtilsTest(String arg0) {
    super(arg0);
  }

  private MockServletConfig getServletConfig() {
    MockServletConfig config = new MockServletConfig();
    config.setServletContext(new MockServletContext());
    return config;
  }
View Full Code Here

TOP

Related Classes of com.mockobjects.servlet.MockServletConfig

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.