re-add all-in-one testcase,
authorkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 19 May 2010 03:44:51 +0000 (03:44 +0000)
committerkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 19 May 2010 03:44:51 +0000 (03:44 +0000)
in case if it matters for the failure that was observed by Gump

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@946011 13f79535-47bb-0310-9956-ffa450edef68

test/org/apache/catalina/connector/TestCoyoteAdaptor.java

index 0e2b24f..a044cc5 100644 (file)
@@ -61,10 +61,9 @@ public class TestCoyoteAdaptor extends TomcatBaseTest {
 
     public void testPathParmsFooSessionBar() throws Exception {
         pathParamTest("/foo;jsessionid=1234/bar", "1234");
-
     }
 
-    public void pathParamTest(String path, String expected) throws Exception {
+    public void testPathParams() throws Exception {
         // Setup Tomcat instance
         Tomcat tomcat = getTomcatInstance();
         
@@ -74,9 +73,36 @@ public class TestCoyoteAdaptor extends TomcatBaseTest {
 
         Tomcat.addServlet(ctx, "servlet", new PathParamServlet());
         ctx.addServletMapping("/", "servlet");
-        
+
         tomcat.start();
 
+        testPath("/", "none");
+        testPath("/;jsessionid=1234", "1234");
+        testPath("/foo;jsessionid=1234", "1234");
+        testPath("/foo;jsessionid=1234;dummy", "1234");
+        testPath("/foo;jsessionid=1234;dummy=5678", "1234");
+        testPath("/foo;jsessionid=1234;=5678", "1234");
+        testPath("/foo;jsessionid=1234/bar", "1234");
+    }
+
+    private void pathParamTest(String path, String expected) throws Exception {
+        // Setup Tomcat instance
+        Tomcat tomcat = getTomcatInstance();
+
+        // Must have a real docBase - just use temp
+        Context ctx = 
+            tomcat.addContext("/", System.getProperty("java.io.tmpdir"));
+
+        Tomcat.addServlet(ctx, "servlet", new PathParamServlet());
+        ctx.addServletMapping("/", "servlet");
+
+        tomcat.start();
+
+        ByteChunk res = getUrl("http://localhost:" + getPort() + path);
+        assertEquals(expected, res.toString());
+    }
+
+    private void testPath(String path, String expected) throws Exception {
         ByteChunk res = getUrl("http://localhost:" + getPort() + path);
         assertEquals(expected, res.toString());
     }