Package org.apache.wicket.mock

Examples of org.apache.wicket.mock.MockWebRequest


   * <a href="https://issues.apache.org/jira/browse/WICKET-3567">WICKET-3567</a>
   */
  @Test
  public void test12()
  {
    UrlRenderer r1 = new UrlRenderer(new MockWebRequest(Url.parse("?0")));
    assertEquals("./", r1.renderUrl(Url.parse("")));
  }
View Full Code Here


   * '../' works better.
   */
  @Test
  public void test13()
  {
    UrlRenderer r1 = new UrlRenderer(new MockWebRequest(Url.parse("foo/bar")));
    assertEquals("../", r1.renderUrl(Url.parse("")));
  }
View Full Code Here

   * WICKET-4920 prevent double slash
   */
  @Test
  public void test14()
  {
    UrlRenderer r1 = new UrlRenderer(new MockWebRequest(new Url()));

    assertEquals(
      "./;jsessionid=1p87c5424zjuvd57kljcu2bwa?0-1.IBehaviorListener.1-component",
      r1.renderRelativeUrl(Url.parse("http://localhost:8080/;jsessionid=1p87c5424zjuvd57kljcu2bwa?0-1.IBehaviorListener.1-component")));
  }
View Full Code Here

   * WICKET-4935 prevent another double slash
   */
  @Test
  public void test15()
  {
    UrlRenderer r1 = new UrlRenderer(new MockWebRequest(Url.parse("private/AdminPage")));

    assertEquals("../signIn;jsessionid=16k3wqa9c4sgq1cnp7fisa20u",
      r1.renderRelativeUrl(Url.parse("/signIn;jsessionid=16k3wqa9c4sgq1cnp7fisa20u")));
  }
View Full Code Here

   */
  @Test
  public void test16()
  {
    UrlRenderer r1 = new UrlRenderer(
      new MockWebRequest(Url.parse("private/AdminPage")).setContextPath("context"));

    assertEquals("../signIn;jsessionid=16k3wqa9c4sgq1cnp7fisa20u",
      r1.renderRelativeUrl(Url.parse("/context/signIn;jsessionid=16k3wqa9c4sgq1cnp7fisa20u")));
  }
View Full Code Here

  @Test
  public void renderAbsoluteUrl()
  {
    String absoluteUrl = "http://www.example.com/some/path.ext";
    Url url = Url.parse(absoluteUrl);
    UrlRenderer renderer = new UrlRenderer(new MockWebRequest(Url.parse("foo/bar")));
    String renderedUrl = renderer.renderUrl(url);
    assertEquals(absoluteUrl, renderedUrl);
  }
View Full Code Here

  {
    Url baseUrl = Url.parse("one/two/three");
    baseUrl.setProtocol("http");
    baseUrl.setHost("www.example.com");
    baseUrl.setPort(8888);
    UrlRenderer renderer = new UrlRenderer(new MockWebRequest(baseUrl));
    renderer.setBaseUrl(baseUrl); // this is needed because MockWebRequest cuts data
    String fullUrl = renderer.renderFullUrl(Url.parse("../four"));
    assertEquals("http://www.example.com:8888/one/four", fullUrl);
  }
View Full Code Here

  {
    Url baseUrl = Url.parse("one/two/three");
    baseUrl.setProtocol("http");
    baseUrl.setHost("www.example.com");
    baseUrl.setPort(8888);
    UrlRenderer renderer = new UrlRenderer(new MockWebRequest(baseUrl));
    renderer.setBaseUrl(baseUrl); // this is needed because MockWebRequest cuts data
    String fullUrl = renderer.renderFullUrl(Url.parse("/four")); // url starting with slash is
// considered absolute
    assertEquals("http://www.example.com:8888/four", fullUrl);
  }
View Full Code Here

   */
  @Test
  public void renderUrlWithRelativeArgument()
  {
    Url baseUrl = Url.parse("one/two/three");
    UrlRenderer renderer = new UrlRenderer(new MockWebRequest(baseUrl));
    baseUrl.setProtocol("http");
    baseUrl.setHost("www.example.com");
    baseUrl.setPort(8888);
    renderer.setBaseUrl(baseUrl);

View Full Code Here

  public void renderFullUrlAsRelativeToAnAbsoluteBaseUrl()
  {
    Url baseUrl = Url.parse("http://host:8080/contextPath/filterPath/a/b/c/d");
    Url encodedFullUrl = Url.parse("http://host:8080/contextPath/filterPath/a/b;jsessionid=123456");

    UrlRenderer renderer = new UrlRenderer(new MockWebRequest(baseUrl));
    String encodedRelativeUrl = renderer.renderRelativeUrl(encodedFullUrl);

    assertEquals("../../b;jsessionid=123456", encodedRelativeUrl);
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.mock.MockWebRequest

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.