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:19:44 UTC
svn commit: r1198562 - in /tomcat/tc7.0.x/trunk/test/org/apache: coyote/ajp/
coyote/http11/ coyote/http11/filters/ naming/resources/
Author: kkolinko
Date: Sun Nov 6 21:19:43 2011
New Revision: 1198562
URL: http://svn.apache.org/viewvc?rev=1198562&view=rev
Log:
Porting r1187806 - whitespace cleanup in /test
Modified:
tomcat/tc7.0.x/trunk/test/org/apache/coyote/ajp/SimpleAjpClient.java
tomcat/tc7.0.x/trunk/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
tomcat/tc7.0.x/trunk/test/org/apache/coyote/ajp/TesterAjpMessage.java
tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java
tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestGzipOutputFilter.java
tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestInternalInputBuffer.java
tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java
tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestDirContextURLStreamHandlerFactory.java
tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestProxyDirContext.java
tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestWarDirContext.java
tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TesterFactory.java
tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TesterObject.java
Modified: tomcat/tc7.0.x/trunk/test/org/apache/coyote/ajp/SimpleAjpClient.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/coyote/ajp/SimpleAjpClient.java?rev=1198562&r1=1198561&r2=1198562&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/coyote/ajp/SimpleAjpClient.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/coyote/ajp/SimpleAjpClient.java Sun Nov 6 21:19:43 2011
@@ -31,7 +31,7 @@ public class SimpleAjpClient {
private static final int AJP_PACKET_SIZE = 8192;
private static final byte[] AJP_CPING;
-
+
static {
TesterAjpMessage ajpCping = new TesterAjpMessage(16);
ajpCping.reset();
@@ -45,19 +45,19 @@ public class SimpleAjpClient {
private String host = "localhost";
private int port = -1;
private Socket socket = null;
-
+
public void setPort(int port) {
this.port = port;
}
-
+
public int getPort() {
return port;
}
-
+
public void connect() throws IOException {
socket = SocketFactory.getDefault().createSocket(host, port);
}
-
+
public void disconnect() throws IOException {
socket.close();
socket = null;
@@ -69,17 +69,17 @@ public class SimpleAjpClient {
public TesterAjpMessage createForwardMessage(String url) {
TesterAjpMessage message = new TesterAjpMessage(AJP_PACKET_SIZE);
message.reset();
-
+
// Set the header bytes
message.getBuffer()[0] = 0x12;
message.getBuffer()[1] = 0x34;
-
+
// Code 2 for forward request
message.appendByte(Constants.JK_AJP13_FORWARD_REQUEST);
// HTTP method, GET = 2
message.appendByte(0x02);
-
+
// Protocol
message.appendString("http");
@@ -91,19 +91,19 @@ public class SimpleAjpClient {
// Remote host
message.appendString("client.dev.local");
-
+
// Server name
message.appendString(host);
-
+
// Port
message.appendInt(port);
// Is ssl
message.appendByte(0x00);
-
+
// No other headers or attributes
message.appendInt(0);
-
+
// Terminator
message.appendByte(0xFF);
@@ -165,7 +165,7 @@ public class SimpleAjpClient {
return message;
}
}
-
+
protected boolean read(InputStream is, byte[] buf, int pos, int n)
throws IOException {
Modified: tomcat/tc7.0.x/trunk/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java?rev=1198562&r1=1198561&r2=1198562&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java Sun Nov 6 21:19:43 2011
@@ -34,7 +34,7 @@ public class TestAbstractAjpProcessor ex
*/
// Has a protocol been specified
String protocol = System.getProperty("tomcat.test.protocol");
-
+
// Use BIO by default
if (protocol == null) {
protocol = "org.apache.coyote.ajp.AjpProtocol";
@@ -45,7 +45,7 @@ public class TestAbstractAjpProcessor ex
} else {
protocol = "org.apache.coyote.ajp.AjpProtocol";
}
-
+
return protocol;
}
@@ -56,17 +56,17 @@ public class TestAbstractAjpProcessor ex
tomcat.start();
// Must have a real docBase - just use temp
- org.apache.catalina.Context ctx =
+ org.apache.catalina.Context ctx =
tomcat.addContext("", System.getProperty("java.io.tmpdir"));
Tomcat.addServlet(ctx, "helloWorld", new HelloWorldServlet());
ctx.addServletMapping("/", "helloWorld");
SimpleAjpClient ajpClient = new SimpleAjpClient();
-
+
ajpClient.setPort(getPort());
-
+
ajpClient.connect();
-
+
validateCpong(ajpClient.cping());
TesterAjpMessage forwardMessage = ajpClient.createForwardMessage("/");
@@ -75,14 +75,14 @@ public class TestAbstractAjpProcessor ex
for (int i = 0; i < 2; i++) {
TesterAjpMessage responseHeaders = ajpClient.sendMessage(forwardMessage);
// Expect 3 packets: headers, body, end
- validateResponseHeaders(responseHeaders, 200);
+ validateResponseHeaders(responseHeaders, 200);
TesterAjpMessage responseBody = ajpClient.readMessage();
validateResponseBody(responseBody, HelloWorldServlet.RESPONSE_TEXT);
validateResponseEnd(ajpClient.readMessage(), true);
-
+
// Give connections plenty of time to time out
Thread.sleep(2000);
-
+
// Double check the connection is still open
validateCpong(ajpClient.cping());
}
@@ -99,19 +99,19 @@ public class TestAbstractAjpProcessor ex
// First two bytes should always be AB
assertEquals((byte) 'A', message.buf[0]);
assertEquals((byte) 'B', message.buf[1]);
-
+
// Set the start position and read the length
message.processHeader(false);
-
+
// Check the length
assertTrue(message.len > 0);
-
+
// Should be a header message
assertEquals(0x04, message.readByte());
-
+
// Check status
assertEquals(expectedStatus, message.readInt());
-
+
// Read the status message
message.readString();
@@ -134,10 +134,10 @@ public class TestAbstractAjpProcessor ex
String expectedBody) throws Exception {
assertEquals((byte) 'A', message.buf[0]);
assertEquals((byte) 'B', message.buf[1]);
-
+
// Set the start position and read the length
message.processHeader(false);
-
+
// Should be a body chunk message
assertEquals(0x03, message.readByte());
@@ -154,7 +154,7 @@ public class TestAbstractAjpProcessor ex
assertEquals((byte) 'B', message.buf[1]);
message.processHeader(false);
-
+
// Should be an end body message
assertEquals(0x05, message.readByte());
Modified: tomcat/tc7.0.x/trunk/test/org/apache/coyote/ajp/TesterAjpMessage.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/coyote/ajp/TesterAjpMessage.java?rev=1198562&r1=1198561&r2=1198562&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/coyote/ajp/TesterAjpMessage.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/coyote/ajp/TesterAjpMessage.java Sun Nov 6 21:19:43 2011
@@ -27,7 +27,7 @@ public class TesterAjpMessage extends Aj
public TesterAjpMessage(int packetSize) {
super(packetSize);
}
-
+
public byte readByte() {
return buf[pos++];
}
@@ -42,10 +42,10 @@ public class TesterAjpMessage extends Aj
int len = readInt();
return readString(len);
}
-
+
public String readString(int len) {
StringBuilder buffer = new StringBuilder(len);
-
+
for (int i = 0; i < len; i++) {
char c = (char) buf[pos++];
buffer.append(c);
@@ -79,5 +79,5 @@ public class TesterAjpMessage extends Aj
buf[3] = (byte) (dLen & 0xFF);
}
-
+
}
Modified: tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java?rev=1198562&r1=1198561&r2=1198562&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java Sun Nov 6 21:19:43 2011
@@ -36,13 +36,13 @@ public class TestAbstractHttp11Processor
@Test
public void testWithTEVoid() throws Exception {
Tomcat tomcat = getTomcatInstance();
-
+
// Use the normal Tomcat ROOT context
File root = new File("test/webapp-3.0");
tomcat.addWebapp("", root.getAbsolutePath());
-
+
tomcat.start();
-
+
String request =
"POST /echo-params.jsp HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: any" + SimpleHttpClient.CRLF +
@@ -65,13 +65,13 @@ public class TestAbstractHttp11Processor
@Test
public void testWithTEBuffered() throws Exception {
Tomcat tomcat = getTomcatInstance();
-
+
// Use the normal Tomcat ROOT context
File root = new File("test/webapp-3.0");
tomcat.addWebapp("", root.getAbsolutePath());
-
+
tomcat.start();
-
+
String request =
"POST /echo-params.jsp HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: any" + SimpleHttpClient.CRLF +
@@ -95,13 +95,13 @@ public class TestAbstractHttp11Processor
@Test
public void testWithTEIdentity() throws Exception {
Tomcat tomcat = getTomcatInstance();
-
+
// Use the normal Tomcat ROOT context
File root = new File("test/webapp-3.0");
tomcat.addWebapp("", root.getAbsolutePath());
-
+
tomcat.start();
-
+
String request =
"POST /echo-params.jsp HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: any" + SimpleHttpClient.CRLF +
@@ -127,13 +127,13 @@ public class TestAbstractHttp11Processor
@Test
public void testWithTESavedRequest() throws Exception {
Tomcat tomcat = getTomcatInstance();
-
+
// Use the normal Tomcat ROOT context
File root = new File("test/webapp-3.0");
tomcat.addWebapp("", root.getAbsolutePath());
-
+
tomcat.start();
-
+
String request =
"POST /echo-params.jsp HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: any" + SimpleHttpClient.CRLF +
@@ -157,13 +157,13 @@ public class TestAbstractHttp11Processor
@Test
public void testWithTEUnsupported() throws Exception {
Tomcat tomcat = getTomcatInstance();
-
+
// Use the normal Tomcat ROOT context
File root = new File("test/webapp-3.0");
tomcat.addWebapp("", root.getAbsolutePath());
-
+
tomcat.start();
-
+
String request =
"POST /echo-params.jsp HTTP/1.1" + SimpleHttpClient.CRLF +
"Host: any" + SimpleHttpClient.CRLF +
@@ -187,15 +187,15 @@ public class TestAbstractHttp11Processor
@Test
public void testPipelining() throws Exception {
Tomcat tomcat = getTomcatInstance();
-
+
// Must have a real docBase - just use temp
Context ctxt = tomcat.addContext("",
System.getProperty("java.io.tmpdir"));
-
+
// Add protected servlet
Tomcat.addServlet(ctxt, "TesterServlet", new TesterServlet());
ctxt.addServletMapping("/foo", "TesterServlet");
-
+
tomcat.start();
String requestPart1 =
@@ -226,17 +226,17 @@ public class TestAbstractHttp11Processor
};
Thread t = new Thread(send);
t.start();
-
+
// Sleep for 1500 ms which should mean the all of request 1 has been
// sent and half of request 2
Thread.sleep(1500);
-
+
// Now read the first response
client.readResponse(true);
assertFalse(client.isResponse50x());
assertTrue(client.isResponse200());
assertEquals("OK", client.getResponseBody());
-
+
// Read the second response. No need to sleep, read will block until
// there is data to process
client.readResponse(true);
@@ -244,7 +244,7 @@ public class TestAbstractHttp11Processor
assertTrue(client.isResponse200());
assertEquals("OK", client.getResponseBody());
}
-
+
private static final class Client extends SimpleHttpClient {
@Override
public boolean isResponseBodyOK() {
Modified: tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestGzipOutputFilter.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestGzipOutputFilter.java?rev=1198562&r1=1198561&r2=1198562&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestGzipOutputFilter.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestGzipOutputFilter.java Sun Nov 6 21:19:43 2011
@@ -45,7 +45,7 @@ public class TestGzipOutputFilter {
* to GZIPOutputStream and close it (to force flushing) 6. Compare the size
* of the two arrays, they should be close (instead of one being much
* shorter than the other one)
- *
+ *
* @throws Exception
*/
@Test
Modified: tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestInternalInputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestInternalInputBuffer.java?rev=1198562&r1=1198561&r2=1198562&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestInternalInputBuffer.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestInternalInputBuffer.java Sun Nov 6 21:19:43 2011
@@ -37,31 +37,31 @@ import org.apache.catalina.startup.Tomca
import org.apache.catalina.startup.TomcatBaseTest;
public class TestInternalInputBuffer extends TomcatBaseTest {
-
+
/**
* Test case for https://issues.apache.org/bugzilla/show_bug.cgi?id=48839
*/
@Test
public void testBug48839() {
-
+
Bug48839Client client = new Bug48839Client();
client.setPort(getPort());
-
+
client.doRequest();
assertTrue(client.isResponse200());
assertTrue(client.isResponseBodyOK());
}
-
+
/**
* Bug 48839 test client.
*/
private class Bug48839Client extends SimpleHttpClient {
-
+
private Exception doRequest() {
-
+
Tomcat tomcat = getTomcatInstance();
-
+
Context root = tomcat.addContext("", TEMP_DIR);
Tomcat.addServlet(root, "Bug48839", new Bug48839Servlet());
root.addServletMapping("/test", "Bug48839");
@@ -71,7 +71,7 @@ public class TestInternalInputBuffer ext
// Open connection
connect();
-
+
String[] request = new String[1];
request[0] =
"GET http://localhost:8080/test HTTP/1.1" + CRLF +
@@ -79,10 +79,10 @@ public class TestInternalInputBuffer ext
"\tefgh" + CRLF +
"Connection: close" + CRLF +
CRLF;
-
+
setRequest(request);
processRequest(); // blocks until response has been read
-
+
// Close the connection
disconnect();
} catch (Exception e) {
@@ -101,11 +101,11 @@ public class TestInternalInputBuffer ext
}
return true;
}
-
+
}
private static class Bug48839Servlet extends HttpServlet {
-
+
private static final long serialVersionUID = 1L;
/**
@@ -116,9 +116,9 @@ public class TestInternalInputBuffer ext
throws ServletException, IOException {
// Just echo the header value back as plain text
resp.setContentType("text/plain");
-
+
PrintWriter out = resp.getWriter();
-
+
Enumeration<String> values = req.getHeaders("X-Bug48839");
while (values.hasMoreElements()) {
out.println(values.nextElement());
@@ -129,23 +129,23 @@ public class TestInternalInputBuffer ext
@Test
public void testBug51557NoColon() {
-
+
Bug51557Client client = new Bug51557Client("X-Bug51557NoColon");
client.setPort(getPort());
-
+
client.doRequest();
assertTrue(client.isResponse200());
assertEquals("abcd", client.getResponseBody());
assertTrue(client.isResponseBodyOK());
}
-
+
@Test
public void testBug51557Separators() throws Exception {
char httpSeparators[] = new char[] {
'\t', ' ', '\"', '(', ')', ',', '/', ':', ';', '<',
'=', '>', '?', '@', '[', '\\', ']', '{', '}' };
-
+
for (char s : httpSeparators) {
doTestBug51557Char(s);
tearDown();
@@ -167,46 +167,46 @@ public class TestInternalInputBuffer ext
@Test
public void testBug51557Continuation() {
-
+
Bug51557Client client = new Bug51557Client("X-Bug=51557NoColon",
"foo" + SimpleHttpClient.CRLF + " bar");
client.setPort(getPort());
-
+
client.doRequest();
assertTrue(client.isResponse200());
assertEquals("abcd", client.getResponseBody());
assertTrue(client.isResponseBodyOK());
}
-
+
@Test
public void testBug51557BoundaryStart() {
-
+
Bug51557Client client = new Bug51557Client("=X-Bug51557",
"invalid");
client.setPort(getPort());
-
+
client.doRequest();
assertTrue(client.isResponse200());
assertEquals("abcd", client.getResponseBody());
assertTrue(client.isResponseBodyOK());
}
-
+
@Test
public void testBug51557BoundaryEnd() {
-
+
Bug51557Client client = new Bug51557Client("X-Bug51557=",
"invalid");
client.setPort(getPort());
-
+
client.doRequest();
assertTrue(client.isResponse200());
assertEquals("abcd", client.getResponseBody());
assertTrue(client.isResponseBodyOK());
}
-
+
private void doTestBug51557Char(char s) {
Bug51557Client client =
new Bug51557Client("X-Bug" + s + "51557", "invalid");
@@ -217,7 +217,7 @@ public class TestInternalInputBuffer ext
assertEquals("abcd", client.getResponseBody());
assertTrue(client.isResponseBodyOK());
}
-
+
/**
* Bug 51557 test client.
*/
@@ -237,9 +237,9 @@ public class TestInternalInputBuffer ext
}
private Exception doRequest() {
-
+
Tomcat tomcat = getTomcatInstance();
-
+
Context root = tomcat.addContext("", TEMP_DIR);
Tomcat.addServlet(root, "Bug51557",
new Bug51557Servlet(headerName));
@@ -250,7 +250,7 @@ public class TestInternalInputBuffer ext
// Open connection
connect();
-
+
String[] request = new String[1];
request[0] =
"GET http://localhost:8080/test HTTP/1.1" + CRLF +
@@ -258,10 +258,10 @@ public class TestInternalInputBuffer ext
"X-Bug51557: abcd" + CRLF +
"Connection: close" + CRLF +
CRLF;
-
+
setRequest(request);
processRequest(); // blocks until response has been read
-
+
// Close the connection
disconnect();
} catch (Exception e) {
@@ -280,11 +280,11 @@ public class TestInternalInputBuffer ext
}
return true;
}
-
+
}
private static class Bug51557Servlet extends HttpServlet {
-
+
private static final long serialVersionUID = 1L;
private String invalidHeaderName;
@@ -305,13 +305,13 @@ public class TestInternalInputBuffer ext
throws ServletException, IOException {
// Just echo the header value back as plain text
resp.setContentType("text/plain");
-
+
PrintWriter out = resp.getWriter();
-
+
processHeaders(invalidHeaderName, req, out);
processHeaders("X-Bug51557", req, out);
}
-
+
private void processHeaders(String header, HttpServletRequest req,
PrintWriter out) {
Enumeration<String> values = req.getHeaders(header);
Modified: tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java?rev=1198562&r1=1198561&r2=1198562&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java Sun Nov 6 21:19:43 2011
@@ -44,7 +44,7 @@ public class TestChunkedInputFilter exte
Tomcat tomcat = getTomcatInstance();
// Must have a real docBase - just use temp
- Context ctx =
+ Context ctx =
tomcat.addContext("", System.getProperty("java.io.tmpdir"));
Tomcat.addServlet(ctx, "servlet", new EchoHeaderServlet());
@@ -83,7 +83,7 @@ public class TestChunkedInputFilter exte
Tomcat tomcat = getTomcatInstance();
// Must have a real docBase - just use temp
- Context ctx =
+ Context ctx =
tomcat.addContext("", System.getProperty("java.io.tmpdir"));
Tomcat.addServlet(ctx, "servlet", new EchoHeaderServlet());
@@ -126,7 +126,7 @@ public class TestChunkedInputFilter exte
Tomcat tomcat = getTomcatInstance();
// Must have a real docBase - just use temp
- Context ctx =
+ Context ctx =
tomcat.addContext("", System.getProperty("java.io.tmpdir"));
Tomcat.addServlet(ctx, "servlet", new EchoHeaderServlet());
@@ -157,12 +157,12 @@ public class TestChunkedInputFilter exte
client.processRequest();
assertEquals("null7null", client.getResponseBody());
}
-
+
private static class EchoHeaderServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
- protected void doPost(HttpServletRequest req, HttpServletResponse resp)
+ protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
resp.setContentType("text/plain");
PrintWriter pw = resp.getWriter();
@@ -179,9 +179,9 @@ public class TestChunkedInputFilter exte
while (is.read() > -1) {
count++;
}
-
+
pw.write(Integer.valueOf(count).toString());
-
+
// Header should be visible now
value = req.getHeader("x-trailer");
if (value == null) {
@@ -190,7 +190,7 @@ public class TestChunkedInputFilter exte
pw.write(value);
}
}
-
+
private static class TrailerClient extends SimpleHttpClient {
@Override
Modified: tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestDirContextURLStreamHandlerFactory.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestDirContextURLStreamHandlerFactory.java?rev=1198562&r1=1198561&r2=1198562&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestDirContextURLStreamHandlerFactory.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestDirContextURLStreamHandlerFactory.java Sun Nov 6 21:19:43 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.
@@ -30,9 +30,9 @@ public class TestDirContextURLStreamHand
@Test
public void testUserSuppliedFactory() throws Exception {
-
+
URL url = null;
-
+
// Initially unknown
try {
url = new URL("foo://www.apache.org");
@@ -40,7 +40,7 @@ public class TestDirContextURLStreamHand
// Ignore
}
assertNull(url);
-
+
// Set the factory
URL.setURLStreamHandlerFactory(
DirContextURLStreamHandlerFactory.getInstance());
@@ -56,7 +56,7 @@ public class TestDirContextURLStreamHand
// Register a user factory
DirContextURLStreamHandlerFactory.addUserFactory(
new FooURLStreamHandlerFactory());
-
+
// Now it works
try {
url = new URL("foo://www.apache.org");
@@ -65,7 +65,7 @@ public class TestDirContextURLStreamHand
}
assertNotNull(url);
}
-
+
public static class FooURLStreamHandlerFactory
implements URLStreamHandlerFactory {
Modified: tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestProxyDirContext.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestProxyDirContext.java?rev=1198562&r1=1198561&r2=1198562&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestProxyDirContext.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestProxyDirContext.java Sun Nov 6 21:19:43 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.
@@ -39,13 +39,13 @@ public class TestProxyDirContext extends
@Test
public void testLookupException() throws Exception {
Tomcat tomcat = getTomcatInstance();
-
+
// Must have a real docBase - just use temp
StandardContext ctx = (StandardContext)
tomcat.addContext("", System.getProperty("java.io.tmpdir"));
ctx.setCacheTTL(500);
tomcat.start();
-
+
try {
ctx.getResources().lookup("/WEB-INF/web.xml");
fail();
Modified: tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestWarDirContext.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestWarDirContext.java?rev=1198562&r1=1198561&r2=1198562&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestWarDirContext.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestWarDirContext.java Sun Nov 6 21:19:43 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.
@@ -29,7 +29,7 @@ import org.apache.catalina.startup.Tomca
import org.apache.tomcat.util.buf.ByteChunk;
public class TestWarDirContext extends TomcatBaseTest {
-
+
@Override
public void setUp() throws Exception {
super.setUp();
@@ -50,20 +50,20 @@ public class TestWarDirContext extends T
@Test
public void testLookupException() throws Exception {
Tomcat tomcat = getTomcatInstance();
-
+
File appDir = new File("test/webapp-3.0-fragments");
// app dir is relative to server home
tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
-
+
tomcat.start();
-
+
ByteChunk bc = getUrl("http://localhost:" + getPort() +
"/test/warDirContext.jsp");
assertEquals("<p>java.lang.ClassNotFoundException</p>",
bc.toString());
}
-
+
/**
* Additional test following on from SPR-7350 above to check files that
* contain JNDI reserved characters can be served when caching is enabled.
@@ -71,13 +71,13 @@ public class TestWarDirContext extends T
@Test
public void testReservedJNDIFileNamesWithCache() throws Exception {
Tomcat tomcat = getTomcatInstance();
-
+
File appDir = new File("test/webapp-3.0-fragments");
// app dir is relative to server home
StandardContext ctxt = (StandardContext) tomcat.addWebapp(
null, "/test", appDir.getAbsolutePath());
ctxt.setCachingAllowed(true);
-
+
tomcat.start();
// Should be found in resources.jar
@@ -93,7 +93,7 @@ public class TestWarDirContext extends T
bc.toString());
}
-
+
/**
* Additional test following on from SPR-7350 above to check files that
* contain JNDI reserved characters can be served when caching is disabled.
@@ -101,13 +101,13 @@ public class TestWarDirContext extends T
@Test
public void testReservedJNDIFileNamesNoCache() throws Exception {
Tomcat tomcat = getTomcatInstance();
-
+
File appDir = new File("test/webapp-3.0-fragments");
// app dir is relative to server home
StandardContext ctxt = (StandardContext) tomcat.addWebapp(
null, "/test", appDir.getAbsolutePath());
ctxt.setCachingAllowed(false);
-
+
tomcat.start();
// Should be found in resources.jar
Modified: tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TesterFactory.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TesterFactory.java?rev=1198562&r1=1198561&r2=1198562&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TesterFactory.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TesterFactory.java Sun Nov 6 21:19:43 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.
Modified: tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TesterObject.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TesterObject.java?rev=1198562&r1=1198561&r2=1198562&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TesterObject.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TesterObject.java Sun Nov 6 21:19:43 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.
@@ -24,11 +24,11 @@ public class TesterObject {
public String toString() {
return "This is a test object (" + super.toString() + ").";
}
-
+
public void setFoo(String foo) {
this.foo = foo;
}
-
+
public String getFoo() {
return this.foo;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org