added check for WebSphere's compliance mode (SPR-7064)

This commit is contained in:
Juergen Hoeller
2010-04-21 18:42:59 +00:00
parent c5f83686d2
commit 3dbe38e418
2 changed files with 56 additions and 15 deletions

View File

@@ -16,10 +16,11 @@
package org.springframework.web.util;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest;
/**
@@ -146,12 +147,11 @@ public class UrlPathHelperTests {
}
@Test
public void tomcatDefaultServletFileWithCompliantSetting() throws Exception {
public void wasDefaultServletFileWithCompliantSetting() throws Exception {
request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo");
tomcatDefaultServletFile();
}
@Test
public void wasDefaultServletFolder() throws Exception {
request.setContextPath("/test");
@@ -163,10 +163,16 @@ public class UrlPathHelperTests {
assertEquals("/foo/", helper.getLookupPathForRequest(request));
}
// @Test
@Test
public void wasDefaultServletFolderWithCompliantSetting() throws Exception {
request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo/");
tomcatDefaultServletFolder();
UrlPathHelper.websphereComplianceFlag = true;
try {
request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo/");
tomcatDefaultServletFolder();
}
finally {
UrlPathHelper.websphereComplianceFlag = false;
}
}
@@ -185,7 +191,7 @@ public class UrlPathHelperTests {
}
// test the root mapping for /foo/* w/o a trailing slash - <host>/<context>/foo
// @Test
@Test @Ignore
public void tomcatCasualServletRootWithMissingSlash() throws Exception {
request.setContextPath("/test");
request.setPathInfo(null);
@@ -226,14 +232,14 @@ public class UrlPathHelperTests {
assertEquals("/", helper.getLookupPathForRequest(request));
}
// @Test
@Test
public void wasCasualServletRootWithCompliantSetting() throws Exception {
request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo/");
tomcatCasualServletRoot();
}
// test the root mapping for /foo/* w/o a trailing slash - <host>/<context>/foo
// @Test
@Test @Ignore
public void wasCasualServletRootWithMissingSlash() throws Exception {
request.setContextPath("/test");
request.setPathInfo(null);
@@ -244,7 +250,7 @@ public class UrlPathHelperTests {
assertEquals("/", helper.getLookupPathForRequest(request));
}
// @Test
@Test @Ignore
public void wasCasualServletRootWithMissingSlashWithCompliantSetting() throws Exception {
request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo");
tomcatCasualServletRootWithMissingSlash();