From: markt Date: Wed, 22 Sep 2010 22:59:55 +0000 (+0000) Subject: Correctly define the ROOT context in unit tests X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=0e5e490d31494d1fa37952e33803664d7a9600a1;p=tomcat7.0 Correctly define the ROOT context in unit tests git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1000269 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/startup/Tomcat.java b/java/org/apache/catalina/startup/Tomcat.java index 903041fa4..c33213754 100644 --- a/java/org/apache/catalina/startup/Tomcat.java +++ b/java/org/apache/catalina/startup/Tomcat.java @@ -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 */ diff --git a/test/org/apache/catalina/connector/TestCoyoteAdapter.java b/test/org/apache/catalina/connector/TestCoyoteAdapter.java index 76b4e118b..ac772ea2f 100644 --- a/test/org/apache/catalina/connector/TestCoyoteAdapter.java +++ b/test/org/apache/catalina/connector/TestCoyoteAdapter.java @@ -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"); diff --git a/test/org/apache/catalina/connector/TestRequest.java b/test/org/apache/catalina/connector/TestRequest.java index 72f3dbe63..53a2f4cb0 100644 --- a/test/org/apache/catalina/connector/TestRequest.java +++ b/test/org/apache/catalina/connector/TestRequest.java @@ -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"); diff --git a/test/org/apache/catalina/connector/TestResponse.java b/test/org/apache/catalina/connector/TestResponse.java index 3bdf8d3bb..1db0c512e 100644 --- a/test/org/apache/catalina/connector/TestResponse.java +++ b/test/org/apache/catalina/connector/TestResponse.java @@ -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"); diff --git a/test/org/apache/catalina/core/TestAsyncContextImpl.java b/test/org/apache/catalina/core/TestAsyncContextImpl.java index e12b6293a..000a41016 100644 --- a/test/org/apache/catalina/core/TestAsyncContextImpl.java +++ b/test/org/apache/catalina/core/TestAsyncContextImpl.java @@ -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(); diff --git a/test/org/apache/catalina/core/TestNamingContextListener.java b/test/org/apache/catalina/core/TestNamingContextListener.java index 555328299..e36f3e65f 100644 --- a/test/org/apache/catalina/core/TestNamingContextListener.java +++ b/test/org/apache/catalina/core/TestNamingContextListener.java @@ -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(); diff --git a/test/org/apache/catalina/core/TestStandardContextAliases.java b/test/org/apache/catalina/core/TestStandardContextAliases.java index 7bb8a143e..586046fc0 100644 --- a/test/org/apache/catalina/core/TestStandardContextAliases.java +++ b/test/org/apache/catalina/core/TestStandardContextAliases.java @@ -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()); diff --git a/test/org/apache/catalina/filters/TestAddCharSetFilter.java b/test/org/apache/catalina/filters/TestAddCharSetFilter.java index 2ed9e86ad..74f618a4c 100644 --- a/test/org/apache/catalina/filters/TestAddCharSetFilter.java +++ b/test/org/apache/catalina/filters/TestAddCharSetFilter.java @@ -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); diff --git a/test/org/apache/catalina/loader/TestVirtualWebappLoader.java b/test/org/apache/catalina/loader/TestVirtualWebappLoader.java index 4e3cdb7d2..d2aa3e216 100644 --- a/test/org/apache/catalina/loader/TestVirtualWebappLoader.java +++ b/test/org/apache/catalina/loader/TestVirtualWebappLoader.java @@ -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(); diff --git a/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java b/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java index f232591b8..887710552 100644 --- a/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java +++ b/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java @@ -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); diff --git a/test/org/apache/catalina/startup/TestTomcat.java b/test/org/apache/catalina/startup/TestTomcat.java index 646a1c9a9..0901c18b9 100644 --- a/test/org/apache/catalina/startup/TestTomcat.java +++ b/test/org/apache/catalina/startup/TestTomcat.java @@ -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 diff --git a/test/org/apache/naming/resources/TestProxyDirContext.java b/test/org/apache/naming/resources/TestProxyDirContext.java index 64954bc18..6977e6c45 100644 --- a/test/org/apache/naming/resources/TestProxyDirContext.java +++ b/test/org/apache/naming/resources/TestProxyDirContext.java @@ -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(); diff --git a/test/org/apache/tomcat/util/http/CookiesBaseTest.java b/test/org/apache/tomcat/util/http/CookiesBaseTest.java index 40ea27040..d8648a1fd 100644 --- a/test/org/apache/tomcat/util/http/CookiesBaseTest.java +++ b/test/org/apache/tomcat/util/http/CookiesBaseTest.java @@ -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"); diff --git a/test/org/apache/tomcat/util/http/TestBug49158.java b/test/org/apache/tomcat/util/http/TestBug49158.java index d5edc177c..e2875b13c 100644 --- a/test/org/apache/tomcat/util/http/TestBug49158.java +++ b/test/org/apache/tomcat/util/http/TestBug49158.java @@ -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);