assertEquals("Remaining: " + onames, 0, onames.size());
final Tomcat tomcat = getTomcatInstance();
- final File contextDir = new File("output/webappFoo");
+ final File contextDir = new File(getTemporaryDirectory(), "webappFoo");
contextDir.mkdir();
tomcat.addContext("/foo", contextDir.getAbsolutePath());
tomcat.start();
host.setName("otherhost");
tomcat.getEngine().addChild(host);
- final File contextDir2 = new File("output/webappFoo2");
+ final File contextDir2 = new File(getTemporaryDirectory(), "webappFoo2");
contextDir2.mkdir();
tomcat.addContext(host, "/foo2", contextDir2.getAbsolutePath());
}
/**
+ * Helper method that returns the path of the temporary directory used by
+ * the test runs. The directory is configured during {@link #setUp()} and is
+ * deleted at {@link #tearDown()}.
+ */
+ public File getTemporaryDirectory() {
+ return tempDir;
+ }
+
+ /**
* Helper method that returns the directory where Tomcat build resides. It
* is used to access resources that are part of default Tomcat deployment.
* E.g. the examples webapp.
"org.apache.juli.ClassLoaderLogManager");
tempDir = new File(System.getProperty("tomcat.test.temp", "output/tmp"));
- if (!tempDir.exists() && !tempDir.mkdir()) {
+ if (!tempDir.exists() && !tempDir.mkdirs()) {
fail("Unable to create temporary directory for test");
}