From: markt Date: Mon, 21 Sep 2009 11:06:52 +0000 (+0000) Subject: Update test to use a resource that does exist. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=28686bca6a398b9e6f53847dd450dfa3707541d9;p=tomcat7.0 Update test to use a resource that does exist. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@817207 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/test/org/apache/catalina/startup/TestTomcat.java b/test/org/apache/catalina/startup/TestTomcat.java index 84205698f..9bae9d49c 100644 --- a/test/org/apache/catalina/startup/TestTomcat.java +++ b/test/org/apache/catalina/startup/TestTomcat.java @@ -184,19 +184,20 @@ public class TestTomcat extends TestTomcatBase { public void testGetResource() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - StandardContext ctx = - tomcat.addContext("/", System.getProperty("java.io.tmpdir")); - // You can customize the context by calling - // its API + String contextPath = "/examples"; - Tomcat.addServlet(ctx, "myServlet", new GetResource()); - ctx.addServletMapping("/", "myServlet"); + File appDir = new File("output/build/webapps" + contextPath); + // app dir is relative to server home + StandardContext ctx = + tomcat.addWebapp(null, "/examples", appDir.getAbsolutePath()); + + Tomcat.addServlet(ctx, "testGetResource", new GetResource()); + ctx.addServletMapping("/testGetResource", "testGetResource"); tomcat.start(); - int rc =getUrl("http://localhost:" + getPort() + "/", new ByteChunk(), - null); + int rc =getUrl("http://localhost:" + getPort() + contextPath + + "/testGetResource", new ByteChunk(), null); assertEquals(HttpServletResponse.SC_OK, rc); }