You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2009/09/21 13:06:55 UTC

svn commit: r817207 - /tomcat/trunk/test/org/apache/catalina/startup/TestTomcat.java

Author: markt
Date: Mon Sep 21 11:06:52 2009
New Revision: 817207

URL: http://svn.apache.org/viewvc?rev=817207&view=rev
Log:
Update test to use a resource that does exist.

Modified:
    tomcat/trunk/test/org/apache/catalina/startup/TestTomcat.java

Modified: tomcat/trunk/test/org/apache/catalina/startup/TestTomcat.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TestTomcat.java?rev=817207&r1=817206&r2=817207&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/startup/TestTomcat.java (original)
+++ tomcat/trunk/test/org/apache/catalina/startup/TestTomcat.java Mon Sep 21 11:06:52 2009
@@ -184,19 +184,20 @@
     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);
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org