You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by og...@apache.org on 2002/12/18 21:07:50 UTC

cvs commit: jakarta-commons/httpclient/src/test/org/apache/commons/httpclient TestMethodsLocalHost.java

oglueck     2002/12/18 12:07:50

  Modified:    httpclient/src/test/org/apache/commons/httpclient
                        TestMethodsLocalHost.java
  Log:
  Added test case for HEAD to authenticating server.
  
  Revision  Changes    Path
  1.7       +22 -4     jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestMethodsLocalHost.java
  
  Index: TestMethodsLocalHost.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestMethodsLocalHost.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestMethodsLocalHost.java	16 Dec 2002 05:16:04 -0000	1.6
  +++ TestMethodsLocalHost.java	18 Dec 2002 20:07:50 -0000	1.7
  @@ -233,4 +233,22 @@
   
       }
   
  +
  +    public void testHeadAuth() throws Exception {
  +        HttpClient client = new HttpClient();
  +        HttpState state = client.getState();
  +        System.setProperty(Authenticator.PREEMPTIVE_PROPERTY, Authenticator.PREEMPTIVE_DEFAULT);
  +        Credentials cred = new UsernamePasswordCredentials("jakarta",
  +"commons");
  +        state.setCredentials(null, cred);
  +        HostConfiguration hc = new HostConfiguration();
  +        hc.setHost(host, port, "http");
  +        client.setHostConfiguration(hc);
  +        client.setState(state);
  +        HeadMethod method = new HeadMethod("/"+ webAppContext +"/auth/basic");
  +        client.executeMethod(method);
  +        method.releaseConnection();
  +        assertEquals(200, method.getStatusCode());
  +    }
  +
   }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>