Package org.apache.wicket.protocol.http.mock

Examples of org.apache.wicket.protocol.http.mock.MockServletContext


   *            the absolute path on disk to the web application's contents (e.g. war root) - may
   *            be <code>null</code>
   */
  public BaseWicketTester(final WebApplication application, String servletContextBasePath)
  {
    this(application, new MockServletContext(application, servletContextBasePath));
  }
View Full Code Here


   *            the servlet context used as backend
   */
  public BaseWicketTester(final WebApplication application, final ServletContext servletCtx)
  {
    servletContext = servletCtx != null ? servletCtx
      : new MockServletContext(application, null);

    final FilterConfig filterConfig = new TestFilterConfig();
    WicketFilter filter = new WicketFilter()
    {
      @Override
View Full Code Here

   */
  @Test
  public void testWithServlet30() throws MalformedURLException
  {
    MockApplication application = new MockApplication();
    MockServletContext servletContext = new MockServletContext(application, "/");
    BaseWicketTester tester = new BaseWicketTester(application, servletContext);

    MetaInfStaticResourceReference metaRes = new MetaInfStaticResourceReference(getClass(),
      STATIC_RESOURCE_NAME);
    PackageResourceReference packRes = new PackageResourceReference(getClass(),
      STATIC_RESOURCE_NAME);

    Url packUrl = tester.getRequestCycle().mapUrlFor(packRes, null);
    Url metaUrl = tester.getRequestCycle().mapUrlFor(metaRes, null);

    Assert.assertNotNull(metaUrl);
    Assert.assertNotNull(packUrl);
    Assert.assertFalse(
      "Meta and pack resource should not map to the same url under servlet 3.0.",
      metaUrl.equals(packUrl));

    String metaUrlStr = metaUrl.toString();
    if (metaUrlStr.charAt(1) != '/')
    {
      metaUrlStr = "/" + metaUrlStr;
    }

    // meta resource is served by the servlet container under 3.0
    URL metaNetUrl = servletContext.getResource(metaUrlStr);

    Assert.assertNotNull("Meta resource is not found by the 3.0 servlet container.", metaNetUrl);

    MockWebRequest request = new MockWebRequest(packUrl);

View Full Code Here

   *            the absolute path on disk to the web application's contents (e.g. war root) - may
   *            be <code>null</code>
   */
  public BaseWicketTester(final WebApplication application, String servletContextBasePath)
  {
    this(application, new MockServletContext(application, servletContextBasePath));
  }
View Full Code Here

   *            the servlet context used as backend
   */
  public BaseWicketTester(final WebApplication application, final ServletContext servletCtx)
  {
    servletContext = servletCtx != null ? servletCtx
      : new MockServletContext(application, null);

    final FilterConfig filterConfig = new TestFilterConfig();
    WicketFilter filter = new WicketFilter()
    {
      @Override
View Full Code Here

  private final MockApplication app = new MockApplication();

  @Before
  public void before()
  {
    app.setServletContext(new MockServletContext(app, null));

    ThreadContext.setApplication(app);

    app.setName(getClass().getName());
    app.initApplication();
View Full Code Here

  private final MockApplication app = new MockApplication();

  @Before
  public void before()
  {
    app.setServletContext(new MockServletContext(app, null));

    ThreadContext.setApplication(app);

    app.setName(getClass().getName());
    app.initApplication();
View Full Code Here

          }

          @Override
          public ServletContext getServletContext()
          {
            return new MockServletContext(null, null);
          }

          @Override
          public Enumeration<String> getInitParameterNames()
          {
View Full Code Here

      return getClass().getName();
    }

    public ServletContext getServletContext()
    {
      return new MockServletContext(null, null);
    }
View Full Code Here

   *            the absolute path on disk to the web application's contents (e.g. war root) - may
   *            be <code>null</code>
   */
  public BaseWicketTester(final WebApplication application, String servletContextBasePath)
  {
    this(application, new MockServletContext(application, servletContextBasePath));
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.protocol.http.mock.MockServletContext

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.