Ensure appBase is valid. Prevents spurious stacktraces in tests
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 8 Feb 2010 16:25:13 +0000 (16:25 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 8 Feb 2010 16:25:13 +0000 (16:25 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@907717 13f79535-47bb-0310-9956-ffa450edef68

test/org/apache/catalina/startup/TomcatBaseTest.java

index 01ce0da..167c8ac 100644 (file)
@@ -44,7 +44,7 @@ import junit.framework.TestCase;
 public abstract class TomcatBaseTest extends TestCase {
     private Tomcat tomcat;
     private File tempDir;
-    private static int port = 8001;
+    private static int port = 8000;
 
     /**
      * Make Tomcat instance accessible to sub-classes.
@@ -79,15 +79,16 @@ public abstract class TomcatBaseTest extends TestCase {
 
         tempDir = new File("output/tmp");
         tempDir.mkdir();
+        File appBase = new File(tempDir, "webapps");
+        appBase.mkdir();
         
         tomcat = new Tomcat();
         tomcat.setBaseDir(tempDir.getAbsolutePath());
-        tomcat.getHost().setAppBase(tempDir.getAbsolutePath() + "/webapps");
+        tomcat.getHost().setAppBase(appBase.getAbsolutePath());
           
         // If each test is running on same port - they
         // may interfere with each other (on unix at least)
-        port++;
-        tomcat.setPort(port);
+        tomcat.setPort(getNextPort());
     }
     
     @Override