Index: webapp-3.0-fragments-empty-absolute-ordering/WEB-INF/lib/resources.jar =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: webapp-3.0-fragments-empty-absolute-ordering/WEB-INF/lib/resources.jar ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: webapp-3.0-fragments-empty-absolute-ordering/WEB-INF/web.xml =================================================================== --- webapp-3.0-fragments-empty-absolute-ordering/WEB-INF/web.xml (revision 0) +++ webapp-3.0-fragments-empty-absolute-ordering/WEB-INF/web.xml (working copy) @@ -0,0 +1,33 @@ + + + + + Tomcat Test Application + + Used as part of the Tomcat unit tests when a full web application is + required. + + + + + \ No newline at end of file Property changes on: webapp-3.0-fragments-empty-absolute-ordering/WEB-INF/web.xml ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: org/apache/catalina/startup/TestContextConfig.java =================================================================== --- org/apache/catalina/startup/TestContextConfig.java (revision 1428749) +++ org/apache/catalina/startup/TestContextConfig.java (working copy) @@ -67,15 +67,8 @@ tomcat.start(); - ByteChunk res = new ByteChunk(); - - int rc =getUrl("http://localhost:" + getPort() + "/test", res, null); - - // Check return code - assertEquals(HttpServletResponse.SC_OK, rc); - - // Check context - assertEquals("OK - Custom default Servlet", res.toString()); + assertPageContains("/test", + "OK - Custom default Servlet"); } @Test @@ -88,12 +81,7 @@ tomcat.start(); - ByteChunk bc = new ByteChunk(); - int rc = getUrl("http://localhost:" + getPort() + - "/test/bug51396.jsp", bc, null); - - assertEquals(HttpServletResponse.SC_OK, rc); - assertTrue(bc.toString().contains("

OK

")); + assertPageContains("/test/bug51396.jsp", "

OK

"); } @Test @@ -105,15 +93,22 @@ tomcat.start(); - ByteChunk res = new ByteChunk(); + assertPageContains("/test/bug53574", "OK"); + } + + @Test + public void testBug54262() throws Exception { + Tomcat tomcat = getTomcatInstance(); - int rc = getUrl("http://localhost:" + getPort() + - "/test/bug53574", res, null); + File appDir = new File("test/webapp-3.0-fragments-empty-absolute-ordering"); + tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - Assert.assertEquals(HttpServletResponse.SC_OK, rc); + tomcat.start(); - String body = res.toString(); - Assert.assertTrue(body.contains("OK")); + assertPageContains("/test/resourceA.jsp", + "resourceA.jsp in resources.jar"); + assertPageContains("/test/resources/HelloWorldExample", + null, HttpServletResponse.SC_NOT_FOUND); } private static class CustomDefaultServletSCI @@ -146,4 +141,22 @@ resp.getWriter().print("OK - Custom default Servlet"); } } + + private void assertPageContains(String pageUrl, String expectedBody) + throws IOException { + assertPageContains(pageUrl, expectedBody, HttpServletResponse.SC_OK); + } + + private void assertPageContains(String pageUrl, String expectedBody, + int expectedStatus) throws IOException { + ByteChunk res = new ByteChunk(); + int sc = getUrl("http://localhost:" + getPort() + pageUrl, res, null); + + assertEquals(expectedStatus, sc); + + if (expectedStatus == HttpServletResponse.SC_OK) { + String result = res.toString(); + assertTrue(result, result.indexOf(expectedBody) > -1); + } + } }