morgand 01/04/30 12:56:48
Modified: httpclient/src/test/org/apache/commons/httpclient
TestMethods.java
Log:
temporarily (?) added a test to hit an external URL (java.sun.com)
Revision Changes Path
1.2 +28 -6
jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestMethods.java
Index: TestMethods.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestMethods.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestMethods.java 2001/04/25 18:42:52 1.1
+++ TestMethods.java 2001/04/30 19:56:44 1.2
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestMethods.java,v
1.1 2001/04/25 18:42:52 remm Exp $
- * $Revision: 1.1 $
- * $Date: 2001/04/25 18:42:52 $
+ * $Header:
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestMethods.java,v
1.2 2001/04/30 19:56:44 morgand Exp $
+ * $Revision: 1.2 $
+ * $Date: 2001/04/30 19:56:44 $
*
* ====================================================================
*
@@ -70,7 +70,7 @@
* configuration of Tomcat 4 is used as the server.
*
* @author Remy Maucherat
- * @version $Id: TestMethods.java,v 1.1 2001/04/25 18:42:52 remm Exp $
+ * @version $Id: TestMethods.java,v 1.2 2001/04/30 19:56:44 morgand Exp $
*/
public class TestMethods extends TestCase {
@@ -81,6 +81,9 @@
private static final String host = "127.0.0.1";
private static final int port = 8080;
+ private static final String externalHost = "java.sun.com";
+ private static final int externalPort = 80;
+ private static final String externalPath = "/index.html";
// ------------------------------------------------------------ Constructor
@@ -100,7 +103,7 @@
// ----------------------------------------------------------- OPTIONS Test
-
+ /**
public void testMethodsOptions() {
HttpClient client = new HttpClient();
@@ -120,7 +123,7 @@
methodsAllowed.hasMoreElements());
}
-
+ */
// --------------------------------------------------------------- GET Test
@@ -214,6 +217,25 @@
method.recycle();
method.setPath("/index.html");
+
+ try {
+ client.executeMethod(method);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ fail("Unable to execute method : " + t.toString());
+ }
+
+ assert("Method failed : " + method.getStatusCode(),
+ (method.getStatusCode() == 200));
+
+ }
+
+ public void testMethodsHeadExternal() {
+
+ HttpClient client = new HttpClient();
+ client.startSession(externalHost, externalPort);
+
+ HeadMethod method = new HeadMethod(externalPath);
try {
client.executeMethod(method);