+ added unit tests for WAS with complaint setting
This commit is contained in:
Costin Leau
2010-04-20 13:32:02 +00:00
parent 05360c095c
commit ea9eb853fa

View File

@@ -94,7 +94,6 @@ public class UrlPathHelperTests {
request.setPathInfo(null);
request.setServletPath("/");
request.setRequestURI("/test/");
assertEquals("/", helper.getLookupPathForRequest(request));
}
@@ -118,7 +117,6 @@ public class UrlPathHelperTests {
assertEquals("/foo/", helper.getLookupPathForRequest(request));
}
@Test
public void wasDefaultServletRoot() throws Exception {
request.setContextPath("/test");
@@ -130,6 +128,12 @@ public class UrlPathHelperTests {
assertEquals("/", helper.getLookupPathForRequest(request));
}
@Test
public void wasDefaultServletRootWithCompliantSetting() throws Exception {
request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/");
tomcatDefaultServletRoot();
}
@Test
public void wasDefaultServletFile() throws Exception {
request.setContextPath("/test");
@@ -141,6 +145,13 @@ public class UrlPathHelperTests {
assertEquals("/foo", helper.getLookupPathForRequest(request));
}
@Test
public void tomcatDefaultServletFileWithCompliantSetting() throws Exception {
request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo");
tomcatDefaultServletFile();
}
@Test
public void wasDefaultServletFolder() throws Exception {
request.setContextPath("/test");
@@ -152,6 +163,13 @@ public class UrlPathHelperTests {
assertEquals("/foo/", helper.getLookupPathForRequest(request));
}
@Test
public void tomcatDefaultServletFolderWithCompliantSetting() throws Exception {
request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo/");
tomcatDefaultServletFolder();
}
//
// /foo/* mapping
//
@@ -208,6 +226,12 @@ public class UrlPathHelperTests {
assertEquals("/", helper.getLookupPathForRequest(request));
}
@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
public void wasCasualServletRootWithMissingSlash() throws Exception {
@@ -220,6 +244,12 @@ public class UrlPathHelperTests {
assertEquals("/", helper.getLookupPathForRequest(request));
}
@Test
public void wasCasualServletRootWithMissingSlashWithCompliantSetting() throws Exception {
request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo");
tomcatCasualServletRootWithMissingSlash();
}
@Test
public void wasCasualServletFile() throws Exception {
request.setContextPath("/test");
@@ -231,6 +261,12 @@ public class UrlPathHelperTests {
assertEquals("/foo", helper.getLookupPathForRequest(request));
}
@Test
public void wasCasualServletFileWithCompliantSetting() throws Exception {
request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo/foo");
tomcatCasualServletFile();
}
@Test
public void wasCasualServletFolder() throws Exception {
request.setContextPath("/test");
@@ -241,4 +277,10 @@ public class UrlPathHelperTests {
assertEquals("/foo/", helper.getLookupPathForRequest(request));
}
@Test
public void wasCasualServletFolderWithCompliantSetting() throws Exception {
request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo/foo/");
tomcatCasualServletFolder();
}
}