remm        01/05/19 15:38:30

  Modified:    httpclient/src/test/org/apache/commons/httpclient
                        TestMethods.java
  Log:
  - Add back the tests with OPTIONS.
  - Do the testing against java.sun.com.
  
  Revision  Changes    Path
  1.5       +32 -10    
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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestMethods.java  2001/05/17 23:51:04     1.4
  +++ TestMethods.java  2001/05/19 22:38:29     1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestMethods.java,v
 1.4 2001/05/17 23:51:04 rwaldhoff Exp $
  - * $Revision: 1.4 $
  - * $Date: 2001/05/17 23:51:04 $
  + * $Header: 
/home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestMethods.java,v
 1.5 2001/05/19 22:38:29 remm Exp $
  + * $Revision: 1.5 $
  + * $Date: 2001/05/19 22:38:29 $
    *
    * ====================================================================
    *
  @@ -71,7 +71,7 @@
    * configuration of Tomcat 4 is used as the server.
    *
    * @author Remy Maucherat
  - * @version $Id: TestMethods.java,v 1.4 2001/05/17 23:51:04 rwaldhoff Exp $
  + * @version $Id: TestMethods.java,v 1.5 2001/05/19 22:38:29 remm Exp $
    */
   public class TestMethods extends TestCase {
   
  @@ -86,8 +86,8 @@
       // java.sun.com fails for some reason. We should figure out why,
       // but in the interest of having a working test suite,
       // I changed externalHost to jakarta instead.
  -//    private static final String externalHost = "java.sun.com";
  -    private static final String externalHost = "jakarta.apache.org";
  +    private static final String externalHost = "java.sun.com";
  +    //private static final String externalHost = "jakarta.apache.org";
       private static final int externalPort = 80;
       private static final String externalPath = "/index.html";
   
  @@ -109,7 +109,7 @@
   
       // ----------------------------------------------------------- OPTIONS Test
   
  -    /**
  +    
       public void testMethodsOptions() {
   
           HttpClient client = new HttpClient();
  @@ -128,8 +128,30 @@
           assert("No HTTP method allowed : result of OPTIONS is incorrect.",
                  methodsAllowed.hasMoreElements());
   
  +    }
  +
  +
  +    public void testMethodsOptionsExternal() {
  +
  +        HttpClient client = new HttpClient();
  +        client.startSession(externalHost, externalPort);
  +        OptionsMethod method = new OptionsMethod(externalPath);
  +
  +        try {
  +            client.startSession(host, port);
  +            client.executeMethod(method);
  +        } catch (Throwable t) {
  +            t.printStackTrace();
  +            fail("Unable to execute method : " + t.toString());
  +        }
  +
  +        Enumeration methodsAllowed = method.getAllowedMethods();
  +        // This enumeration musn't be empty
  +        assert("No HTTP method allowed : result of OPTIONS is incorrect.",
  +               methodsAllowed.hasMoreElements());
  +
       }
  -    */
  +
   
       // --------------------------------------------------------------- GET Test
   
  @@ -269,9 +291,9 @@
           try {
               client.executeMethod(method);
           } catch (IOException e) {
  -          return; // good
  +            return; // good
           } catch (HttpException e) {
  -          return; // also good
  +            return; // also good
           }
   
           fail("Should have thrown an exception");
  
  
  

Reply via email to