commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oglu...@apache.org
Subject cvs commit: jakarta-commons/httpclient/src/test/org/apache/commons/httpclient TestMethodsLocalHost.java
Date Wed, 18 Dec 2002 20:07:50 GMT
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:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message