Correctly define the ROOT context in unit tests
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 22 Sep 2010 22:59:55 +0000 (22:59 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 22 Sep 2010 22:59:55 +0000 (22:59 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1000269 13f79535-47bb-0310-9956-ffa450edef68

14 files changed:
java/org/apache/catalina/startup/Tomcat.java
test/org/apache/catalina/connector/TestCoyoteAdapter.java
test/org/apache/catalina/connector/TestRequest.java
test/org/apache/catalina/connector/TestResponse.java
test/org/apache/catalina/core/TestAsyncContextImpl.java
test/org/apache/catalina/core/TestNamingContextListener.java
test/org/apache/catalina/core/TestStandardContextAliases.java
test/org/apache/catalina/filters/TestAddCharSetFilter.java
test/org/apache/catalina/loader/TestVirtualWebappLoader.java
test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java
test/org/apache/catalina/startup/TestTomcat.java
test/org/apache/naming/resources/TestProxyDirContext.java
test/org/apache/tomcat/util/http/CookiesBaseTest.java
test/org/apache/tomcat/util/http/TestBug49158.java

index 903041f..c332137 100644 (file)
@@ -193,7 +193,7 @@ public class Tomcat {
      *  
      * TODO: add the rest
      *
-     *  @param contextPath "/" for root context.
+     *  @param contextPath "" for root context.
      *  @param baseDir base dir for the context, for static files. Must exist, 
      *  relative to the server home
      */
index 76b4e11..ac772ea 100644 (file)
@@ -77,7 +77,7 @@ public class TestCoyoteAdapter extends TomcatBaseTest {
             fail("Unable to create foo directory in docBase");
         }
         
-        Context ctx = tomcat.addContext("/", docBase.getAbsolutePath());
+        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
 
         Tomcat.addServlet(ctx, "servlet", new PathParamServlet());
         ctx.addServletMapping("/", "servlet");
@@ -99,7 +99,7 @@ public class TestCoyoteAdapter extends TomcatBaseTest {
 
         // Must have a real docBase - just use temp
         Context ctx = 
-            tomcat.addContext("/", System.getProperty("java.io.tmpdir"));
+            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
 
         Tomcat.addServlet(ctx, "servlet", new PathParamServlet());
         ctx.addServletMapping("/", "servlet");
index 72f3dbe..53a2f4c 100644 (file)
@@ -211,7 +211,7 @@ public class TestRequest extends TomcatBaseTest {
         
         // Must have a real docBase - just use temp
         Context ctx = 
-            tomcat.addContext("/", System.getProperty("java.io.tmpdir"));
+            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
 
         // Add the Servlet
         Tomcat.addServlet(ctx, "servlet", new EchoQueryStringServlet());
@@ -255,7 +255,7 @@ public class TestRequest extends TomcatBaseTest {
         
         // Must have a real docBase - just use temp
         Context ctx = 
-            tomcat.addContext("/", System.getProperty("java.io.tmpdir"));
+            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
 
         LoginConfig config = new LoginConfig();
         config.setAuthMethod("BASIC");
index 3bdf8d3..1db0c51 100644 (file)
@@ -45,7 +45,7 @@ public class TestResponse extends TomcatBaseTest {
         
         // Must have a real docBase - just use temp
         File docBase = new File(System.getProperty("java.io.tmpdir"));
-        Context ctx = tomcat.addContext("/", docBase.getAbsolutePath());
+        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
 
         Tomcat.addServlet(ctx, "servlet", new Bug49598Servlet());
         ctx.addServletMapping("/", "servlet");
index e12b629..000a410 100644 (file)
@@ -42,7 +42,7 @@ public class TestAsyncContextImpl extends TomcatBaseTest {
         
         // Must have a real docBase - just use temp
         Context ctx = 
-            tomcat.addContext("/", System.getProperty("java.io.tmpdir"));
+            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
 
         Bug49528Servlet servlet = new Bug49528Servlet();
         
@@ -72,7 +72,7 @@ public class TestAsyncContextImpl extends TomcatBaseTest {
         
         // Must have a real docBase - just use temp
         Context ctx = 
-            tomcat.addContext("/", System.getProperty("java.io.tmpdir"));
+            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
 
         Bug49567Servlet servlet = new Bug49567Servlet();
         
@@ -106,7 +106,7 @@ public class TestAsyncContextImpl extends TomcatBaseTest {
         
         // Must have a real docBase - just use temp
         Context ctx = 
-            tomcat.addContext("/", System.getProperty("java.io.tmpdir"));
+            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
 
         AsyncStartNoCompleteServlet servlet =
             new AsyncStartNoCompleteServlet();
@@ -134,7 +134,7 @@ public class TestAsyncContextImpl extends TomcatBaseTest {
         
         // Must have a real docBase - just use temp
         Context ctx = 
-            tomcat.addContext("/", System.getProperty("java.io.tmpdir"));
+            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
 
         AsyncStartWithCompleteServlet servlet =
             new AsyncStartWithCompleteServlet();
@@ -324,7 +324,7 @@ public class TestAsyncContextImpl extends TomcatBaseTest {
             fail("Unable to create async directory in docBase");
         }
         
-        Context ctx = tomcat.addContext("/", docBase.getAbsolutePath());
+        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
 
         TimeoutServlet timeout = new TimeoutServlet();
 
index 5553282..e36f3e6 100644 (file)
@@ -40,7 +40,7 @@ public class TestNamingContextListener extends TomcatBaseTest {
         
         // Must have a real docBase - just use temp
         org.apache.catalina.Context ctx = 
-            tomcat.addContext("/", System.getProperty("java.io.tmpdir"));
+            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
         
         // Enable JNDI - it is disabled by default
         tomcat.enableNaming();
index 7bb8a14..586046f 100644 (file)
@@ -39,7 +39,7 @@ public class TestStandardContextAliases extends TomcatBaseTest {
 
         // Must have a real docBase - just use temp
         StandardContext ctx = (StandardContext) 
-            tomcat.addContext("/", System.getProperty("java.io.tmpdir"));
+            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
         
         File lib = new File("webapps/examples/WEB-INF/lib");
         ctx.setAliases("/WEB-INF/lib=" + lib.getCanonicalPath());
index 2ed9e86..74f618a 100644 (file)
@@ -81,7 +81,7 @@ public class TestAddCharSetFilter extends TomcatBaseTest {
         
         // Must have a real docBase - just use temp
         Context ctx = 
-            tomcat.addContext("/", System.getProperty("java.io.tmpdir"));
+            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
 
         // Add the Servlet
         CharsetServlet servlet = new CharsetServlet(mode);
index 4e3cdb7..d2aa3e2 100644 (file)
@@ -36,7 +36,7 @@ public class TestVirtualWebappLoader extends TomcatBaseTest {
         File appDir = new File("test/webapp-3.0");      
         // Must have a real docBase - just use temp
         StandardContext ctx = 
-            (StandardContext)tomcat.addContext("/",  appDir.getAbsolutePath());
+            (StandardContext)tomcat.addContext("",  appDir.getAbsolutePath());
 
         VirtualWebappLoader loader = new VirtualWebappLoader();
          
index f232591..8877105 100644 (file)
@@ -37,7 +37,7 @@ public class TestWebappClassLoaderMemoryLeak extends TomcatBaseTest {
         
         // Must have a real docBase - just use temp
         Context ctx = 
-            tomcat.addContext("/", System.getProperty("java.io.tmpdir"));
+            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
 
         if (ctx instanceof StandardContext) {
             ((StandardContext) ctx).setClearReferencesStopTimerThreads(true);
index 646a1c9..0901c18 100644 (file)
@@ -183,7 +183,7 @@ public class TestTomcat extends TomcatBaseTest {
         
         // Must have a real docBase - just use temp
         org.apache.catalina.Context ctx = 
-            tomcat.addContext("/", System.getProperty("java.io.tmpdir"));
+            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
         // You can customize the context by calling 
         // its API
         
@@ -242,7 +242,7 @@ public class TestTomcat extends TomcatBaseTest {
         
         // Must have a real docBase - just use temp
         org.apache.catalina.Context ctx = 
-            tomcat.addContext("/", System.getProperty("java.io.tmpdir"));
+            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
         
         // You can customise the context by calling its API
         
@@ -272,7 +272,7 @@ public class TestTomcat extends TomcatBaseTest {
         
         // Must have a real docBase - just use temp
         org.apache.catalina.Context ctx = 
-            tomcat.addContext("/", System.getProperty("java.io.tmpdir"));
+            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
         
         // You can customise the context by calling its API
         
index 64954bc..6977e6c 100644 (file)
@@ -37,7 +37,7 @@ public class TestProxyDirContext extends TomcatBaseTest {
         
         // Must have a real docBase - just use temp
         StandardContext ctx = (StandardContext)
-            tomcat.addContext("/", System.getProperty("java.io.tmpdir"));
+            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
         ctx.setCacheTTL(500);
         tomcat.start();
         
index 40ea270..d8648a1 100644 (file)
@@ -69,7 +69,7 @@ public abstract class CookiesBaseTest extends TomcatBaseTest {
     public static void addServlets(Tomcat tomcat) {
         // Must have a real docBase - just use temp
         Context ctx = 
-            tomcat.addContext("/", System.getProperty("java.io.tmpdir"));
+            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
 
         Tomcat.addServlet(ctx, "invalid", new CookieServlet("na;me", "value"));
         ctx.addServletMapping("/invalid", "invalid");
index d5edc17..e2875b1 100644 (file)
@@ -57,7 +57,7 @@ public class TestBug49158 extends CookiesBaseTest {
     public static void addServlets(Tomcat tomcat) {
         // Must have a real docBase - just use temp
         Context ctx = 
-            tomcat.addContext("/", System.getProperty("java.io.tmpdir"));
+            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
 
         Tomcat.addServlet(ctx, path, new TestBug49158Servlet());
         ctx.addServletMapping("/"+path, path);