Example #1
0
  public void testResolveLongSitePath1() {

    httpServletRequest.setRequestURI("/site/1/About/Jobs/");

    SitePath sitePath = sitePathResolver.resolveSitePath(httpServletRequest);

    assertEquals(siteKey_1, sitePath.getSiteKey());
    assertEquals("/About/Jobs/", sitePath.getLocalPath().toString());
  }
Example #2
0
  public void testResolveSimpleSitePath1() {

    httpServletRequest.setRequestURI("/site/1/Frontpage");

    SitePath sitePath = sitePathResolver.resolveSitePath(httpServletRequest);

    assertEquals(siteKey_1, sitePath.getSiteKey());
    assertEquals("/Frontpage", sitePath.getLocalPath().toString());
  }
Example #3
0
  public void testResolveSimpleSitePath123() {

    httpServletRequest.setCharacterEncoding("ISO-8859-1");
    httpServletRequest.setRequestURI("/site/123/Frontpage/");

    SitePath sitePath = sitePathResolver.resolveSitePath(httpServletRequest);

    assertEquals(siteKey_123, sitePath.getSiteKey());
    assertEquals("/Frontpage/", sitePath.getLocalPath().toString());
  }
Example #4
0
  public void testResolveSimpleSitePathWithNoLocalPathAndNoEndSlash() {

    httpServletRequest.setCharacterEncoding("ISO-8859-1");
    httpServletRequest.setRequestURI("/site/123");

    SitePath sitePath = sitePathResolver.resolveSitePath(httpServletRequest);

    assertEquals(siteKey_123, sitePath.getSiteKey());
    assertEquals("", sitePath.getLocalPath().toString());
  }
Example #5
0
  public void testResolveIncludePath() {

    httpServletRequest.setAttribute("javax.servlet.include.request_uri", "/site/1/About/Jobs/");
    httpServletRequest.setRequestURI("/About/Jobs/");

    SitePath sitePath = sitePathResolver.resolveSitePath(httpServletRequest);

    assertEquals(siteKey_1, sitePath.getSiteKey());
    assertEquals("/About/Jobs/", sitePath.getLocalPath().toString());
  }
Example #6
0
  public void testResolveSitePathWithNoPrefix() {

    sitePathResolver.setSitePathPrefix("");
    httpServletRequest.setRequestURI("/1/");

    SitePath sitePath = sitePathResolver.resolveSitePath(httpServletRequest);

    assertEquals(siteKey_1, sitePath.getSiteKey());
    assertEquals("/", sitePath.getLocalPath().toString());
  }
Example #7
0
  public void testGetParamWithMultipleValues() {

    httpServletRequest.setRequestURI("/site/1/Frontpage");
    httpServletRequest.setParameter("param1", new String[] {"value0", "value1"});

    SitePath sitePath = sitePathResolver.resolveSitePath(httpServletRequest);

    assertEquals(siteKey_1, sitePath.getSiteKey());
    assertEquals("/Frontpage", sitePath.getLocalPath().toString());
    assertEquals("value0", sitePath.getParam("param1"));
  }
Example #8
0
  public void xtestRussianSitePath_WithDefaultCharacterEncoding_UTF_8() {

    sitePropertiesService.setProperty(
        siteKey_1, SitePropertyNames.URL_DEFAULT_CHARACTER_ENCODING, "UTF-8");
    httpServletRequest.setRequestURI("/site/1/Services%D0%BB/");

    SitePath sitePath = sitePathResolver.resolveSitePath(httpServletRequest);

    assertEquals(siteKey_1, sitePath.getSiteKey());
    assertEquals("/Servicesл/", sitePath.getLocalPath().toString());
  }
Example #9
0
  public void xtestSweedishSitePath_With_ISO_8859_1() {

    sitePropertiesService.setProperty(
        siteKey_1, SitePropertyNames.URL_DEFAULT_CHARACTER_ENCODING, "ISO-8859-1");
    httpServletRequest.setRequestURI("/site/1/B%F6t/");

    SitePath sitePath = sitePathResolver.resolveSitePath(httpServletRequest);

    assertEquals(siteKey_1, sitePath.getSiteKey());
    assertEquals("/Böt/", sitePath.getLocalPath().toString());
  }