From a844b61bee0c3a2daa4261fe0b4a5c9d10560187 Mon Sep 17 00:00:00 2001 From: markt Date: Sun, 10 Jul 2011 14:40:00 +0000 Subject: [PATCH] Make it easier for tests to override the protocol (e.g. to test AJP) git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1144868 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/catalina/startup/TomcatBaseTest.java | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/test/org/apache/catalina/startup/TomcatBaseTest.java b/test/org/apache/catalina/startup/TomcatBaseTest.java index 52e2dfaeb..517be6ff6 100644 --- a/test/org/apache/catalina/startup/TomcatBaseTest.java +++ b/test/org/apache/catalina/startup/TomcatBaseTest.java @@ -125,14 +125,7 @@ public abstract class TomcatBaseTest extends TestCase { tomcat = new Tomcat(); - // Has a protocol been specified - String protocol = System.getProperty("tomcat.test.protocol"); - - // Use BIO by default - if (protocol == null) { - protocol = "org.apache.coyote.http11.Http11Protocol"; - } - + String protocol = getProtocol(); Connector connector = new Connector(protocol); // If each test is running on same port - they // may interfere with each other @@ -164,6 +157,18 @@ public abstract class TomcatBaseTest extends TestCase { } } + protected String getProtocol() { + // Has a protocol been specified + String protocol = System.getProperty("tomcat.test.protocol"); + + // Use BIO by default + if (protocol == null) { + protocol = "org.apache.coyote.http11.Http11Protocol"; + } + + return protocol; + } + @Override public void tearDown() throws Exception { // Some tests may call tomcat.destroy(), some tests may just call -- 2.11.0