You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2011/11/06 22:25:24 UTC
svn commit: r1198568 - in /tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util:
http/ net/ net/jsse/ res/ threads/
Author: kkolinko
Date: Sun Nov 6 21:25:23 2011
New Revision: 1198568
URL: http://svn.apache.org/viewvc?rev=1198568&view=rev
Log:
Porting r1187806 - whitespace cleanup in /test
Modified:
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestBug49158.java
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookies.java
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowEquals.java
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowHttpSeps.java
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowNameOnly.java
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesDefaultSysProps.java
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesDisallowEquals.java
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesNoFwdStrictSysProps.java
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesNoStrictNamingSysProps.java
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesStrictSysProps.java
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TestClientCert.java
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TestCustomSsl.java
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TestSsl.java
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TestXxxEndpoint.java
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TesterSupport.java
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/jsse/TesterBug50640SslImpl.java
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/res/TestStringManager.java
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/threads/TestLimitLatch.java
Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestBug49158.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestBug49158.java?rev=1198568&r1=1198567&r2=1198568&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestBug49158.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestBug49158.java Sun Nov 6 21:25:23 2011
@@ -44,7 +44,7 @@ import org.apache.tomcat.util.buf.ByteCh
*/
public class TestBug49158 extends CookiesBaseTest {
public static final String path = "49158";
-
+
@Override
@Test
public void testCookiesInstance() throws Exception {
@@ -52,22 +52,22 @@ public class TestBug49158 extends Cookie
addServlets(tomcat);
tomcat.start();
Map<String,List<String>> headers = new HashMap<String,List<String>>();
- ByteChunk res = new ByteChunk();
+ ByteChunk res = new ByteChunk();
getUrl("http://localhost:" + getPort() + "/"+path, res, headers);
List<String> cookieHeaders = headers.get("Set-Cookie");
assertEquals("There should only be one Set-Cookie header in this test",
1, cookieHeaders.size());
}
-
+
public static void addServlets(Tomcat tomcat) {
// Must have a real docBase - just use temp
- Context ctx =
+ Context ctx =
tomcat.addContext("", System.getProperty("java.io.tmpdir"));
Tomcat.addServlet(ctx, path, new TestBug49158Servlet());
ctx.addServletMapping("/"+path, path);
}
-
+
public static class TestBug49158Servlet extends HttpServlet {
private static final long serialVersionUID = 2725990508758127399L;
@@ -81,7 +81,7 @@ public class TestBug49158 extends Cookie
session.invalidate();
req.getSession();
}
-
+
}
-
+
}
Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookies.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookies.java?rev=1198568&r1=1198567&r2=1198568&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookies.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookies.java Sun Nov 6 21:25:23 2011
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.tomcat.util.http;
+package org.apache.tomcat.util.http;
import org.junit.Test;
@@ -30,8 +30,8 @@ public class TestCookies {
test("foo=bar;a=b; ;", "foo", "bar", "a", "b");
test("foo=;a=b; ;", "a", "b");
test("foo;a=b; ;", "a", "b");
- // v1
- test("$Version=1; foo=bar;a=b", "foo", "bar", "a", "b");
+ // v1
+ test("$Version=1; foo=bar;a=b", "foo", "bar", "a", "b");
// OK
test("$Version=1;foo=bar;a=b; ; ", "foo", "bar", "a", "b");
@@ -59,10 +59,10 @@ public class TestCookies {
// Last character is an escape character
test("$Version=1;foo=b'ar;$Domain=\"apache.org\";$Port=8080;a=\"b\\\"", "foo", "b'ar");
test("$Version=1;foo=b'ar;$Domain=\"apache.org\";$Port=8080;a=\"b\\", "foo", "b'ar");
-
+
// A token cannot be quoted with ' chars - they should be treated as part of the value
test("$Version=\"1\"; foo='bar'; $Path=/path; $Domain=\"localhost\"", "foo", "'bar'");
-
+
// wrong, path should not have '/' JVK
test("$Version=1;foo=\"bar\";$Path=/examples;a=b; ; ", "foo", "bar", "a", "b");
@@ -76,7 +76,7 @@ public class TestCookies {
test("foo;a=b;bar ;", "a", "b");
// Multiple delimiters next to each other
-
+
// BUG -- the ' ' needs to be skipped.
test("foo;a=b; ;bar", "a", "b");
// BUG -- ';' needs skipping
@@ -88,7 +88,7 @@ public class TestCookies {
// '#' is a valid cookie name (not a separator)
test("foo;a=b;;#;bar=rab","a", "b", "bar", "rab");
-
+
test("foo;a=b;;\\;bar=rab", "a", "b", "bar", "rab");
// Try all the separators of version1 in version0 cookie.
Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowEquals.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowEquals.java?rev=1198568&r1=1198567&r2=1198568&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowEquals.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowEquals.java Sun Nov 6 21:25:23 2011
@@ -48,7 +48,7 @@ public class TestCookiesAllowEquals exte
TestCookieEqualsClient client = new TestCookieEqualsClient();
client.doRequest();
}
-
+
private class TestCookieEqualsClient extends SimpleHttpClient {
@@ -57,12 +57,12 @@ public class TestCookiesAllowEquals exte
Context root = tomcat.addContext("", TEMP_DIR);
Tomcat.addServlet(root, "Simple", new SimpleServlet());
root.addServletMapping("/test", "Simple");
-
+
tomcat.start();
// Open connection
setPort(tomcat.getConnector().getPort());
connect();
-
+
String[] request = new String[1];
request[0] =
"GET /test HTTP/1.0" + CRLF +
@@ -72,7 +72,7 @@ public class TestCookiesAllowEquals exte
setRequest(request);
processRequest(true); // blocks until response has been read
String response = getResponseBody();
-
+
// Close the connection
disconnect();
reset();
@@ -80,15 +80,15 @@ public class TestCookiesAllowEquals exte
assertEquals(COOKIE_WITH_EQUALS_1 + COOKIE_WITH_EQUALS_2 +
COOKIE_WITH_EQUALS_3, response);
}
-
+
@Override
public boolean isResponseBodyOK() {
return true;
}
-
+
}
-
-
+
+
private static class SimpleServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@@ -103,7 +103,7 @@ public class TestCookiesAllowEquals exte
}
resp.flushBuffer();
}
-
+
}
-
+
}
Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowHttpSeps.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowHttpSeps.java?rev=1198568&r1=1198567&r2=1198568&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowHttpSeps.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowHttpSeps.java Sun Nov 6 21:25:23 2011
@@ -46,7 +46,7 @@ public class TestCookiesAllowHttpSeps ex
TestCookieHttpSepClient client = new TestCookieHttpSepClient();
client.doRequest();
}
-
+
private class TestCookieHttpSepClient extends SimpleHttpClient {
@@ -55,12 +55,12 @@ public class TestCookiesAllowHttpSeps ex
Context root = tomcat.addContext("", TEMP_DIR);
Tomcat.addServlet(root, "Simple", new SimpleServlet());
root.addServletMapping("/test", "Simple");
-
+
tomcat.start();
// Open connection
setPort(tomcat.getConnector().getPort());
connect();
-
+
String[] request = new String[1];
request[0] =
"GET /test HTTP/1.0" + CRLF +
@@ -68,22 +68,22 @@ public class TestCookiesAllowHttpSeps ex
setRequest(request);
processRequest(true); // blocks until response has been read
String response = getResponseBody();
-
+
// Close the connection
disconnect();
reset();
tomcat.stop();
assertEquals(COOKIE_WITH_SEPS, response);
}
-
+
@Override
public boolean isResponseBodyOK() {
return true;
}
-
+
}
-
-
+
+
private static class SimpleServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@@ -98,7 +98,7 @@ public class TestCookiesAllowHttpSeps ex
}
resp.flushBuffer();
}
-
+
}
-
+
}
Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowNameOnly.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowNameOnly.java?rev=1198568&r1=1198567&r2=1198568&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowNameOnly.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowNameOnly.java Sun Nov 6 21:25:23 2011
@@ -47,7 +47,7 @@ public class TestCookiesAllowNameOnly ex
TestCookieNameOnlyClient client = new TestCookieNameOnlyClient();
client.doRequest();
}
-
+
private class TestCookieNameOnlyClient extends SimpleHttpClient {
@@ -56,12 +56,12 @@ public class TestCookiesAllowNameOnly ex
Context root = tomcat.addContext("", TEMP_DIR);
Tomcat.addServlet(root, "Simple", new SimpleServlet());
root.addServletMapping("/test", "Simple");
-
+
tomcat.start();
// Open connection
setPort(tomcat.getConnector().getPort());
connect();
-
+
String[] request = new String[1];
request[0] =
"GET /test HTTP/1.0" + CRLF +
@@ -70,7 +70,7 @@ public class TestCookiesAllowNameOnly ex
setRequest(request);
processRequest(true); // blocks until response has been read
String response = getResponseBody();
-
+
// Close the connection
disconnect();
reset();
@@ -79,15 +79,15 @@ public class TestCookiesAllowNameOnly ex
assertEquals(COOKIE_WITH_NAME_ONLY_1 + "=" +
COOKIE_WITH_NAME_ONLY_2, response);
}
-
+
@Override
public boolean isResponseBodyOK() {
return true;
}
-
+
}
-
-
+
+
private static class SimpleServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@@ -102,7 +102,7 @@ public class TestCookiesAllowNameOnly ex
}
resp.flushBuffer();
}
-
+
}
-
+
}
Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesDefaultSysProps.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesDefaultSysProps.java?rev=1198568&r1=1198567&r2=1198568&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesDefaultSysProps.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesDefaultSysProps.java Sun Nov 6 21:25:23 2011
@@ -43,9 +43,9 @@ public class TestCookiesDefaultSysProps
Tomcat tomcat = getTomcatInstance();
addServlets(tomcat);
-
+
tomcat.start();
-
+
ByteChunk res = getUrl("http://localhost:" + getPort() + "/invalid");
assertEquals("Cookie name fail", res.toString());
res = getUrl("http://localhost:" + getPort() + "/null");
@@ -68,5 +68,5 @@ public class TestCookiesDefaultSysProps
}
}
-
+
}
Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesDisallowEquals.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesDisallowEquals.java?rev=1198568&r1=1198567&r2=1198568&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesDisallowEquals.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesDisallowEquals.java Sun Nov 6 21:25:23 2011
@@ -43,7 +43,7 @@ public class TestCookiesDisallowEquals e
TestCookieEqualsClient client = new TestCookieEqualsClient();
client.doRequest();
}
-
+
private class TestCookieEqualsClient extends SimpleHttpClient {
@@ -52,12 +52,12 @@ public class TestCookiesDisallowEquals e
Context root = tomcat.addContext("", TEMP_DIR);
Tomcat.addServlet(root, "Simple", new SimpleServlet());
root.addServletMapping("/test", "Simple");
-
+
tomcat.start();
// Open connection
setPort(tomcat.getConnector().getPort());
connect();
-
+
String[] request = new String[1];
request[0] =
"GET /test HTTP/1.0" + CRLF +
@@ -65,22 +65,22 @@ public class TestCookiesDisallowEquals e
setRequest(request);
processRequest(true); // blocks until response has been read
String response = getResponseBody();
-
+
// Close the connection
disconnect();
reset();
tomcat.stop();
assertEquals(COOKIE_TRUNCATED, response);
}
-
+
@Override
public boolean isResponseBodyOK() {
return true;
}
-
+
}
-
-
+
+
private static class SimpleServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@@ -95,7 +95,7 @@ public class TestCookiesDisallowEquals e
}
resp.flushBuffer();
}
-
+
}
-
+
}
Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesNoFwdStrictSysProps.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesNoFwdStrictSysProps.java?rev=1198568&r1=1198567&r2=1198568&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesNoFwdStrictSysProps.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesNoFwdStrictSysProps.java Sun Nov 6 21:25:23 2011
@@ -31,7 +31,7 @@ import org.apache.tomcat.util.buf.ByteCh
* to facilitate this when running the unit tests via Ant.
*/
public class TestCookiesNoFwdStrictSysProps extends CookiesBaseTest {
-
+
@Override
@Test
public void testCookiesInstance() throws Exception {
@@ -40,13 +40,13 @@ public class TestCookiesNoFwdStrictSysPr
"true");
System.setProperty("org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR",
"false");
-
+
Tomcat tomcat = getTomcatInstance();
addServlets(tomcat);
-
+
tomcat.start();
-
+
ByteChunk res = getUrl("http://localhost:" + getPort() + "/invalid");
assertEquals("Cookie name fail", res.toString());
res = getUrl("http://localhost:" + getPort() + "/null");
@@ -61,5 +61,5 @@ public class TestCookiesNoFwdStrictSysPr
assertEquals("Cookie name ok", res.toString());
}
-
+
}
Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesNoStrictNamingSysProps.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesNoStrictNamingSysProps.java?rev=1198568&r1=1198567&r2=1198568&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesNoStrictNamingSysProps.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesNoStrictNamingSysProps.java Sun Nov 6 21:25:23 2011
@@ -35,18 +35,18 @@ public class TestCookiesNoStrictNamingSy
@Override
@Test
public void testCookiesInstance() throws Exception {
-
+
System.setProperty("org.apache.catalina.STRICT_SERVLET_COMPLIANCE",
"true");
System.setProperty("org.apache.tomcat.util.http.ServerCookie.STRICT_NAMING",
"false");
-
+
Tomcat tomcat = getTomcatInstance();
-
+
addServlets(tomcat);
-
+
tomcat.start();
-
+
ByteChunk res = getUrl("http://localhost:" + getPort() + "/invalid");
assertEquals("Cookie name fail", res.toString());
res = getUrl("http://localhost:" + getPort() + "/null");
@@ -59,6 +59,6 @@ public class TestCookiesNoStrictNamingSy
assertEquals("Cookie name ok", res.toString());
res = getUrl("http://localhost:" + getPort() + "/valid");
assertEquals("Cookie name ok", res.toString());
-
+
}
}
Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesStrictSysProps.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesStrictSysProps.java?rev=1198568&r1=1198567&r2=1198568&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesStrictSysProps.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesStrictSysProps.java Sun Nov 6 21:25:23 2011
@@ -42,13 +42,13 @@ public class TestCookiesStrictSysProps e
System.setProperty("org.apache.catalina.STRICT_SERVLET_COMPLIANCE",
"true");
-
+
Tomcat tomcat = getTomcatInstance();
-
+
addServlets(tomcat);
-
+
tomcat.start();
-
+
ByteChunk res = getUrl("http://localhost:" + getPort() + "/invalid");
assertEquals("Cookie name fail", res.toString());
res = getUrl("http://localhost:" + getPort() + "/null");
@@ -61,7 +61,7 @@ public class TestCookiesStrictSysProps e
assertEquals("Cookie name fail", res.toString());
res = getUrl("http://localhost:" + getPort() + "/valid");
assertEquals("Cookie name ok", res.toString());
-
+
// Need to read response headers to test version switching
Map<String,List<String>> headers = new HashMap<String,List<String>>();
getUrl("http://localhost:" + getPort() + "/switch", res, headers);
@@ -69,7 +69,7 @@ public class TestCookiesStrictSysProps e
for (String cookieHeader : cookieHeaders) {
assertEquals("name=\"val?ue\"; Version=1", cookieHeader);
}
-
+
}
-
+
}
Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TestClientCert.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TestClientCert.java?rev=1198568&r1=1198567&r2=1198568&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TestClientCert.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TestClientCert.java Sun Nov 6 21:25:23 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,7 +43,7 @@ public class TestClientCert extends Tomc
ByteChunk res =
getUrl("https://localhost:" + getPort() + "/unprotected");
assertEquals("OK", res.toString());
-
+
// Protected resource
res = getUrl("https://localhost:" + getPort() + "/protected");
assertEquals("OK", res.toString());
@@ -52,21 +52,21 @@ public class TestClientCert extends Tomc
@Test
public void testClientCertPostSmaller() throws Exception {
Tomcat tomcat = getTomcatInstance();
- int bodySize = tomcat.getConnector().getMaxSavePostSize() / 2;
+ int bodySize = tomcat.getConnector().getMaxSavePostSize() / 2;
doTestClientCertPost(bodySize, false);
}
@Test
public void testClientCertPostSame() throws Exception {
Tomcat tomcat = getTomcatInstance();
- int bodySize = tomcat.getConnector().getMaxSavePostSize();
+ int bodySize = tomcat.getConnector().getMaxSavePostSize();
doTestClientCertPost(bodySize, false);
}
@Test
public void testClientCertPostLarger() throws Exception {
Tomcat tomcat = getTomcatInstance();
- int bodySize = tomcat.getConnector().getMaxSavePostSize() * 2;
+ int bodySize = tomcat.getConnector().getMaxSavePostSize() * 2;
doTestClientCertPost(bodySize, true);
}
@@ -83,7 +83,7 @@ public class TestClientCert extends Tomc
ByteChunk res = postUrl(body,
"https://localhost:" + getPort() + "/unprotected");
assertEquals("OK-" + bodySize, res.toString());
-
+
// Protected resource
res.recycle();
int rc = postUrl(body, "https://localhost:" + getPort() + "/protected",
@@ -107,10 +107,10 @@ public class TestClientCert extends Tomc
Tomcat tomcat = getTomcatInstance();
TesterSupport.configureClientCertContext(tomcat);
-
+
// Start Tomcat
tomcat.start();
-
+
TesterSupport.configureClientSsl();
}
}
Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TestCustomSsl.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TestCustomSsl.java?rev=1198568&r1=1198567&r2=1198568&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TestCustomSsl.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TestCustomSsl.java Sun Nov 6 21:25:23 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -54,19 +54,19 @@ public class TestCustomSsl extends Tomca
return;
}
- connector.setProperty("sslImplementationName",
+ connector.setProperty("sslImplementationName",
"org.apache.tomcat.util.net.jsse.TesterBug50640SslImpl");
connector.setProperty(TesterBug50640SslImpl.PROPERTY_NAME,
TesterBug50640SslImpl.PROPERTY_VALUE);
-
+
connector.setProperty("sslProtocol", "tls");
-
+
File keystoreFile =
new File("test/org/apache/tomcat/util/net/localhost.jks");
connector.setAttribute(
"keystoreFile", keystoreFile.getAbsolutePath());
- connector.setSecure(true);
+ connector.setSecure(true);
connector.setProperty("SSLEnabled", "true");
File appDir = new File(getBuildDirectory(), "webapps/examples");
@@ -87,10 +87,10 @@ public class TestCustomSsl extends Tomca
public void testCustomTrustManager2() throws Exception {
doTestCustomTrustManager(true);
}
-
+
private void doTestCustomTrustManager(boolean serverTrustAll)
throws Exception {
-
+
if (!TesterSupport.RFC_5746_SUPPORTED) {
// Make sure SSL renegotiation is not disabled in the JVM
System.setProperty("sun.security.ssl.allowUnsafeRenegotiation",
@@ -104,7 +104,7 @@ public class TestCustomSsl extends Tomca
}
TesterSupport.configureClientCertContext(tomcat);
-
+
// Override the defaults
ProtocolHandler handler = tomcat.getConnector().getProtocolHandler();
if (handler instanceof AbstractHttp11JsseProtocol) {
@@ -117,17 +117,17 @@ public class TestCustomSsl extends Tomca
tomcat.getConnector().setAttribute("trustManagerClassName",
"org.apache.tomcat.util.net.TesterSupport$TrustAllCerts");
}
-
+
// Start Tomcat
tomcat.start();
-
+
TesterSupport.configureClientSsl();
// Unprotected resource
ByteChunk res =
getUrl("https://localhost:" + getPort() + "/unprotected");
assertEquals("OK", res.toString());
-
+
// Protected resource
res.recycle();
int rc = -1;
Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TestSsl.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TestSsl.java?rev=1198568&r1=1198567&r2=1198568&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TestSsl.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TestSsl.java Sun Nov 6 21:25:23 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -49,12 +49,12 @@ public class TestSsl extends TomcatBaseT
@Test
public void testSimpleSsl() throws Exception {
TesterSupport.configureClientSsl();
-
+
Tomcat tomcat = getTomcatInstance();
File appDir = new File(getBuildDirectory(), "webapps/examples");
tomcat.addWebapp(null, "/examples", appDir.getAbsolutePath());
-
+
TesterSupport.initSsl(tomcat);
tomcat.start();
@@ -66,12 +66,12 @@ public class TestSsl extends TomcatBaseT
@Test
public void testKeyPass() throws Exception {
TesterSupport.configureClientSsl();
-
+
Tomcat tomcat = getTomcatInstance();
File appDir = new File(getBuildDirectory(), "webapps/examples");
tomcat.addWebapp(null, "/examples", appDir.getAbsolutePath());
-
+
TesterSupport.initSsl(tomcat, "localhost-copy1.jks", "changeit",
"tomcatpass");
@@ -86,7 +86,7 @@ public class TestSsl extends TomcatBaseT
@Test
public void testRenegotiateFail() throws Exception {
-
+
// If RFC5746 is supported, renegotiation will always work (and will
// always be secure)
if (TesterSupport.RFC_5746_SUPPORTED) {
@@ -102,7 +102,7 @@ public class TestSsl extends TomcatBaseT
TesterSupport.initSsl(tomcat);
// Default - MITM attack prevented
-
+
tomcat.start();
SSLContext sslCtx = SSLContext.getInstance("TLS");
sslCtx.init(null, TesterSupport.getTrustManagers(), null);
@@ -115,12 +115,12 @@ public class TestSsl extends TomcatBaseT
handshakeDone = true;
}
});
-
+
OutputStream os = socket.getOutputStream();
os.write("GET /examples/servlets/servlet/HelloWorldExample HTTP/1.0\n".getBytes());
os.flush();
-
+
InputStream is = socket.getInputStream();
// Make sure the NIO connector has read the request before the handshake
@@ -129,7 +129,7 @@ public class TestSsl extends TomcatBaseT
socket.startHandshake();
os = socket.getOutputStream();
-
+
try {
os.write("Host: localhost\n\n".getBytes());
} catch (IOException ex) {
@@ -148,7 +148,7 @@ public class TestSsl extends TomcatBaseT
// success - we timed-out without handshake
return;
}
-
+
fail("Re-negotiation worked");
}
@@ -165,7 +165,7 @@ public class TestSsl extends TomcatBaseT
tomcat.addWebapp(null, "/examples", appDir.getAbsolutePath());
TesterSupport.initSsl(tomcat);
-
+
tomcat.start();
SSLContext sslCtx = SSLContext.getInstance("TLS");
Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TestXxxEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TestXxxEndpoint.java?rev=1198568&r1=1198567&r2=1198568&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TestXxxEndpoint.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TestXxxEndpoint.java Sun Nov 6 21:25:23 2011
@@ -57,7 +57,7 @@ public class TestXxxEndpoint extends Tom
}
}
- private long createAprSocket(int port, long pool)
+ private long createAprSocket(int port, long pool)
throws Exception {
/**
* Server socket "pointer".
@@ -117,11 +117,11 @@ public class TestXxxEndpoint extends Tom
Tomcat tomcat = getTomcatInstance();
File appDir = new File(getBuildDirectory(), "webapps/examples");
tomcat.addWebapp(null, "/examples", appDir.getAbsolutePath());
-
+
int port = getPort();
tomcat.start();
-
+
tomcat.getConnector().stop();
Exception e = null;
ServerSocket s = null;
@@ -161,14 +161,14 @@ public class TestXxxEndpoint extends Tom
Tomcat tomcat = getTomcatInstance();
Connector c = tomcat.getConnector();
c.setProperty("bindOnInit", "false");
-
+
File appDir = new File(getBuildDirectory(), "webapps/examples");
tomcat.addWebapp(null, "/examples", appDir.getAbsolutePath());
-
+
int port = getPort();
tomcat.start();
-
+
tomcat.getConnector().stop();
Exception e = null;
ServerSocket s = null;
Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TesterSupport.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TesterSupport.java?rev=1198568&r1=1198567&r2=1198568&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TesterSupport.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/TesterSupport.java Sun Nov 6 21:25:23 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -52,7 +52,7 @@ import org.apache.catalina.startup.TestT
import org.apache.catalina.startup.Tomcat;
public final class TesterSupport {
-
+
protected static final boolean RFC_5746_SUPPORTED;
static {
@@ -80,7 +80,7 @@ public final class TesterSupport {
protected static void initSsl(Tomcat tomcat) {
initSsl(tomcat, "localhost.jks", null, null);
}
-
+
protected static void initSsl(Tomcat tomcat, String keystore,
String keystorePass, String keyPass) {
@@ -112,10 +112,10 @@ public final class TesterSupport {
tomcat.getConnector().setAttribute("SSLCertificateKeyFile",
keystoreFile.getAbsolutePath());
}
- tomcat.getConnector().setSecure(true);
+ tomcat.getConnector().setSecure(true);
tomcat.getConnector().setProperty("SSLEnabled", "true");
}
-
+
protected static KeyManager[] getUser1KeyManagers() throws Exception {
KeyManagerFactory kmf = KeyManagerFactory.getInstance(
KeyManagerFactory.getDefaultAlgorithm());
@@ -123,7 +123,7 @@ public final class TesterSupport {
"changeit".toCharArray());
return kmf.getKeyManagers();
}
-
+
protected static TrustManager[] getTrustManagers() throws Exception {
TrustManagerFactory tmf = TrustManagerFactory.getInstance(
TrustManagerFactory.getDefaultAlgorithm());
@@ -142,7 +142,7 @@ public final class TesterSupport {
new TesterSSLSocketFactory(sc.getSocketFactory()));
} catch (Exception e) {
e.printStackTrace();
- }
+ }
}
private static KeyStore getKeyStore(String keystore) throws Exception {
@@ -163,19 +163,19 @@ public final class TesterSupport {
}
return ks;
}
-
+
protected static boolean isRenegotiationSupported(Tomcat tomcat) {
String protocol = tomcat.getConnector().getProtocolHandlerClassName();
if (protocol.contains("Apr")) {
// Disabled by default in 1.1.20 windows binary (2010-07-27)
- return false;
+ return false;
}
return true;
}
-
+
protected static void configureClientCertContext(Tomcat tomcat) {
TesterSupport.initSsl(tomcat);
-
+
// Need a web application with a protected and unprotected URL
// Must have a real docBase - just use temp
Context ctx =
@@ -198,7 +198,7 @@ public final class TesterSupport {
realm.addUser("CN=user1, C=US", "not used");
realm.addUserRole("CN=user1, C=US", "testrole");
ctx.setRealm(realm);
-
+
// Configure the authenticator
LoginConfig lc = new LoginConfig();
lc.setAuthMethod("CLIENT-CERT");
@@ -211,14 +211,14 @@ public final class TesterSupport {
public static class SimpleServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
-
+
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
resp.setContentType("text/plain");
resp.getWriter().print("OK");
}
-
+
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
@@ -237,29 +237,29 @@ public final class TesterSupport {
}
// len will have been -1 on last iteration
read++;
-
+
// Report the number of bytes read
resp.setContentType("text/plain");
- if (contentOK)
+ if (contentOK)
resp.getWriter().print("OK-" + read);
else
resp.getWriter().print("CONTENT-MISMATCH-" + read);
}
}
-
+
public static class TrustAllCerts implements X509TrustManager {
-
+
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
-
+
@Override
public void checkClientTrusted(X509Certificate[] certs,
String authType) {
// NOOP - Trust everything
}
-
+
@Override
public void checkServerTrusted(X509Certificate[] certs,
String authType) {
Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/jsse/TesterBug50640SslImpl.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/jsse/TesterBug50640SslImpl.java?rev=1198568&r1=1198567&r2=1198568&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/jsse/TesterBug50640SslImpl.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/net/jsse/TesterBug50640SslImpl.java Sun Nov 6 21:25:23 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,14 +20,14 @@ import org.apache.tomcat.util.net.Abstra
import org.apache.tomcat.util.net.ServerSocketFactory;
public class TesterBug50640SslImpl extends JSSEImplementation {
-
+
public static final String PROPERTY_NAME = "bug50640";
public static final String PROPERTY_VALUE = "pass";
@Override
public ServerSocketFactory getServerSocketFactory(
AbstractEndpoint endpoint) {
-
+
// Check the custom attribute is visible & correcly set
String flag = endpoint.getProperty(PROPERTY_NAME);
if (PROPERTY_VALUE.equals(flag)) {
@@ -35,6 +35,6 @@ public class TesterBug50640SslImpl exten
} else {
return null;
}
- }
+ }
}
Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/res/TestStringManager.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/res/TestStringManager.java?rev=1198568&r1=1198567&r2=1198568&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/res/TestStringManager.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/res/TestStringManager.java Sun Nov 6 21:25:23 2011
@@ -29,7 +29,7 @@ public class TestStringManager {
@Test
public void testNullKey() {
boolean iaeThrown = false;
-
+
try {
sm.getString(null);
} catch (IllegalArgumentException iae) {
Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/threads/TestLimitLatch.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/threads/TestLimitLatch.java?rev=1198568&r1=1198567&r2=1198568&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/threads/TestLimitLatch.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/threads/TestLimitLatch.java Sun Nov 6 21:25:23 2011
@@ -93,19 +93,19 @@ public class TestLimitLatch {
}
private static class TestThread extends Thread {
-
+
private int holdTime;
private LimitLatch latch;
public TestThread(LimitLatch latch) {
this(latch, 100);
}
-
+
public TestThread(LimitLatch latch, int holdTime) {
this.latch = latch;
this.holdTime = holdTime;
}
-
+
@Override
public void run() {
try {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org