hammant 2002/12/21 12:57:32
Modified: altrmi/src/test/org/apache/excalibur/altrmi/test/http
JettyTestCase.java
Log:
Jetty tested fully.
Revision Changes Path
1.2 +21 -6
jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/http/JettyTestCase.java
Index: JettyTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/http/JettyTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JettyTestCase.java 19 Dec 2002 23:08:58 -0000 1.1
+++ JettyTestCase.java 21 Dec 2002 20:57:32 -0000 1.2
@@ -7,11 +7,13 @@
*/
package org.apache.excalibur.altrmi.test.http;
+import junit.framework.TestCase;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
import org.mortbay.http.HttpContext;
import org.mortbay.http.HttpServer;
import org.mortbay.http.SocketListener;
import org.mortbay.http.handler.ResourceHandler;
-import junit.framework.TestCase;
import java.net.URL;
import java.net.URLConnection;
@@ -60,19 +62,32 @@
}
- public void testBlah() throws Exception {
+ public void testURLConnectionGet() throws Exception {
URL url = new URL("http","localhost", HTTP_PORT,"/test/hi.txt");
URLConnection connection = url.openConnection();
String contentType = connection.getContentType();
assertEquals("text/plain", contentType);
}
- public void testBlah2() throws Exception {
- testBlah();
+ public void testURLConnectionGet2() throws Exception {
+ // make sure the get is reentrant
+ testURLConnectionGet();
+ }
+
+ public void testHttpClientGet() throws Exception {
+ HttpClient client = new HttpClient();
+ client.getHostConfiguration().setHost("localhost", HTTP_PORT, "http");
+ // we shouldn't have to wait if a connection is available
+ client.setHttpConnectionFactoryTimeout( 10 * 1000 );
+
+ GetMethod getMethod = new GetMethod("/test/hi.txt");
+ client.executeMethod(getMethod);
+ assertEquals("hi",new String(getMethod.getResponseBody()));
}
- public void testBlah3() throws Exception {
- testBlah();
+ public void testHttpClientGet2() throws Exception {
+ // make sure the get is reentrant
+ testHttpClientGet();
}
protected void tearDown() throws Exception
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>