REpurpose the duplicate pathPath test to test the redirect process
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 20 May 2010 09:48:43 +0000 (09:48 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 20 May 2010 09:48:43 +0000 (09:48 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@946583 13f79535-47bb-0310-9956-ffa450edef68

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

index 506df23..877fe84 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.apache.catalina.connector;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.logging.Level;
@@ -65,13 +66,20 @@ public class TestCoyoteAdapter extends TomcatBaseTest {
         pathParamTest("/foo;jsessionid=1234/bar", "1234");
     }
 
-    public void testPathParams() throws Exception {
+    public void testPathParamsRedirect() 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"));
+        File docBase = new File(System.getProperty("java.io.tmpdir"));
+        
+        // Create the folder that will trigger the redirect
+        File foo = new File(docBase, "foo");
+        if (!foo.exists() && !foo.mkdirs()) {
+            fail("Unable to create foo directory in docBase");
+        }
+        
+        Context ctx = tomcat.addContext("/", docBase.getAbsolutePath());
 
         Tomcat.addServlet(ctx, "servlet", new PathParamServlet());
         ctx.addServletMapping("/", "servlet");