<property name="tomcat.release" value="${tomcat.output}/release"/>
<property name="tomcat.src.jars" value="${tomcat.output}/src-jars"/>
<property name="test.classes" value="${tomcat.output}/testclasses"/>
+ <property name="test.temp" value="${tomcat.output}/test-tmp"/>
<!-- Servlet 3.0 spec requires 1.6+ -->
<property name="compile.source" value="1.6"/>
<junit printsummary="yes" fork="yes" dir="." showoutput="yes">
<classpath refid="tomcat.test.classpath" />
+ <sysproperty key="tomcat.test.temp" value="${test.temp}" />
+ <sysproperty key="tomcat.test.tomcatbuild" value="${tomcat.build}" />
+
<formatter type="plain" usefile="true" />
<!-- If test.entry is defined, run a single test, otherwise run all valid tests -->
public void testSingleWebapp() throws Exception {
Tomcat tomcat = getTomcatInstance();
- File appDir =
- new File("output/build/webapps/examples");
+ File appDir = new File(getBuildDirectory(), "webapps/examples");
// app dir is relative to server home
tomcat.addWebapp(null, "/examples", appDir.getAbsolutePath());
public void testJsps() throws Exception {
Tomcat tomcat = getTomcatInstance();
- File appDir =
- new File("output/build/webapps/examples");
+ File appDir = new File(getBuildDirectory(), "webapps/examples");
// app dir is relative to server home
tomcat.addWebapp(null, "/examples", appDir.getAbsolutePath());
String contextPath = "/examples";
- File appDir = new File("output/build/webapps" + contextPath);
+ File appDir = new File(getBuildDirectory(), "webapps" + contextPath);
// app dir is relative to server home
org.apache.catalina.Context ctx =
tomcat.addWebapp(null, "/examples", appDir.getAbsolutePath());
tomcat.getConnector().setProperty("SSLEnabled", "true");
tomcat.getConnector().setProperty("sslProtocol",
"tls");
- // test runs in output/tmp
- tomcat.getConnector().setAttribute("keystoreFile",
- "../../test/org/apache/catalina/startup/test.keystore");
+
+ File keystoreFile = new File(
+ "test/org/apache/catalina/startup/test.keystore");
+ tomcat.getConnector().setAttribute("keystoreFile",
+ keystoreFile.getAbsolutePath());
}
public void testSimpleSsl() throws Exception {
Tomcat tomcat = getTomcatInstance();
- File appDir =
- new File("output/build/webapps/examples");
+ File appDir = new File(getBuildDirectory(), "webapps/examples");
tomcat.addWebapp(null, "/examples", appDir.getAbsolutePath());
initSsl(tomcat, nio);
public void renegotiateFail(boolean nio) throws Exception {
Tomcat tomcat = getTomcatInstance();
- File appDir =
- new File("output/build/webapps/examples");
+ File appDir = new File(getBuildDirectory(), "webapps/examples");
// app dir is relative to server home
tomcat.addWebapp(null, "/examples", appDir.getAbsolutePath());
public void renegotiateWorks(boolean nio) throws Exception {
Tomcat tomcat = getTomcatInstance();
- File appDir =
- new File("output/build/webapps/examples");
+ File appDir = new File(getBuildDirectory(), "webapps/examples");
// app dir is relative to server home
tomcat.addWebapp(null, "/examples", appDir.getAbsolutePath());
port++;
return getPort();
}
-
+
+ /**
+ * 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.
+ */
+ public File getBuildDirectory() {
+ return new File(System.getProperty("tomcat.test.tomcatbuild",
+ "output/build"));
+ }
+
@Override
public void setUp() throws Exception {
// Need to use JULI and to configure a ConsoleHandler so log messages
LogManager.getLogManager().getLogger("").addHandler(
new ConsoleHandler());
- tempDir = new File("output/tmp");
+ tempDir = new File(System.getProperty("tomcat.test.temp", "output/tmp"));
tempDir.mkdir();
File appBase = new File(tempDir, "webapps");
appBase.mkdir();