execute.test.nio=true
# Still requires APR/native library to be present
execute.test.apr=true
+# Stop testing if a failure occurs
test.haltonfailure=false
+# Activate AccessLog during testing
+test.accesslog=false
# Workaround against http://bugs.sun.com/view_bug.do?bug_id=6202721
test.jvmarg.egd=-Djava.security.egd=file:/dev/./urandom
<sysproperty key="tomcat.test.temp" value="${test.temp}" />
<sysproperty key="tomcat.test.tomcatbuild" value="${tomcat.build}" />
<sysproperty key="tomcat.test.protocol" value="@{protocol}" />
+ <sysproperty key="tomcat.test.accesslog" value="${test.accesslog}" />
<formatter type="plain" usefile="true" extension="@{extension}"/>
};
}
+ private String[] optionalMBeanNames(String host, String context) {
+ if (isAccessLogEnabled()) {
+ return new String[] {
+ "Tomcat:type=Valve,host=" + host + ",name=AccessLogValve",
+ };
+ } else {
+ return new String[] { };
+ }
+ }
+
private static String[] contextMBeanNames(String host, String context) {
return new String[] {
"Tomcat:j2eeType=WebModule,name=//" + host + context +
expected.addAll(Arrays.asList(hostMBeanNames("localhost")));
expected.addAll(Arrays.asList(contextMBeanNames("localhost", contextName)));
expected.addAll(Arrays.asList(connectorMBeanNames(Integer.toString(getPort()), protocol)));
+ expected.addAll(Arrays.asList(optionalMBeanNames("localhost", contextName)));
// Did we find all expected MBeans?
ArrayList<String> missing = new ArrayList<String>(expected);
import org.apache.catalina.connector.Connector;
import org.apache.catalina.core.AprLifecycleListener;
import org.apache.catalina.core.StandardServer;
+import org.apache.catalina.valves.AccessLogValve;
import org.apache.tomcat.util.buf.ByteChunk;
/**
public abstract class TomcatBaseTest extends TestCase {
private Tomcat tomcat;
private File tempDir;
+ private boolean accessLogEnabled = false;
private static int port = 8000;
public static final String TEMP_DIR = System.getProperty("java.io.tmpdir");
"output/build"));
}
+ /**
+ * Sub-classes may want to check, whether an AccessLogValve is active
+ */
+ public boolean isAccessLogEnabled() {
+ return accessLogEnabled;
+ }
+
@Override
public void setUp() throws Exception {
// Need to use JULI so log messages from the tests are visible
tomcat.setBaseDir(tempDir.getAbsolutePath());
tomcat.getHost().setAppBase(appBase.getAbsolutePath());
+
+ accessLogEnabled = Boolean.parseBoolean(
+ System.getProperty("tomcat.test.accesslog", "false"));
+ if (accessLogEnabled) {
+ AccessLogValve alv = new AccessLogValve();
+ alv.setDirectory(getBuildDirectory() + "/logs");
+ alv.setPattern("%h %l %u %t \"%r\" %s %b %I %D");
+ tomcat.getHost().getPipeline().addValve(alv);
+ }
}
@Override
Fix regression producing invalid MBean names when using IPV6
addresses for connectors. (rjung)
</fix>
+ <add>
+ Add option to activate AccessLog for unit tests. (rjung)
+ </add>
</changelog>
</subsection>
<subsection name="Cluster">