You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2011/10/22 23:31:02 UTC
svn commit: r1187812 [8/8] - in /tomcat/trunk/modules/tomcat-lite: ./
java/org/apache/coyote/lite/ java/org/apache/tomcat/lite/http/
java/org/apache/tomcat/lite/io/ java/org/apache/tomcat/lite/io/jsse/
java/org/apache/tomcat/lite/proxy/ java/org/apache...
Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/io/OneTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/io/OneTest.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/io/OneTest.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/io/OneTest.java Sat Oct 22 21:30:59 2011
@@ -12,16 +12,16 @@ import org.apache.tomcat.lite.io.MemoryI
import junit.framework.TestCase;
public class OneTest extends TestCase {
-
+
public void setUp() throws Exception {
TestMain.getTestServer();
}
-
+
public void tearDown() throws IOException {
}
public void testOne() throws Exception {
-
+
}
}
Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/io/SocksTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/io/SocksTest.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/io/SocksTest.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/io/SocksTest.java Sat Oct 22 21:30:59 2011
@@ -20,7 +20,7 @@ import junit.framework.TestCase;
public class SocksTest extends TestCase {
- public void setUp() {
+ public void setUp() {
// SocksServer socks = new SocksServer();
// try {
// socks.initServer();
@@ -28,7 +28,7 @@ public class SocksTest extends TestCase
// // TODO Auto-generated catch block
// e1.printStackTrace();
// }
-//
+//
// ProxySelector.setDefault(new ProxySelector() {
//
// @Override
@@ -37,10 +37,10 @@ public class SocksTest extends TestCase
//
// @Override
// public List<Proxy> select(URI uri) {
-//
+//
// List<Proxy> res = new ArrayList<Proxy>();
// try {
-// res.add(new Proxy(Proxy.Type.SOCKS,
+// res.add(new Proxy(Proxy.Type.SOCKS,
// new InetSocketAddress(InetAddress.getLocalHost(), 1080)));
// } catch (UnknownHostException e) {
// // TODO Auto-generated catch block
@@ -48,11 +48,11 @@ public class SocksTest extends TestCase
// }
// return res;
// }
-//
+//
// });
}
-
+
public void testSocks() {
-
+
}
}
Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/io/UEncoderTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/io/UEncoderTest.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/io/UEncoderTest.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/io/UEncoderTest.java Sat Oct 22 21:30:59 2011
@@ -9,17 +9,17 @@ public class UEncoderTest extends TestCa
IOWriter enc=new IOWriter(null);
UrlEncoding dec = new UrlEncoding();
CBuffer cc = CBuffer.newInstance();
-
+
/*
- *
+ *
* Test method for 'org.apache.tomcat.util.buf.UEncoder.encodeURL(String)'
- * TODO: find the relevant rfc and apache tests and add more
+ * TODO: find the relevant rfc and apache tests and add more
*/
public void testEncodeURL() {
String eurl1=encodeURL("test");
assertEquals("test", eurl1);
-
+
eurl1=encodeURL("/test");
assertEquals("/test", eurl1);
@@ -33,7 +33,7 @@ public class UEncoderTest extends TestCa
eurl1=encodeURL("//test");
assertEquals("//test", eurl1);
}
-
+
public String encodeURL(String uri) {
cc.recycle();
dec.urlEncode(uri, cc, enc);
Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/load/LiveHttp5Test.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/load/LiveHttp5Test.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/load/LiveHttp5Test.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/load/LiveHttp5Test.java Sat Oct 22 21:30:59 2011
@@ -18,19 +18,19 @@ public class LiveHttp5Test extends LiveH
}
return s;
}
-
+
public void test100() throws Exception {
for (int i = 0; i < 100; i++) {
testSimpleRequest();
- tearDown();
+ tearDown();
setUp();
-
+
notFound();
- tearDown();
+ tearDown();
setUp();
testSimpleRequest();
- tearDown();
+ tearDown();
setUp();
}
}
Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/load/LiveHttpThreadedTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/load/LiveHttpThreadedTest.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/load/LiveHttpThreadedTest.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/load/LiveHttpThreadedTest.java Sat Oct 22 21:30:59 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.
@@ -35,46 +35,46 @@ import org.apache.tomcat.lite.io.BBuffer
import org.apache.tomcat.lite.io.SocketConnector;
/*
- Notes on memory use ( from heap dumps ):
+ Notes on memory use ( from heap dumps ):
- buffers are not yet recycled ( the BBuffers used in channels )
-
+
- each active connection consumes at least 26k - 2 buffers + head buffer
( 8k each )
TODO: could 'peak' in the In buffer and move headRecv to HttpChannel
-
-
+
+
- HttpChannel keeps about 64K ( for the hello world ).
-- res is 25k
-- req is 32k, BufferedIOReader 16k,
-
+
TODO:
- leak in NioThread.active - closed sockets not removed
- need to rate-limit and queue requests - OOM
- timeouts
- - seems few responses missing on large async requests (URL works)
+ - seems few responses missing on large async requests (URL works)
*/
/**
* Long running test - async tests are failing since rate control
- * is not implemented ( too many outstanding requests - OOM ),
+ * is not implemented ( too many outstanding requests - OOM ),
* it seems there is a bug as well.
*/
public class LiveHttpThreadedTest extends TestCase {
HttpConnector clientCon = TestMain.shared().getClient();
HttpConnector serverCon = TestMain.shared().getTestServer();
-
- HttpConnector spdyClient =
+
+ HttpConnector spdyClient =
HttpClient.newClient().setCompression(false);
-
+
HttpConnector spdyClientCompress =
HttpClient.newClient();
-
- HttpConnector spdyClientCompressSsl =
+
+ HttpConnector spdyClientCompressSsl =
HttpClient.newClient();
-
+
ThreadRunner tr;
static boolean dumpHeap = true;
-
+
AtomicInteger ok = new AtomicInteger();
int reqCnt;
@@ -83,7 +83,7 @@ public class LiveHttpThreadedTest extend
public void tearDown() throws IOException {
clientCon.cpool.clear();
}
-
+
public void test1000Async() throws Exception {
// try {
asyncRequest(10, 100, false, false, clientCon, "AsyncHttp");
@@ -136,9 +136,9 @@ public class LiveHttpThreadedTest extend
Object thrlock = new Object();
Object lock = new Object();
-
- public void asyncRequest(final int thr, int perthr,
- final boolean spdy, final boolean ssl,
+
+ public void asyncRequest(final int thr, int perthr,
+ final boolean spdy, final boolean ssl,
final HttpConnector clientCon, String test) throws Exception {
clientCon.getConnectionPool().clear();
reqCnt = thr * perthr;
@@ -146,7 +146,7 @@ public class LiveHttpThreadedTest extend
tr = new ThreadRunner(thr, perthr) {
public void makeRequest(int i) throws Exception {
- HttpRequest cstate = clientCon.request("localhost",
+ HttpRequest cstate = clientCon.request("localhost",
ssl ? 8443 : 8802);
synchronized (active) {
active.put(cstate, cstate);
@@ -163,9 +163,9 @@ public class LiveHttpThreadedTest extend
cstate.setCompletedCallback(reqCallback);
// no body
cstate.getBody().close();
-
+
cstate.send();
-
+
while (active.size() >= thr) {
synchronized(thrlock) {
thrlock.wait();
@@ -181,34 +181,34 @@ public class LiveHttpThreadedTest extend
}
long time = (System.currentTimeMillis() - t0);
- System.err.println("====== " + test +
- " threads: " + thr + ", req: " +
- reqCnt + ", sendTime" + tr.time +
- ", time: " + time +
+ System.err.println("====== " + test +
+ " threads: " + thr + ", req: " +
+ reqCnt + ", sendTime" + tr.time +
+ ", time: " + time +
", connections: " + clientCon.getConnectionPool().getSocketCount() +
", avg: " + (time / reqCnt));
assertEquals(reqCnt, ok.get());
assertEquals(0, tr.errors.get());
}
-
+
RequestCompleted reqCallback = new RequestCompleted() {
@Override
- public void handle(HttpChannel data, Object extraData)
+ public void handle(HttpChannel data, Object extraData)
throws IOException {
String out = data.getIn().copyAll(null).toString();
if (200 != data.getResponse().getStatus()) {
System.err.println("Wrong status");
- tr.errors.incrementAndGet();
+ tr.errors.incrementAndGet();
} else if (!"Hello world".equals(out)) {
tr.errors.incrementAndGet();
System.err.println("bad result " + out);
- }
+ }
synchronized (active) {
active.remove(data.getRequest());
}
synchronized (thrlock) {
- thrlock.notify();
+ thrlock.notify();
}
data.release();
int okres = ok.incrementAndGet();
@@ -241,10 +241,10 @@ public class LiveHttpThreadedTest extend
}
- /**
+ /**
* HttpURLConnection client against lite.http server.
*/
- public void urlRequest(int thr, int cnt, final boolean ssl, String test)
+ public void urlRequest(int thr, int cnt, final boolean ssl, String test)
throws Exception {
long t0 = System.currentTimeMillis();
@@ -259,7 +259,7 @@ public class LiveHttpThreadedTest extend
BBuffer out = BBuffer.allocate();
String url = ssl ? "https://localhost:8443/hello" :
"http://localhost:8802/hello";
- HttpURLConnection con =
+ HttpURLConnection con =
TestMain.getUrl(url, out);
if (con.getResponseCode() != 200) {
errors.incrementAndGet();
@@ -278,7 +278,7 @@ public class LiveHttpThreadedTest extend
assertEquals(0, tr.errors.get());
long time = (System.currentTimeMillis() - t0);
- System.err.println("====== " + test + " threads: " + thr + ", req: " +
+ System.err.println("====== " + test + " threads: " + thr + ", req: " +
(thr * cnt) + ", time: " + time + ", avg: " +
(time / (thr * cnt)));
} finally {
Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/load/MicroTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/load/MicroTest.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/load/MicroTest.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/load/MicroTest.java Sat Oct 22 21:30:59 2011
@@ -16,7 +16,7 @@ public class MicroTest extends TestCase
MappingData mappingData = new MappingData();
CBuffer host = CBuffer.newInstance();
host.set("test1.com");
-
+
CBuffer uri = CBuffer.newInstance();
uri.set("/foo/bar/blah/bobou/foo");
@@ -45,6 +45,6 @@ public class MicroTest extends TestCase
mapper.map(host, uri, mappingData);
}
// TODO: asserts
- //System.out.println("Elapsed:" + (System.currentTimeMillis() - time));
+ //System.out.println("Elapsed:" + (System.currentTimeMillis() - time));
}
}
Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/load/ThreadRunner.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/load/ThreadRunner.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/load/ThreadRunner.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/load/ThreadRunner.java Sat Oct 22 21:30:59 2011
@@ -9,12 +9,12 @@ public class ThreadRunner {
int rCount = 100;
Thread[] threads;
int[] ok;
-
+
int sleepTime = 0;
-
+
long time;
protected AtomicInteger errors = new AtomicInteger();
-
+
public ThreadRunner(int threads, int count) {
tCount = threads;
rCount = count;
@@ -33,7 +33,7 @@ public class ThreadRunner {
});
threads[i].start();
}
-
+
int res = 0;
for (int i = 0; i < tCount; i++) {
try {
@@ -46,7 +46,7 @@ public class ThreadRunner {
long t1 = System.currentTimeMillis();
time = t1 - t0;
}
-
+
public void makeRequests(int cnt) {
for (int i = 0; i < rCount ; i++) {
try {
@@ -57,8 +57,8 @@ public class ThreadRunner {
}
}
}
-
+
public void makeRequest(int i) throws Exception {
-
+
}
}
\ No newline at end of file
Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/proxy/LiveProxyHttp1Test.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/proxy/LiveProxyHttp1Test.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/proxy/LiveProxyHttp1Test.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/proxy/LiveProxyHttp1Test.java Sat Oct 22 21:30:59 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,10 +24,10 @@ import org.apache.tomcat.lite.http.LiveH
public class LiveProxyHttp1Test extends LiveHttp1Test {
public void setUp() throws IOException {
- // All tests in super, but with client pointing to
+ // All tests in super, but with client pointing to
// the proxy server, which in turn hits the real server.
clientPort = 8903;
super.setUp();
}
-
+
}
Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/proxy/ProxyTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/proxy/ProxyTest.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/proxy/ProxyTest.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/proxy/ProxyTest.java Sat Oct 22 21:30:59 2011
@@ -5,9 +5,9 @@ n * Licensed to the Apache Software Foun
* 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.
@@ -26,95 +26,95 @@ import junit.framework.TestCase;
public class ProxyTest extends TestCase {
String resStr;
-
+
public void setUp() throws Exception {
TestMain.getTestServer();
}
-
+
public void tearDown() throws IOException {
}
-
+
public void xtestRequestSlowChunked() throws Exception {
- resStr =
+ resStr =
TestMain.get("http://localhost:8903/sleep/1c").toString();
assertEquals("sleep 1csleep 1c", resStr);
}
-
+
public void testSingleRequest() throws Exception {
- String resStr =
+ String resStr =
TestMain.get("http://localhost:8903/hello").toString();
assertEquals("Hello world", resStr);
}
-
+
public void test2Requests() throws Exception {
- String resStr =
+ String resStr =
TestMain.get("http://localhost:8903/hello").toString();
assertEquals("Hello world", resStr);
- resStr =
+ resStr =
TestMain.get("http://localhost:8903/hello?a=b").toString();
assertEquals("Hello world", resStr);
}
public void testRequestSimple() throws Exception {
- resStr =
+ resStr =
TestMain.get("http://localhost:8903/hello").toString();
assertEquals("Hello world", resStr);
- resStr =
+ resStr =
TestMain.get("http://localhost:8903/hello").toString();
assertEquals("Hello world", resStr);
- resStr =
+ resStr =
TestMain.get("http://localhost:8903/hello").toString();
assertEquals(resStr, "Hello world");
}
-
+
public void testExtAdapter() throws Exception {
- String res =
+ String res =
TestMain.get("http://www.apache.org/").toString();
assertTrue(res.indexOf("Apache") > 0);
-
+
Thread.currentThread().sleep(100);
// second time - are we reusing ?
- res =
+ res =
TestMain.get("http://www.apache.org/").toString();
-
+
assertTrue(res.indexOf("Apache") > 0);
-
- }
-
+
+ }
+
public void testStaticAdapter() throws Exception {
-
- assertEquals("Hello world",
+
+ assertEquals("Hello world",
TestMain.get("http://localhost:8802/hello").toString());
- assertEquals("Hello world2",
+ assertEquals("Hello world2",
TestMain.get("http://localhost:8802/2nd").toString());
-
+
}
-
+
public void testRequestParams() throws Exception {
// qry string
- String resStr =
+ String resStr =
TestMain.get("http://localhost:8903/echo/foo?q=a&b")
.toString();
assertTrue(resStr, resStr.indexOf("foo?q=a&b") > 0);
}
-
+
public void testRequestChunked() throws Exception {
// Chunked encoding
- String resStr =
+ String resStr =
TestMain.get("http://localhost:8903/chunked/test")
.toString();
assertEquals(4, resStr.length());
assertTrue(resStr.indexOf("AAA") >= 0);
}
-
+
public void testRequestSlow() throws Exception {
// Slow
- String resStr =
+ String resStr =
TestMain.get("http://localhost:8903/sleep/1").toString();
assertEquals("sleep 1sleep 1", resStr.toString());
- }
+ }
}
Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/proxy/SmallProxyTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/proxy/SmallProxyTest.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/proxy/SmallProxyTest.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/proxy/SmallProxyTest.java Sat Oct 22 21:30:59 2011
@@ -13,14 +13,14 @@ import org.apache.tomcat.lite.io.MemoryI
import org.apache.tomcat.lite.io.MemoryIOConnector.MemoryIOChannel;
public class SmallProxyTest extends TestCase {
-
- MemoryIOConnector memoryServerConnector =
+
+ MemoryIOConnector memoryServerConnector =
new MemoryIOConnector();
-
- MemoryIOConnector memoryClientConnector =
+
+ MemoryIOConnector memoryClientConnector =
new MemoryIOConnector().withServer(memoryServerConnector);
-
+
HttpConnector httpCon = new HttpConnector(memoryServerConnector) {
@Override
public HttpChannel get(CharSequence target) throws IOException {
@@ -45,12 +45,12 @@ public class SmallProxyTest extends Test
lastClient = new HttpChannel();
lastClient.setConnector(this);
return lastClient;
- }
+ }
public HttpChannel getServer() {
throw new RuntimeException();
}
};
-
+
HttpChannel lastServer;
HttpChannel lastClient;
@@ -59,20 +59,20 @@ public class SmallProxyTest extends Test
boolean bodySentDone = false;
boolean headersDone = false;
boolean allDone = false;
-
-
- //MemoryIOChannel clientNet = new MemoryIOChannel();
-
+
+
+ //MemoryIOChannel clientNet = new MemoryIOChannel();
+
MemoryIOConnector.MemoryIOChannel net = new MemoryIOChannel();
HttpChannel http;
HttpConnection serverConnection;
-
+
public void setUp() throws IOException {
http = httpCon.getServer();
serverConnection = httpCon.handleAccepted(net);
}
-
+
/**
* More complicated test..
* @throws IOException
@@ -85,25 +85,25 @@ public class SmallProxyTest extends Test
net.getIn().append("GET http://www.apache.org/ HTTP/1.0\n" +
"Connection: Close\n\n");
net.getIn().close();
-
+
// lastClient.rawSendBuffers has the request sent by proxy
lastClient.getNet().getIn()
.append("HTTP/1.0 200 OK\n\nHi\n");
lastClient.getNet().getIn()
.append("world\n");
-
+
// TODO: check what the proxy sent
// lastClient.getOut();
-
- // will also trigger 'release' - both sides are closed.
- lastClient.getNet().getIn().close();
-
- // wait response...
+
+ // will also trigger 'release' - both sides are closed.
+ lastClient.getNet().getIn().close();
+
+ // wait response...
// http.sendBody.close();
String res = net.out.toString();
assertTrue(res.indexOf("Hi\nworld\n") > 0);
assertTrue(res.indexOf("HTTP/1.0 200 OK") == 0);
assertTrue(res.indexOf("tomcatproxy") > 0);
-
- }
+
+ }
}
Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/util/UEncoderTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/util/UEncoderTest.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/util/UEncoderTest.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/lite/util/UEncoderTest.java Sat Oct 22 21:30:59 2011
@@ -21,17 +21,17 @@ import junit.framework.TestCase;
public class UEncoderTest extends TestCase {
URLEncoder enc=new URLEncoder();
-
+
/*
- *
+ *
* Test method for 'org.apache.tomcat.util.buf.UEncoder.encodeURL(String)'
- * TODO: find the relevant rfc and apache tests and add more
+ * TODO: find the relevant rfc and apache tests and add more
*/
public void testEncodeURL() {
String eurl1=enc.encodeURL("test");
assertEquals("test", eurl1);
-
+
eurl1=enc.encodeURL("/test");
assertEquals("/test", eurl1);
@@ -45,7 +45,7 @@ public class UEncoderTest extends TestCa
eurl1=enc.encodeURL("//test");
assertEquals("//test", eurl1);
-
+
}
}
Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/AntProperties.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/AntProperties.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/AntProperties.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/AntProperties.java Sat Oct 22 21:30:59 2011
@@ -5,11 +5,11 @@ package org.apache.tomcat.test.watchdog;
import java.util.Hashtable;
/**
- * Extracted from IntrospectionHelper - a simple utility class to
+ * Extracted from IntrospectionHelper - a simple utility class to
* do ant style ${property} replacements on a string, using a map
- * holding properties. Also allows a hook for dynamic, on-demand
+ * holding properties. Also allows a hook for dynamic, on-demand
* properties.
- *
+ *
* @author Costin Manolache
*/
public class AntProperties {
Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/CookieController.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/CookieController.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/CookieController.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/CookieController.java Sat Oct 22 21:30:59 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.
@@ -31,13 +31,13 @@ import java.util.Vector;
/**
- * Represents a collection of Cookie instances.
+ * Represents a collection of Cookie instances.
* <p>
* Fires events when the cookies have been changed internally. Deals
* with management of cookies in terms of saving and loading them,
* and disabling them.
*
- * @author Ramesh.Mandava
+ * @author Ramesh.Mandava
*/
public class CookieController {
@@ -64,10 +64,10 @@ public class CookieController {
}
try {
/*
- Properties properties = new Properties();
+ Properties properties = new Properties();
FileInputStream fin = new FileInputStream("ServerAutoRun.properties");
properties.load(fin);
-
+
String cookiepolicy = properties.getProperty("cookie.acceptpolicy");
if (cookiepolicy == null || cookiepolicy.equals("none")) {
return;
@@ -155,7 +155,7 @@ public class CookieController {
return;
}
synchronized (cookieJar) {
-
+
String domain = cookie.getDomain().toLowerCase();
Vector cookieList = (Vector)cookieJar.get(domain);
@@ -165,7 +165,7 @@ public class CookieController {
addOrReplaceCookie(cookieList, cookie);
cookieJar.put(domain, cookieList);
-
+
}
}
@@ -210,8 +210,8 @@ public class CookieController {
}
- // Do the replace - if cookie has already expired, remove
- // the replaced cookie.
+ // Do the replace - if cookie has already expired, remove
+ // the replaced cookie.
if (replaced != null) {
if (cookie.isSaveableInMemory()) {
cookies.setElementAt(cookie, replacedIndex);
@@ -226,7 +226,7 @@ public class CookieController {
if (cookie.isSaveableInMemory()) {
cookies.addElement(cookie);
//System.out.println("RECORDED new cookie " + cookie);
- }
+ }
}
@@ -236,7 +236,7 @@ public class CookieController {
try {
/*
- Properties properties = new Properties();
+ Properties properties = new Properties();
FileInputStream fin = new FileInputStream("ServerAutoRun.properties");
properties.load(fin);
// check current accept policy instead enableCookies
@@ -259,7 +259,7 @@ public class CookieController {
}
-
+
/**
* Host may be a FQDN, or a partial domain name starting with a dot.
* Adds any cookies which match the host and path to the
@@ -279,12 +279,12 @@ public class CookieController {
cookieString = cookieString + "; " + cookie.getNameValue();
}
}
-
+
/*
if( cookieString != null ) {
httpConn.setRequestProperty("Cookie", cookieString);
-
+
// System.out.println("Returned cookie string: " + cookieString + " for HOST = " + host);
}
@@ -307,7 +307,7 @@ public class CookieController {
while ((index = host.indexOf('.', 1)) >= 0) {
// trim off everything up to, and including the dot.
host = host.substring(index+1);
-
+
// add onto cookieVector
tempVector = getSubsetRelevantCookies(host,url);
if (tempVector != null ) {
@@ -334,13 +334,13 @@ public class CookieController {
if (cookieList == null) {
cookieList = new Vector(10);
}
- Enumeration cookies = cookiePortList.elements();
+ Enumeration cookies = cookiePortList.elements();
while (cookies.hasMoreElements()) {
cookieList.addElement(cookies.nextElement());
- }
+ }
}
-
+
if (cookieList == null) {
return null;
}
@@ -460,15 +460,15 @@ public class CookieController {
if (cookie.getExpirationDate() != null) {
if (cookie.isSaveable()) {
pw.println(cookie);
- } else { // the cookie must have expired,
+ } else { // the cookie must have expired,
//remove from Vector cookieList
cookieList.removeElement(cookie);
}
-
- }
+
+ }
}
}
- // Must print something to the printwriter in the case that
+ // Must print something to the printwriter in the case that
// the cookieJar has been cleared - otherwise the old cookie
// file will continue to exist.
pw.print("");
@@ -495,7 +495,7 @@ public class CookieController {
public void loadCookieJarFromFile(String cookieFileName) {
try {
FileReader fr = new FileReader(cookieFileName);
-
+
BufferedReader in = new BufferedReader(fr);
try {
@@ -511,13 +511,13 @@ public class CookieController {
in.close();
}
-
+
} catch (IOException e) {
// do nothing; it's not an error not to have persistent cookies
}
}
-
+
/* saves the cookies to the given file specified by fname */
public void saveCookieJarToFile(String cookieFileName) {
try {
@@ -554,7 +554,7 @@ public class CookieController {
for (int i = 0; i < v.size(); i++) {
HttpCookie hc = (HttpCookie) v.elementAt(i);
result.addElement(hc);
-
+
}
}
@@ -584,7 +584,7 @@ public class CookieController {
cookieArr[i++] = (HttpCookie)e.nextElement();
// System.out.println("cookieArr["+(i-1)+"] = " +cookieArr[i-1].toString());
}
-
+
return cookieArr;
}
@@ -611,7 +611,7 @@ public class CookieController {
}
- /*
+ /*
* purges any expired cookies in the Cookie hashtable.
*/
public void purgeExpiredCookies() {
@@ -627,7 +627,7 @@ public class CookieController {
if (cookie.hasExpired()) {
cookieList.removeElement(cookie);
- }
+ }
}
}
Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/DynamicObject.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/DynamicObject.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/DynamicObject.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/DynamicObject.java Sat Oct 22 21:30:59 2011
@@ -20,11 +20,11 @@ import java.util.logging.Logger;
/**
* Refactoring of IntrospectionUtils and modeler dynamic bean.
- *
+ *
* Unlike IntrospectionUtils, the method informations can be cached.
- * Also I hope this class will be simpler to use.
+ * Also I hope this class will be simpler to use.
* There is no static cache.
- *
+ *
* @author Costin Manolache
*/
public class DynamicObject {
@@ -45,7 +45,7 @@ public class DynamicObject {
BigDecimal.class, BigInteger.class, AtomicInteger.class,
AtomicLong.class, java.io.File.class, };
-
+
private Class realClass;
// Method or Field
@@ -99,7 +99,7 @@ public class DynamicObject {
getAttMap.put(fields[j].getName(), fields[j]);
}
}
-
+
}
public List<String> attributeNames() {
@@ -148,11 +148,11 @@ public class DynamicObject {
}
}
- /**
+ /**
* Set an object-type attribute.
- *
- * Use setProperty to use a string value and convert it to the
- * specific (primitive) type.
+ *
+ * Use setProperty to use a string value and convert it to the
+ * specific (primitive) type.
*/
public boolean setAttribute(Object proxy, String name, Object value) {
// TODO: use the cache...
@@ -188,7 +188,7 @@ public class DynamicObject {
try {
Method methods[] = proxy.getClass().getMethods();
-
+
Method setPropertyMethod = null;
// First, the ideal case - a setFoo( String ) method
@@ -213,7 +213,7 @@ public class DynamicObject {
}
}
// save "setProperty" for later
- if ("setProperty".equals(methods[i].getName()) &&
+ if ("setProperty".equals(methods[i].getName()) &&
paramT.length == 2 &&
paramT[0] == String.class &&
paramT[1] == String.class) {
@@ -251,7 +251,7 @@ public class DynamicObject {
}
// ----------- Helpers ------------------
-
+
static Object convert(String object, Class<?> paramType) {
Object result = null;
if ("java.lang.String".equals(paramType.getName())) {
@@ -285,7 +285,7 @@ public class DynamicObject {
/**
* Converts the first character of the given String into lower-case.
- *
+ *
* @param name
* The string to convert
* @return String
@@ -302,7 +302,7 @@ public class DynamicObject {
/**
* Check if this class is one of the supported types. If the class is
* supported, returns true. Otherwise, returns false.
- *
+ *
* @param ret
* The class to check
* @return boolean True if class is supported
@@ -322,7 +322,7 @@ public class DynamicObject {
/**
* Check if this class conforms to JavaBeans specifications. If the class is
* conformant, returns true.
- *
+ *
* @param javaType
* The class to check
* @return boolean True if the class is compatible.
@@ -357,7 +357,7 @@ public class DynamicObject {
}
return true;
}
-
+
/**
* Reverse of Introspector.decapitalize
*/
@@ -380,6 +380,6 @@ public class DynamicObject {
return true;
return false;
}
-
-
+
+
}
Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/HttpCookie.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/HttpCookie.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/HttpCookie.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/HttpCookie.java Sat Oct 22 21:30:59 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.
@@ -151,22 +151,22 @@ public class HttpCookie {
}
// commented the following out, b/c ok to have no expirationDate
- // that means that the cookie should last only for that particular
+ // that means that the cookie should last only for that particular
// session.
// if (expirationDate == null) {
// expirationDate = getDefaultExpiration();
// }
}
-
+
/* Returns the default expiration, which is the current time + default
expiration as specified in the properties file.
- This uses reflection to get at the properties file, since Globals is
- not in the utils/ directory
+ This uses reflection to get at the properties file, since Globals is
+ not in the utils/ directory
*/
private Date getDefaultExpiration() {
if (defaultSet == false) {
Properties props = new Properties();
-
+
try {
FileInputStream fin = new FileInputStream("ServerAutoRun.properties");
props.load( fin );
@@ -177,13 +177,13 @@ public class HttpCookie {
} catch (IOException ex) {
System.out.println("HttpCookie getDefaultExpiration : ServerAutoRun.properties not found!" + ex);
}
-
+
// defExprTime = props.getProperty("cookies.default.expiration");
defExprTime = Long.parseLong( props.getProperty("cookies.default.expiration") );
}
defaultSet = true;
-
+
return (new Date(System.currentTimeMillis() + defExprTime));
}
Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/RfcDateParser.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/RfcDateParser.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/RfcDateParser.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/RfcDateParser.java Sat Oct 22 21:30:59 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.
@@ -26,7 +26,7 @@ import java.util.TimeZone;
* attempt to parse it by trying matches with a set of patterns, returning
* null on failure, a Date object on success.
*
- * @author Ramesh.Mandava
+ * @author Ramesh.Mandava
*/
public class RfcDateParser {
@@ -86,7 +86,7 @@ public class RfcDateParser {
}
return null;
- }
+ }
private Date tryParsing(String format) {
Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/WatchdogClient.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/WatchdogClient.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/WatchdogClient.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/WatchdogClient.java Sat Oct 22 21:30:59 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,32 +39,32 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
public class WatchdogClient {
-
- protected String goldenDir;
+
+ protected String goldenDir;
protected String testMatch;
protected String file;
protected String[] exclude = null;
- protected String[] slow =
- {
- "SingleModelTest" // slow
- };
+ protected String[] slow =
+ {
+ "SingleModelTest" // slow
+ };
protected String targetMatch;
-
+
protected int port;
-
+
Properties props = new Properties();
-
+
protected void beforeSuite() {
}
-
+
protected void afterSuite(TestResult res) {
}
-
+
public Test getSuite() {
return getSuite(port);
}
-
+
public static class NullResolver implements EntityResolver {
public InputSource resolveEntity (String publicId,
String systemId)
@@ -73,7 +73,7 @@ public class WatchdogClient {
return new InputSource(new StringReader(""));
}
}
-
+
/** Read XML as DOM.
*/
public static Document readXml(InputStream is)
@@ -89,10 +89,10 @@ public class WatchdogClient {
Document doc = db.parse(is);
return doc;
}
-
- /**
- * Return a test suite for running a watchdog-like
- * test file.
+
+ /**
+ * Return a test suite for running a watchdog-like
+ * test file.
*
* @param base base dir for the watchdog dir
* @param testMatch Prefix of tests to be run
@@ -101,13 +101,13 @@ public class WatchdogClient {
public Test getSuite(int port) {
TestSuite tests = new WatchdogTests();
tests.setName(this.getClass().getSimpleName());
-
+
props.setProperty("port", Integer.toString(port));
props.setProperty("host", "localhost");
- props.setProperty("wgdir",
+ props.setProperty("wgdir",
goldenDir);
-
-
+
+
try {
Document doc = readXml(new FileInputStream(file));
Element docE = doc.getDocumentElement();
@@ -118,10 +118,10 @@ public class WatchdogClient {
if (targetMatch != null && !targetName.equals(targetMatch)) {
continue;
}
-
+
// Tests are duplicated
//TestSuite targetSuite = new TestSuite(targetName);
-
+
NodeList watchDogL = target.getElementsByTagName("watchdog");
for (int j = 0; j < watchDogL.getLength(); j++) {
Element watchE = (Element) watchDogL.item(j);
@@ -138,7 +138,7 @@ public class WatchdogClient {
boolean found = false;
for (String e: exclude) {
if (e.equals(testName)) {
- found = true;
+ found = true;
break;
}
}
@@ -155,7 +155,7 @@ public class WatchdogClient {
}
}
}
-
+
} catch (IOException e) {
e.printStackTrace();
} catch (SAXException e) {
@@ -165,7 +165,7 @@ public class WatchdogClient {
}
return tests;
}
-
+
// --------- Inner classes -------------
protected String getWatchdogdir() {
@@ -193,10 +193,10 @@ public class WatchdogClient {
}
// Support for running a single test in the suite
-
+
protected String single;
WatchdogTestCase singleTest;
-
+
public int countTestCases() {
return 1;
}
Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/WatchdogHttpClient.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/WatchdogHttpClient.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/WatchdogHttpClient.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/WatchdogHttpClient.java Sat Oct 22 21:30:59 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.
@@ -33,16 +33,16 @@ import java.util.Vector;
public class WatchdogHttpClient {
private static final String CRLF = "\r\n";
private static final int LINE_FEED = 10;
-
+
static int debug = 0;
-
+
public static void dispatch(WatchdogTestImpl client) throws Exception {
HashMap requestHeaders = client.requestHeaders;
String host = client.host;
int port = client.port;
String content = client.content;
String request = client.request;
-
+
// XXX headers are ignored
Socket socket;
try {
@@ -52,7 +52,7 @@ public class WatchdogHttpClient {
return;
}
socket.setSoTimeout(10000);
-
+
//socket obtained, rebuild the request.
rebuildRequest(client, client.request, socket);
@@ -61,7 +61,7 @@ public class WatchdogHttpClient {
// Write the request
socket.setSoLinger( true, 1000 );
- OutputStream out = new BufferedOutputStream(
+ OutputStream out = new BufferedOutputStream(
socket.getOutputStream() );
StringBuffer reqbuf = new StringBuffer( 128 );
@@ -93,10 +93,10 @@ public class WatchdogHttpClient {
}
reqbuf.append( client.request ).append( CRLF );
- // append all request headers
+ // append all request headers
if ( !requestHeaders.isEmpty() ) {
Iterator iter = requestHeaders.keySet().iterator();
-
+
while ( iter.hasNext() ) {
StringBuffer tmpBuf = new StringBuffer(32);
String headerKey = ( String ) iter.next();
@@ -131,12 +131,12 @@ public class WatchdogHttpClient {
reqbuf.append( "" ).append( CRLF );
}
- // append request content
+ // append request content
if ( content != null ) {
reqbuf.append( content );
// XXX no CRLF at the end -see HTTP specs!
}
-
+
byte[] reqbytes = reqbuf.toString().getBytes();
try {
@@ -153,7 +153,7 @@ public class WatchdogHttpClient {
// read the response
try {
-
+
client.responseLine = read( in );
if ( debug > 0 ) {
@@ -161,7 +161,7 @@ public class WatchdogHttpClient {
}
client.headers = parseHeaders( client, in );
-
+
byte[] result = readBody( in );
if ( result != null ) {
@@ -170,7 +170,7 @@ public class WatchdogHttpClient {
System.out.println( " RESPONSE BODY:\n" + new String( client.responseBody ) );
}
}
-
+
} catch ( SocketException ex ) {
System.out.println( " Socket Exception: " + ex );
} finally {
@@ -180,9 +180,9 @@ public class WatchdogHttpClient {
socket.close();
socket = null;
}
-
+
}
-
+
/**
* <code>readBody</code> reads the body of the response
* from the InputStream.
@@ -204,7 +204,7 @@ public class WatchdogHttpClient {
}
}
sb.append( ( char ) ch );
-
+
} catch ( IOException ex ) {
return null;
}
@@ -259,7 +259,7 @@ public class WatchdogHttpClient {
return sb.toString();
}
-
+
// ==================== Code from JSERV !!! ====================
/**
* Parse the incoming HTTP request headers, and set the corresponding
@@ -323,14 +323,14 @@ public class WatchdogHttpClient {
/**
* <code>CRBufferedInputStream</code> is a modified version of
- * the java.io.BufferedInputStream class. The fill code is
+ * the java.io.BufferedInputStream class. The fill code is
* the same, but the read is modified in that if a carriage return
- * is found in the response stream from the target server,
+ * is found in the response stream from the target server,
* it will skip that byte and return the next in the stream.
*/
private static class CRBufferedInputStream extends BufferedInputStream {
private static final int CARRIAGE_RETURN = 13;
-
+
private static final int DEFAULT_BUFFER = 2048;
/**
@@ -401,11 +401,11 @@ public class WatchdogHttpClient {
}
}
count = pos;
- int n = in.read(buf, pos, buf.length - pos);
+ int n = in.read(buf, pos, buf.length - pos);
if (n > 0) {
count = n + pos;
}
}
}
-
+
}
Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/WatchdogTestCase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/WatchdogTestCase.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/WatchdogTestCase.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/WatchdogTestCase.java Sat Oct 22 21:30:59 2011
@@ -20,11 +20,11 @@ public class WatchdogTestCase implements
private Properties props;
private WatchdogClient wc;
-
+
public WatchdogTestCase() {
-
+
}
-
+
public WatchdogTestCase(Element watchE, Properties props, String testName) {
this.testName = testName;
this.watchE = watchE;
@@ -42,10 +42,10 @@ public class WatchdogTestCase implements
public String toString() {
return getName();
}
-
+
public void testDummy() {
}
-
+
public void run(TestResult res) {
if (watchE == null) {
res.endTest(this);
@@ -60,7 +60,7 @@ public class WatchdogTestCase implements
String value = n.getNodeValue();
value = AntProperties.replaceProperties(value, props, null);
try {
- new DynamicObject(test.getClass()).setProperty(test,
+ new DynamicObject(test.getClass()).setProperty(test,
name, value);
} catch (Exception e) {
// TODO Auto-generated catch block
Modified: tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/WatchdogTestImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/WatchdogTestImpl.java?rev=1187812&r1=1187811&r2=1187812&view=diff
==============================================================================
--- tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/WatchdogTestImpl.java (original)
+++ tomcat/trunk/modules/tomcat-lite/test/org/apache/tomcat/test/watchdog/WatchdogTestImpl.java Sat Oct 22 21:30:59 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.
@@ -136,7 +136,7 @@ public class WatchdogTestImpl {
/**
* Creates a new <code>GTest</code> instance.
- *
+ *
*/
public WatchdogTestImpl() {
}
@@ -144,7 +144,7 @@ public class WatchdogTestImpl {
/**
* <code>setTestSession</code> adds a CookieController for the value of
* sessionName
- *
+ *
* @param sessionName
* a <code>String</code> value
*/
@@ -160,7 +160,7 @@ public class WatchdogTestImpl {
/**
* <code>setTestName</code> sets the current test name.
- *
+ *
* @param tn
* current testname.
*/
@@ -170,7 +170,7 @@ public class WatchdogTestImpl {
/**
* <code>setAssertion</code> sets the assertion text for the current test.
- *
+ *
* @param assertion
* assertion text
*/
@@ -180,7 +180,7 @@ public class WatchdogTestImpl {
/**
* <code>setTestStrategy</code> sets the test strategy for the current test.
- *
+ *
* @param strategy
* test strategy text
*/
@@ -190,7 +190,7 @@ public class WatchdogTestImpl {
/**
* <code>getTestName</code> returns the current test name.
- *
+ *
* @return a <code>String</code> value
*/
public String getTestName() {
@@ -199,7 +199,7 @@ public class WatchdogTestImpl {
/**
* <code>getAssertion</code> returns the current assertion text.
- *
+ *
* @return a <code>String</code> value
*/
public String getAssertion() {
@@ -208,7 +208,7 @@ public class WatchdogTestImpl {
/**
* <code>getTestStrategy</code> returns the current test strategy test.
- *
+ *
* @return a <code>String</code> value
*/
public String getTestStrategy() {
@@ -218,7 +218,7 @@ public class WatchdogTestImpl {
/**
* <code>setFirstTask</code> denotes that current task being executed is the
* first task within the list.
- *
+ *
* @param a
* <code>boolean</code> value
*/
@@ -229,7 +229,7 @@ public class WatchdogTestImpl {
/**
* <code>setLastTask</code> denotes that the current task being executed is
* the last task within the list.
- *
+ *
* @param a
* <code>boolean</code> value
*/
@@ -239,7 +239,7 @@ public class WatchdogTestImpl {
/**
* <code>setPrefix</code> sets the protocol prefix. Defaults to "http"
- *
+ *
* @param prefix
* Either http or https
*/
@@ -250,7 +250,7 @@ public class WatchdogTestImpl {
/**
* <code>setHost</code> sets hostname where the target server is running.
* Defaults to "localhost"
- *
+ *
* @param h
* a <code>String</code> value
*/
@@ -261,7 +261,7 @@ public class WatchdogTestImpl {
/**
* <code>setPort</code> sets the port that the target server is listening
* on. Defaults to "8080"
- *
+ *
* @param portS
* a <code>String</code> value
*/
@@ -274,7 +274,7 @@ public class WatchdogTestImpl {
* made of the server's response and the test's goldenFile, or if a token
* comparison is made. By default, only a token comparison is made
* ("false").
- *
+ *
* @param exact
* a <code>String</code> value
*/
@@ -285,7 +285,7 @@ public class WatchdogTestImpl {
/**
* <code>setContent</code> String value upon which the request header
* Content-Length is based upon.
- *
+ *
* @param s
* a <code>String</code> value
*/
@@ -296,7 +296,7 @@ public class WatchdogTestImpl {
/**
* <code>setDebug</code> enables debug output. By default, this is disabled
* ( value of "0" ).
- *
+ *
* @param debugS
* a <code>String</code> value
*/
@@ -307,7 +307,7 @@ public class WatchdogTestImpl {
/**
* <code>setMagnitude</code> Expected return value of the test execution.
* Defaults to "true"
- *
+ *
* @param magnitudeS
* a <code>String</code> value
*/
@@ -318,7 +318,7 @@ public class WatchdogTestImpl {
/**
* <code>setGoldenFile</code> Sets the goldenfile that will be used to
* validate the server's response.
- *
+ *
* @param s
* fully qualified path and filename
*/
@@ -329,7 +329,7 @@ public class WatchdogTestImpl {
/**
* <code>setExpectResponseBody</code> sets a flag to indicate if a response
* body is expected from the server or not
- *
+ *
* @param b
* a <code>boolean</code> value
*/
@@ -340,7 +340,7 @@ public class WatchdogTestImpl {
/**
* <code>setExpectHeaders</code> Configures GTest to look for the header
* passed in the server's response.
- *
+ *
* @param s
* a <code>String</code> value in the format of
* <header-field>:<header-value>
@@ -357,7 +357,7 @@ public class WatchdogTestImpl {
/**
* <code>setUnexpectedHeaders</code> Configures GTest to look for the header
* passed to validate that it doesn't exist in the server's response.
- *
+ *
* @param s
* a <code>String</code> value in the format of
* <header-field>:<header-value>
@@ -374,7 +374,7 @@ public class WatchdogTestImpl {
/**
* <code>setResponseMatch</code> Match the passed value in the server's
* response.
- *
+ *
* @param s
* a <code>String</code> value
*/
@@ -385,7 +385,7 @@ public class WatchdogTestImpl {
/**
* <code>setRequest</code> Sets the HTTP/HTTPS request to be sent to the
* target server Ex. GET /servlet_path/val HTTP/1.0
- *
+ *
* @param s
* a <code>String</code> value in the form of METHOD PATH
* HTTP_VERSION
@@ -397,7 +397,7 @@ public class WatchdogTestImpl {
/**
* <code>setReturnCode</code> Sets the expected return code from the
* server's response.
- *
+ *
* @param code
* a valid HTTP response status code
*/
@@ -408,7 +408,7 @@ public class WatchdogTestImpl {
/**
* Describe <code>setReturnCodeMsg</code> Sets the expected return message
* to be found in the server's response.
- *
+ *
* @param code
* a valid HTTP resonse status code
* @param message
@@ -421,7 +421,7 @@ public class WatchdogTestImpl {
/**
* <code>setRequestHeaders</code> Configures the request headers GTest
* should send to the target server.
- *
+ *
* @param s
* a <code>String</code> value in for format of
* <field-name>:<field-value>
@@ -448,7 +448,7 @@ public class WatchdogTestImpl {
/**
* <code>execute</code> Executes the test.
- *
+ *
* @exception BuildException
* if an error occurs
*/
@@ -512,7 +512,7 @@ public class WatchdogTestImpl {
* <li>return codes and messages in the Status-Line
* <li>response body comparison againt a goldenfile
* </ul>
- *
+ *
* @param testCondition
* a <code>boolean</code> value
* @return a <code>boolean</code> value
@@ -830,7 +830,7 @@ public class WatchdogTestImpl {
/**
* Replaces any |client.ip| and |client.host| parameter marks with the host
* and IP values of the host upon which Watchdog is running.
- *
+ *
* @param request
* An HTTP request.
*/
@@ -868,7 +868,7 @@ public class WatchdogTestImpl {
/**
* <code>getExpectedResult</code> returns a byte array containing the
* content of the configured goldenfile
- *
+ *
* @return goldenfile as a byte[]
* @exception IOException
* if an error occurs
@@ -891,7 +891,7 @@ public class WatchdogTestImpl {
* <code>compare</code> compares the two byte arrays passed in to verify
* that the lengths of the arrays are equal, and that the content of the two
* arrays, byte for byte are equal.
- *
+ *
* @param fromServer
* a <code>byte[]</code> value
* @param fromGoldenFile
@@ -948,7 +948,7 @@ public class WatchdogTestImpl {
/**
* <code>compareWeak</code> creates new Strings from the passed arrays and
* then uses a StringTokenizer to compare non-whitespace tokens.
- *
+ *
* @param fromServer
* a <code>byte[]</code> value
* @param fromGoldenFile
@@ -1005,7 +1005,7 @@ public class WatchdogTestImpl {
/**
* <code>readBody</code> reads the body of the response from the
* InputStream.
- *
+ *
* @param input
* an <code>InputStream</code>
* @return a <code>byte[]</code> representation of the response
@@ -1035,7 +1035,7 @@ public class WatchdogTestImpl {
/**
* <code>setHeaderDetails</code> Wrapper method for parseHeader. Allows easy
* addition of headers to the specified HashMap
- *
+ *
* @param line
* a <code>String</code> value
* @param headerMap
@@ -1058,7 +1058,7 @@ public class WatchdogTestImpl {
* The parsed header field-name will be used as a key in the passed HashMap
* object, and the values found will be stored in an ArrayList associated
* with the field-name key.
- *
+ *
* @param line
* String representation of an HTTP header line.
* @param headers
@@ -1113,7 +1113,7 @@ public class WatchdogTestImpl {
/**
* <code>dumpHex</code> helper method to dump formatted hex output of the
* server response and the goldenfile.
- *
+ *
* @param serverResponse
* a <code>byte[]</code> value
* @param goldenFile
@@ -1144,7 +1144,7 @@ public class WatchdogTestImpl {
/**
* <code>cloneHeaders</code> returns a "cloned" HashMap of the map passed
* in.
- *
+ *
* @param map
* a <code>HashMap</code> value
* @return a <code>HashMap</code> value
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org