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 2003/01/22 13:58:17 UTC

cvs commit: jakarta-commons/httpclient/src/test/org/apache/commons/httpclient TestGetMethodLocal.java TestHttpClientLocalHost.java TestHttps.java TestMethodsExternalHost.java TestMethodsLocalHost.java TestNoHost.java TestTraceMethodLocal.java TestWebappBasicAuth.java TestWebappHeaders.java TestWebappParameters.java TestWebappRedirect.java

oglueck     2003/01/22 04:58:16

  Modified:    httpclient/src/test/org/apache/commons/httpclient
                        TestGetMethodLocal.java
                        TestHttpClientLocalHost.java TestHttps.java
                        TestMethodsExternalHost.java
                        TestMethodsLocalHost.java TestNoHost.java
                        TestTraceMethodLocal.java TestWebappBasicAuth.java
                        TestWebappHeaders.java TestWebappParameters.java
                        TestWebappRedirect.java
  Log:
  tests cleaned up by Oleg Kalnichevski
  All tests perform well with HTTP proxy
  
  Revision  Changes    Path
  1.7       +9 -11     jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestGetMethodLocal.java
  
  Index: TestGetMethodLocal.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestGetMethodLocal.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestGetMethodLocal.java	16 Dec 2002 19:25:55 -0000	1.6
  +++ TestGetMethodLocal.java	22 Jan 2003 12:58:14 -0000	1.7
  @@ -144,7 +144,7 @@
   
       public void testGetSlashWithoutDisk() {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +        client.getHostConfiguration().setHost(host, port, "http");
   
           GetMethod method = new GetMethod("/");
           method.setUseDisk(false);
  @@ -167,7 +167,7 @@
   
       public void testGetSlashWithDisk() {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +        client.getHostConfiguration().setHost(host, port, "http");
   
           GetMethod method = new GetMethod("/");
           method.setUseDisk(true);
  @@ -190,7 +190,7 @@
   
       public void testRecycle() {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +        client.getHostConfiguration().setHost(host, port, "http");
   
           GetMethod method = new GetMethod("/");
           method.setUseDisk(false);
  @@ -233,7 +233,7 @@
   
       public void test404() {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +        client.getHostConfiguration().setHost(host, port, "http");
   
           GetMethod method = new GetMethod("/i/am/assuming/this/path/and/file/doesnt/exist/on/the/web/server.xyzzy");
           method.setUseDisk(false);
  @@ -258,7 +258,7 @@
       public void testGetResponseNotReadAutoRecover() {
   
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +        client.getHostConfiguration().setHost(host, port, "http");
   
           try {
               // issue a GET with a connection: close, and don't parse the body.
  @@ -272,8 +272,6 @@
               GetMethod method2 = new GetMethod(path);
               client.executeMethod(method2);
               assertEquals(0, method2.getRecoverableExceptionCount() );
  -
  -            client.endSession();
           }
           catch (IOException ioe) {
   
  
  
  
  1.8       +6 -8      jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpClientLocalHost.java
  
  Index: TestHttpClientLocalHost.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpClientLocalHost.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TestHttpClientLocalHost.java	7 Jan 2003 23:51:01 -0000	1.7
  +++ TestHttpClientLocalHost.java	22 Jan 2003 12:58:14 -0000	1.8
  @@ -115,18 +115,17 @@
       }
   
       public void testExecuteMethod() throws Exception {
  -        client.startSession(host, port);
  +        client.getHostConfiguration().setHost(host, port, "http");
           GetMethod getSlash = new GetMethod(getPath);
           assertEquals(200, client.executeMethod(getSlash));
           String data = getSlash.getResponseBodyAsString();
           assertTrue(null != data);
           assertTrue(data.length() > 0);
  -        client.endSession();
       }
   
   
       public void testExecuteMultipleMethods() throws Exception {
  -        client.startSession(host, port);
  +        client.getHostConfiguration().setHost(host, port, "http");
           getSlash = new GetMethod(getPath);
           for(int i=0;i<10;i++) {
               assertEquals(200, client.executeMethod(getSlash));
  @@ -136,7 +135,6 @@
               getSlash.recycle();
               getSlash.setPath(getPath);
           }
  -        client.endSession();
       }
   
   }
  
  
  
  1.7       +14 -26    jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttps.java
  
  Index: TestHttps.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttps.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestHttps.java	7 Jan 2003 23:51:01 -0000	1.6
  +++ TestHttps.java	22 Jan 2003 12:58:14 -0000	1.7
  @@ -62,8 +62,6 @@
   
   package org.apache.commons.httpclient;
   
  -import java.net.URL;
  -
   import junit.framework.Test;
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
  @@ -87,8 +85,8 @@
   public class TestHttps extends TestCase {
   
       // ---------------------------------------------------------------- Members
  -    private URL _urlWithPort = null;
  -    private URL _urlWithoutPort = null;
  +    private String _urlWithPort = null;
  +    private String _urlWithoutPort = null;
       private final String PROXY_HOST = System.getProperty("httpclient.test.proxyHost");
       private final String PROXY_PORT = System.getProperty("httpclient.test.proxyPort");
       private final String PROXY_USER = System.getProperty("httpclient.test.proxyUser");
  @@ -111,26 +109,21 @@
       }
   
       public void setUp() throws Exception {
  -        _urlWithPort = new URL("https://www.verisign.com:443/");
  -        _urlWithoutPort = new URL("https://www.verisign.com/");
  +        _urlWithPort = "https://www.verisign.com:443/";
  +        _urlWithoutPort = "https://www.verisign.com/";
       }
   
       public void testHttpsGet() {
           HttpClient client = new HttpClient();
  -        if (PROXY_HOST == null) {
  -        client.startSession(_urlWithPort);
  -        } else {
  +        if (PROXY_HOST != null) {
               if (PROXY_USER != null) {
                   HttpState state = client.getState();
                   state.setProxyCredentials(null, new UsernamePasswordCredentials(
                       PROXY_USER, PROXY_PASS));
               }
  -            client.startSession(_urlWithPort.getHost(), _urlWithPort.getPort(),
  -             PROXY_HOST,
  -             Integer.parseInt(PROXY_PORT),
  -             true);
  +            client.getHostConfiguration().setProxy(PROXY_HOST, Integer.parseInt(PROXY_PORT));
           }
  -        GetMethod method = new GetMethod("/");
  +        GetMethod method = new GetMethod(_urlWithPort);
           method.setUseDisk(false);
           try {
               client.executeMethod(method);
  @@ -151,20 +144,15 @@
   
       public void testHttpsGetNoPort() {
           HttpClient client = new HttpClient();
  -        if (PROXY_HOST == null) {
  -        client.startSession(_urlWithoutPort);
  -        } else {
  +        if (PROXY_HOST != null) {
               if (PROXY_USER != null) {
                   HttpState state = client.getState();
                   state.setProxyCredentials(null, new UsernamePasswordCredentials(
                       PROXY_USER, PROXY_PASS));
               }
  -            client.startSession(_urlWithoutPort.getHost(), 443,
  -             PROXY_HOST,
  -             Integer.parseInt(PROXY_PORT),
  -             true);
  +            client.getHostConfiguration().setProxy(PROXY_HOST, Integer.parseInt(PROXY_PORT));
           }
  -        GetMethod method = new GetMethod("/");
  +        GetMethod method = new GetMethod(_urlWithoutPort);
           method.setUseDisk(false);
           try {
               client.executeMethod(method);
  
  
  
  1.6       +23 -26    jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestMethodsExternalHost.java
  
  Index: TestMethodsExternalHost.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestMethodsExternalHost.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestMethodsExternalHost.java	23 Sep 2002 13:48:49 -0000	1.5
  +++ TestMethodsExternalHost.java	22 Jan 2003 12:58:14 -0000	1.6
  @@ -113,21 +113,17 @@
       public void testMethodsOptionsExternal() {
   
           HttpClient client = new HttpClient();
  -        client.startSession(externalHost, externalPort);
  +	    client.getHostConfiguration().setHost(externalHost, externalPort, "http");
           OptionsMethod method = new OptionsMethod(externalPath);
   
           try {
  -            client.startSession(externalHost, externalPort);
  -            if (PROXY_HOST == null) {
  -                client.startSession(externalHost, externalPort);
  -            } else {
  +            if (PROXY_HOST != null) {
                   if (PROXY_USER != null) {
                       HttpState state = client.getState();
                       state.setProxyCredentials(null, new UsernamePasswordCredentials(
                           PROXY_USER, PROXY_PASS));
                   }
  -                client.startSession(externalHost, externalPort,
  -                 PROXY_HOST, Integer.parseInt(PROXY_PORT), false);
  +                client.getHostConfiguration().setProxy(PROXY_HOST, Integer.parseInt(PROXY_PORT));
               }
               client.executeMethod(method);
           } catch (Throwable t) {
  @@ -149,17 +145,18 @@
       public void testMethodsGetExternal() {
   
           HttpClient client = new HttpClient();
  -        if (PROXY_HOST == null) {
  -        client.startSession(externalHost, externalPort);
  -        } else {
  +
  +	    client.getHostConfiguration().setHost(externalHost, externalPort, "http");
  +
  +        if (PROXY_HOST != null) {
               if (PROXY_USER != null) {
                   HttpState state = client.getState();
                   state.setProxyCredentials(null, new UsernamePasswordCredentials(
                       PROXY_USER, PROXY_PASS));
               }
  -            client.startSession(externalHost, externalPort,
  -             PROXY_HOST, Integer.parseInt(PROXY_PORT), false);
  +            client.getHostConfiguration().setProxy(PROXY_HOST, Integer.parseInt(PROXY_PORT));
           }
  +
           GetMethod method = new GetMethod("/");
           method.setUseDisk(false);
   
  @@ -209,16 +206,15 @@
       public void testMethodsHeadExternal() {
   
           HttpClient client = new HttpClient();
  -        if (PROXY_HOST == null) {
  -        client.startSession(externalHost, externalPort);
  -        } else {
  +	    client.getHostConfiguration().setHost(externalHost, externalPort, "http");
  +
  +        if (PROXY_HOST != null) {
               if (PROXY_USER != null) {
                   HttpState state = client.getState();
                   state.setProxyCredentials(null, new UsernamePasswordCredentials(
                       PROXY_USER, PROXY_PASS));
               }
  -            client.startSession(externalHost, externalPort,
  -             PROXY_HOST, Integer.parseInt(PROXY_PORT), false);
  +            client.getHostConfiguration().setProxy(PROXY_HOST, Integer.parseInt(PROXY_PORT));
           }
           HeadMethod method = new HeadMethod(externalPath);
   
  @@ -243,17 +239,18 @@
           HttpClient client = new HttpClient();
           String host = "whaturl.com.org";
           int port = 80;
  -        if (PROXY_HOST == null) {
  -            client.startSession(host, port);
  -        } else {
  +
  +	    client.getHostConfiguration().setHost(host, port, "http");
  +
  +        if (PROXY_HOST != null) {
               if (PROXY_USER != null) {
                   HttpState state = client.getState();
                   state.setProxyCredentials(null, new UsernamePasswordCredentials(
                       PROXY_USER, PROXY_PASS));
               }
  -            client.startSession(host, port,
  -             PROXY_HOST, Integer.parseInt(PROXY_PORT), false);
  +            client.getHostConfiguration().setProxy(PROXY_HOST, Integer.parseInt(PROXY_PORT));
           }
  +
           GetMethod method = new GetMethod("");
   
           try {
  
  
  
  1.9       +7 -7      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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TestMethodsLocalHost.java	7 Jan 2003 23:51:01 -0000	1.8
  +++ TestMethodsLocalHost.java	22 Jan 2003 12:58:14 -0000	1.9
  @@ -126,7 +126,7 @@
           OptionsMethod method = new OptionsMethod("/");
   
           try {
  -            client.startSession(host, port);
  +	        client.getHostConfiguration().setHost(host, port, "http");
               client.executeMethod(method);
           } catch (Throwable t) {
               t.printStackTrace();
  @@ -149,7 +149,7 @@
       public void testMethodsGet() {
   
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
   
           GetMethod method = new GetMethod("/");
           method.setUseDisk(false);
  @@ -201,7 +201,7 @@
       public void testMethodsHead() {
   
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
   
           OptionsMethod opmethod = new OptionsMethod("/");
   
  
  
  
  1.17      +4 -5      jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestNoHost.java
  
  Index: TestNoHost.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestNoHost.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- TestNoHost.java	3 Dec 2002 15:28:18 -0000	1.16
  +++ TestNoHost.java	22 Jan 2003 12:58:14 -0000	1.17
  @@ -89,7 +89,6 @@
           suite.addTest(TestHeader.suite());
           suite.addTest(TestHeaderElement.suite());
           suite.addTest(TestAuthenticator.suite());
  -        suite.addTest(TestHttpClientNoHost.suite());
           suite.addTest(TestHttpUrlMethod.suite());
           suite.addTest(TestURIUtil.suite());
           suite.addTest(TestURIUtil2.suite());
  
  
  
  1.4       +2 -2      jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestTraceMethodLocal.java
  
  Index: TestTraceMethodLocal.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestTraceMethodLocal.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestTraceMethodLocal.java	7 Jan 2003 23:51:01 -0000	1.3
  +++ TestTraceMethodLocal.java	22 Jan 2003 12:58:14 -0000	1.4
  @@ -130,7 +130,7 @@
       public void testExecute() {
       	
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
   
           TraceMethod method = new TraceMethod("/");
   
  @@ -174,7 +174,7 @@
       
       public void testRecycle() {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
   
           TraceMethod method = new TraceMethod("/");
           
  
  
  
  1.6       +9 -9      jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappBasicAuth.java
  
  Index: TestWebappBasicAuth.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappBasicAuth.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestWebappBasicAuth.java	7 Jan 2003 23:51:01 -0000	1.5
  +++ TestWebappBasicAuth.java	22 Jan 2003 12:58:14 -0000	1.6
  @@ -109,7 +109,7 @@
       public void testSimpleAuthGet() throws Exception {
           HttpClient client = new HttpClient();
           client.getState().setCredentials("BasicAuthServlet",new UsernamePasswordCredentials("jakarta","commons"));
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           GetMethod method = new GetMethod("/" + context + "/auth/basic");
           method.setUseDisk(false);
           try {
  @@ -138,7 +138,7 @@
       public void testSimpleAuthPost() throws Exception {
           HttpClient client = new HttpClient();
           client.getState().setCredentials("BasicAuthServlet",new UsernamePasswordCredentials("jakarta","commons"));
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           PostMethod method = new PostMethod("/" + context + "/auth/basic");
           method.addParameter("testing","one");
           method.setUseDisk(false);
  @@ -169,7 +169,7 @@
       public void testSimpleAuthPut() throws Exception {
           HttpClient client = new HttpClient();
           client.getState().setCredentials("BasicAuthServlet",new UsernamePasswordCredentials("jakarta","commons"));
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           PutMethod method = new PutMethod("/" + context + "/auth/basic");
           method.setRequestBody("testing one two three");
           try {
  @@ -197,7 +197,7 @@
   
       public void testNoCredAuthRetry() throws Exception {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           GetMethod method = new GetMethod("/" + context + "/auth/basic");
           method.setUseDisk(false);
           try {
  @@ -227,7 +227,7 @@
   
       public void testBadCredFails() throws Exception {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           GetMethod method = new GetMethod("/" + context + "/auth/basic");
           method.setUseDisk(false);
           try {
  
  
  
  1.6       +10 -12    jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappHeaders.java
  
  Index: TestWebappHeaders.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappHeaders.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestWebappHeaders.java	16 Dec 2002 05:16:04 -0000	1.5
  +++ TestWebappHeaders.java	22 Jan 2003 12:58:15 -0000	1.6
  @@ -108,7 +108,7 @@
        */
       public void testAddRequestHeader() throws Exception {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           GetMethod method = new GetMethod("/" + context + "/headers");
           method.setRequestHeader(new Header("addRequestHeader(Header)","True"));
           method.setRequestHeader("addRequestHeader(String,String)","Also True");
  @@ -129,7 +129,7 @@
        */
       public void testRemoveRequestHeader() throws Exception {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           GetMethod method = new GetMethod("/" + context + "/headers");
           method.setRequestHeader(new Header("XXX-A-HEADER","true"));
           method.removeRequestHeader("XXX-A-HEADER");
  @@ -149,7 +149,7 @@
        */
       public void testOverwriteRequestHeader() throws Exception {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           GetMethod method = new GetMethod("/" + context + "/headers");
           method.setRequestHeader(new Header("xxx-a-header","one"));
           method.setRequestHeader("XXX-A-HEADER","two");
  @@ -169,7 +169,7 @@
        */
       public void testGetResponseHeader() throws Exception {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           GetMethod method = new GetMethod("/" + context + "/headers");
           method.setUseDisk(false);
           try {
  @@ -197,14 +197,13 @@
           // Note: RFC 2616 is somewhat unclear on whether a host should
           // be sent in this context - however, both Mozilla and IE send
           // the header for an IP address, instead of sending blank.
  -        client.startSession(ip, port);
  +	    client.getHostConfiguration().setHost(ip, port, "http");
           try {
               client.executeMethod(get);
           } catch (Throwable t) {
               t.printStackTrace();
               fail("Unable to execute method : " + t.toString());
           }
  -        client.endSession();
           Header hostHeader = get.getRequestHeader("Host");
           assertTrue(hostHeader != null);
   
  @@ -217,14 +216,13 @@
           // is not available. Additionally, if the port is
           // something other that 80, then the port value
           // should also be present in the header.
  -        client.startSession(hostname, port);
  +	    client.getHostConfiguration().setHost(hostname, port, "http");
           try {
               client.executeMethod(get);
           } catch (Throwable t) {
               t.printStackTrace();
               fail("Unable to execute method : " + t.toString());
           }
  -        client.endSession();
           hostHeader = get.getRequestHeader("Host");
           assertTrue(hostHeader != null);
           if (port == 80) {
  
  
  
  1.6       +12 -12    jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappParameters.java
  
  Index: TestWebappParameters.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappParameters.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestWebappParameters.java	21 Oct 2002 14:03:07 -0000	1.5
  +++ TestWebappParameters.java	22 Jan 2003 12:58:15 -0000	1.6
  @@ -108,7 +108,7 @@
        */
       public void testGetMethodQueryString() throws Exception {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           GetMethod method = new GetMethod("/" + context + "/params");
           method.setQueryString("?hadQuestionMark=true");
           method.setUseDisk(false);
  @@ -129,7 +129,7 @@
        */
       public void testGetMethodQueryString2() throws Exception {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           GetMethod method = new GetMethod("/" + context + "/params");
           method.setQueryString("hadQuestionMark=false");
           method.setUseDisk(false);
  @@ -150,7 +150,7 @@
        */
       public void testGetMethodParameters() throws Exception {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           GetMethod method = new GetMethod("/" + context + "/params");
           method.setQueryString(new NameValuePair[] { new NameValuePair("param-one","param-value") });
           method.setUseDisk(false);
  @@ -171,7 +171,7 @@
        */
       public void testGetMethodMultiParameters() throws Exception {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           GetMethod method = new GetMethod("/" + context + "/params");
           method.setQueryString(new NameValuePair[] {
                                   new NameValuePair("param-one","param-value"),
  @@ -198,7 +198,7 @@
        */
       public void testGetMethodParameterWithoutValue() throws Exception {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           GetMethod method = new GetMethod("/" + context + "/params");
           method.setQueryString(new NameValuePair[] { new NameValuePair("param-without-value",null) });
           method.setUseDisk(false);
  @@ -219,7 +219,7 @@
        */
       public void testGetMethodParameterAppearsTwice() throws Exception {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           GetMethod method = new GetMethod("/" + context + "/params");
           method.setQueryString(new NameValuePair[] {
                                     new NameValuePair("foo","one"),
  @@ -240,7 +240,7 @@
   
       public void testGetMethodOverwriteQueryString() throws Exception {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           GetMethod method = new GetMethod("/" + context + "/params");
           method.setQueryString("query=string");
           method.setQueryString(new NameValuePair[] {
  @@ -268,7 +268,7 @@
        */
       public void testPostMethodParameterAndQueryString() throws Exception {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           PostMethod method = new PostMethod("/" + context + "/params");
           method.setQueryString("query=string");
           method.addParameter("param","eter");
  
  
  
  1.12      +11 -12    jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappRedirect.java
  
  Index: TestWebappRedirect.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappRedirect.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TestWebappRedirect.java	16 Jan 2003 10:53:09 -0000	1.11
  +++ TestWebappRedirect.java	22 Jan 2003 12:58:15 -0000	1.12
  @@ -113,7 +113,7 @@
   
       public void testRedirect() throws Exception {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           GetMethod method = new GetMethod("/" + context + "/redirect");
           method.setQueryString("to=http://" + host + ":" + port + "/" + context + "/params");
           method.setUseDisk(false);
  @@ -130,7 +130,7 @@
       // see http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5870
       public void testRelativeRedirect() throws Exception {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           GetMethod method = new GetMethod("/" + context + "/redirect");
           method.setQueryString("to=/" + context + "/params");
           method.setUseDisk(false);
  @@ -146,7 +146,7 @@
   
       public void testRedirectWithQueryString() throws Exception {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           GetMethod method = new GetMethod("/" + context + "/redirect");
           method.setQueryString(new NameValuePair[] {
               new NameValuePair("to", "http://" + host + ":" + port + "/" + context + "/params?foo=bar&bar=foo")
  @@ -166,7 +166,7 @@
   
       public void testRecursiveRedirect() throws Exception {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           GetMethod method = new GetMethod("/" + context + "/redirect");
   
           String qs = "http://" + host + ":" + port + "/" + context + "/params?foo=bar&bar=foo";
  @@ -189,7 +189,7 @@
   
       public void testDetectRedirectLoop() throws Exception {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           GetMethod method = new GetMethod("/" + context + "/redirect");
           method.setQueryString("loop=true");
           try {
  @@ -208,7 +208,7 @@
       public void testPostRedirect() throws Exception {
           String bodyStr = "Hello World";
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           PostMethod method = new PostMethod("/" + context + "/redirect");
           method.setQueryString("to=" + URIUtil.encodeWithinQuery("http://" +
                       host + ":" + port + "/" + context +
  @@ -243,12 +243,11 @@
           }
           //buffered request is okay to redirect
           assertEquals(HttpStatus.SC_OK,method.getStatusCode());
  -        client.endSession();
       }
   
       public void testPutRedirect() throws Exception {
           HttpClient client = new HttpClient();
  -        client.startSession(host, port);
  +	    client.getHostConfiguration().setHost(host, port, "http");
           PutMethod method = new PutMethod("/" + context + "/redirect");
           method.setQueryString("to=" + URIUtil.encodeWithinQuery("http://" +
                       host + ":" + port + "/" + context +
  
  
  

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