commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject cvs commit: jakarta-commons/httpclient/src/test/org/apache/commons/httpclient FakeHttpMethod.java TestHttpMethodFundamentals.java TestRequestHeaders.java TestRequestLine.java TestResponseHeaders.java TestStreams.java SimpleHttpMethod.java
Date Sun, 31 Oct 2004 14:04:13 GMT
olegk       2004/10/31 06:04:13

  Modified:    httpclient/src/test/org/apache/commons/httpclient
                        FakeHttpMethod.java TestHttpMethodFundamentals.java
                        TestRequestHeaders.java TestRequestLine.java
                        TestResponseHeaders.java TestStreams.java
  Removed:     httpclient/src/test/org/apache/commons/httpclient
                        SimpleHttpMethod.java
  Log:
  SimpleHttpMethod class removed
  
  Revision  Changes    Path
  1.2       +15 -3     jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/FakeHttpMethod.java
  
  Index: FakeHttpMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/FakeHttpMethod.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FakeHttpMethod.java	31 Oct 2004 13:46:54 -0000	1.1
  +++ FakeHttpMethod.java	31 Oct 2004 14:04:13 -0000	1.2
  @@ -52,4 +52,16 @@
           getResponseHeaderGroup().addHeader(header);
       }
   
  +    public String generateRequestLine(
  +        final HttpConnection connection ,final HttpVersion version) {
  +        if (connection == null) {
  +            throw new IllegalArgumentException("Connection may not be null");
  +        }
  +        if (version == null) {
  +            throw new IllegalArgumentException("HTTP version may not be null");
  +        }
  +        return HttpMethodBase.generateRequestLine(connection, 
  +          this.getName(), this.getPath(), this.getQueryString(), version.toString());
  +    }
  +    
   }
  
  
  
  1.2       +9 -9      jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpMethodFundamentals.java
  
  Index: TestHttpMethodFundamentals.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpMethodFundamentals.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestHttpMethodFundamentals.java	7 Oct 2004 16:14:15 -0000	1.1
  +++ TestHttpMethodFundamentals.java	31 Oct 2004 14:04:13 -0000	1.2
  @@ -191,7 +191,7 @@
       }
   
       public void testHttpMethodBasePaths() throws Exception {
  -        HttpMethod simple = new SimpleHttpMethod();
  +        HttpMethod simple = new FakeHttpMethod();
           String[] paths = {
              "/some/absolute/path",
              "../some/relative/path",
  @@ -206,7 +206,7 @@
       }
   
       public void testHttpMethodBaseDefaultPath() throws Exception {
  -        HttpMethod simple = new SimpleHttpMethod();
  +        HttpMethod simple = new FakeHttpMethod();
           assertEquals("/", simple.getPath());
   
           simple.setPath("");
  @@ -217,13 +217,13 @@
       }
   
       public void testHttpMethodBasePathConstructor() throws Exception {
  -        HttpMethod simple = new SimpleHttpMethod();
  +        HttpMethod simple = new FakeHttpMethod();
           assertEquals("/", simple.getPath());
   
  -        simple = new SimpleHttpMethod("");
  +        simple = new FakeHttpMethod("");
           assertEquals("/", simple.getPath());
   
  -        simple = new SimpleHttpMethod("/some/path/");
  +        simple = new FakeHttpMethod("/some/path/");
           assertEquals("/some/path/", simple.getPath());
       }
   
  
  
  
  1.8       +10 -10    jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestRequestHeaders.java
  
  Index: TestRequestHeaders.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestRequestHeaders.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TestRequestHeaders.java	7 Oct 2004 16:14:15 -0000	1.7
  +++ TestRequestHeaders.java	31 Oct 2004 14:04:13 -0000	1.8
  @@ -61,7 +61,7 @@
       }
   
       public void testNullHeader() throws Exception {
  -        SimpleHttpMethod method = new SimpleHttpMethod();
  +        FakeHttpMethod method = new FakeHttpMethod();
           assertEquals(null, method.getRequestHeader(null));
           assertEquals(null, method.getRequestHeader("bogus"));
       }
  @@ -69,7 +69,7 @@
       public void testHostHeaderPortHTTP80() throws Exception {
           HttpConnection conn = new HttpConnection("some.host.name", 80);
           HttpState state = new HttpState();
  -        SimpleHttpMethod method = new SimpleHttpMethod();
  +        FakeHttpMethod method = new FakeHttpMethod();
           method.addRequestHeaders(state, conn);
           assertEquals("Host: some.host.name", method.getRequestHeader("Host").toString().trim());
       }
  @@ -77,7 +77,7 @@
       public void testHostHeaderPortHTTP81() throws Exception {
           HttpConnection conn = new HttpConnection("some.host.name", 81);
           HttpState state = new HttpState();
  -        SimpleHttpMethod method = new SimpleHttpMethod();
  +        FakeHttpMethod method = new FakeHttpMethod();
           method.addRequestHeaders(state, conn);
           assertEquals("Host: some.host.name:81", method.getRequestHeader("Host").toString().trim());
       }
  @@ -86,7 +86,7 @@
           HttpConnection conn = new HttpConnection("some.host.name", 443, 
                   Protocol.getProtocol("https"));
           HttpState state = new HttpState();
  -        SimpleHttpMethod method = new SimpleHttpMethod();
  +        FakeHttpMethod method = new FakeHttpMethod();
           method.addRequestHeaders(state, conn);
           assertEquals("Host: some.host.name", method.getRequestHeader("Host").toString().trim());
       }
  @@ -95,13 +95,13 @@
           HttpConnection conn = new HttpConnection("some.host.name", 444, 
                   Protocol.getProtocol("https"));
           HttpState state = new HttpState();
  -        SimpleHttpMethod method = new SimpleHttpMethod();
  +        FakeHttpMethod method = new FakeHttpMethod();
           method.addRequestHeaders(state, conn);
           assertEquals("Host: some.host.name:444", method.getRequestHeader("Host").toString().trim());
       }
   
       public void testHeadersPreserveCaseKeyIgnoresCase() throws Exception {
  -        SimpleHttpMethod method = new SimpleHttpMethod();
  +        FakeHttpMethod method = new FakeHttpMethod();
           method.addRequestHeader(new Header("NAME", "VALUE"));
           Header upHeader =  method.getRequestHeader("NAME");
           Header loHeader =  method.getRequestHeader("name");
  
  
  
  1.6       +24 -26    jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestRequestLine.java
  
  Index: TestRequestLine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestRequestLine.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestRequestLine.java	7 Oct 2004 16:14:15 -0000	1.5
  +++ TestRequestLine.java	31 Oct 2004 14:04:13 -0000	1.6
  @@ -55,66 +55,64 @@
           return new TestSuite(TestRequestLine.class);
       }
   
  -    // ------------------------------------------------------ Protected Methods
  -
  -
       // ----------------------------------------------------------- Test Methods
   
       public void testRequestLineGeneral() throws Exception {
  +        
           HttpConnection conn = new HttpConnection("localhost", 80);
  -        SimpleHttpMethod method = new SimpleHttpMethod();
  -        assertEquals("Simple / HTTP/1.1\r\n", method.getTestRequestLine(conn));
  +        FakeHttpMethod method = new FakeHttpMethod();
  +        assertEquals("Simple / HTTP/1.1\r\n", method.generateRequestLine(conn, HttpVersion.HTTP_1_1));
   
  -        method = new SimpleHttpMethod("stuff");
  -        assertEquals("Simple stuff HTTP/1.1\r\n", method.getTestRequestLine(conn));
  +        method = new FakeHttpMethod("stuff");
  +        assertEquals("Simple stuff HTTP/1.1\r\n", method.generateRequestLine(conn, HttpVersion.HTTP_1_1));
   
           conn = new HttpConnection("proxy", 8080, "localhost", 80, Protocol.getProtocol("http"));
   
  -        method = new SimpleHttpMethod();
  -        assertEquals("Simple http://localhost/ HTTP/1.1\r\n", method.getTestRequestLine(conn));
  +        method = new FakeHttpMethod();
  +        assertEquals("Simple http://localhost/ HTTP/1.1\r\n", method.generateRequestLine(conn,
HttpVersion.HTTP_1_1));
   
  -        method = new SimpleHttpMethod("stuff");
  -        assertEquals("Simple http://localhost/stuff HTTP/1.1\r\n", method.getTestRequestLine(conn));
  +        method = new FakeHttpMethod("stuff");
  +        assertEquals("Simple http://localhost/stuff HTTP/1.1\r\n", method.generateRequestLine(conn,
HttpVersion.HTTP_1_1));
   
           conn = new HttpConnection("proxy", 8080, "localhost", -1, Protocol.getProtocol("http"));
   
  -        method = new SimpleHttpMethod();
  -        assertEquals("Simple http://localhost/ HTTP/1.1\r\n", method.getTestRequestLine(conn));
  +        method = new FakeHttpMethod();
  +        assertEquals("Simple http://localhost/ HTTP/1.1\r\n", method.generateRequestLine(conn,
HttpVersion.HTTP_1_1));
   
  -        method = new SimpleHttpMethod("stuff");
  -        assertEquals("Simple http://localhost/stuff HTTP/1.1\r\n", method.getTestRequestLine(conn));
  +        method = new FakeHttpMethod("stuff");
  +        assertEquals("Simple http://localhost/stuff HTTP/1.1\r\n", method.generateRequestLine(conn,
HttpVersion.HTTP_1_1));
   
           conn = new HttpConnection("proxy", 8080, "localhost", 666, Protocol.getProtocol("http"));
   
  -        method = new SimpleHttpMethod();
  -        assertEquals("Simple http://localhost:666/ HTTP/1.1\r\n", method.getTestRequestLine(conn));
  +        method = new FakeHttpMethod();
  +        assertEquals("Simple http://localhost:666/ HTTP/1.1\r\n", method.generateRequestLine(conn,
HttpVersion.HTTP_1_1));
   
  -        method = new SimpleHttpMethod("stuff");
  -        assertEquals("Simple http://localhost:666/stuff HTTP/1.1\r\n", method.getTestRequestLine(conn));
  +        method = new FakeHttpMethod("stuff");
  +        assertEquals("Simple http://localhost:666/stuff HTTP/1.1\r\n", method.generateRequestLine(conn,
HttpVersion.HTTP_1_1));
       }
   
       public void testRequestLineQuery() throws Exception {
           HttpConnection conn = new HttpConnection("localhost", 80);
   
  -        SimpleHttpMethod method = new SimpleHttpMethod();
  +        FakeHttpMethod method = new FakeHttpMethod();
           method.setQueryString( new NameValuePair[] {
               new NameValuePair("param1", " !#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~"),
               new NameValuePair("param2", "some stuff")
             } );
           assertEquals("Simple /?param1=+%21%23%24%25%26%27%28%29*%2B%2C-.%2F%3A%3B%3C%3D%3E%3F%40%5B%5C%5D%5E_%60%7B%7C%7D%7E&param2=some+stuff
HTTP/1.1\r\n", 
  -        method.getTestRequestLine(conn));
  +                method.generateRequestLine(conn, HttpVersion.HTTP_1_1));
       }
   
       public void testRequestLinePath() throws Exception {
           HttpConnection conn = new HttpConnection("localhost", 80);
   
  -        SimpleHttpMethod method = new SimpleHttpMethod();
  +        FakeHttpMethod method = new FakeHttpMethod();
           method.setPath("/some%20stuff/");
           assertEquals("Simple /some%20stuff/ HTTP/1.1\r\n", 
  -        method.getTestRequestLine(conn));
  +                method.generateRequestLine(conn, HttpVersion.HTTP_1_1));
   
  -        method = new SimpleHttpMethod("/some%20stuff/");
  +        method = new FakeHttpMethod("/some%20stuff/");
           assertEquals("Simple /some%20stuff/ HTTP/1.1\r\n", 
  -        method.getTestRequestLine(conn));
  +                method.generateRequestLine(conn, HttpVersion.HTTP_1_1));
       }
   }
  
  
  
  1.16      +6 -6      jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestResponseHeaders.java
  
  Index: TestResponseHeaders.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestResponseHeaders.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- TestResponseHeaders.java	16 Oct 2004 22:40:08 -0000	1.15
  +++ TestResponseHeaders.java	31 Oct 2004 14:04:13 -0000	1.16
  @@ -373,7 +373,7 @@
                   return true;
               }
           });
  -		SimpleHttpMethod method = new SimpleHttpMethod();
  +        FakeHttpMethod method = new FakeHttpMethod();
           client.executeMethod(method);
   		assertTrue("Connection should be closed", 
                   method.shouldCloseConnection(connectionManager.getConection()));
  @@ -394,7 +394,7 @@
                   return true;
               }
           });
  -		SimpleHttpMethod method = new SimpleHttpMethod();
  +        FakeHttpMethod method = new FakeHttpMethod();
           client.executeMethod(method);
   		assertTrue("Connection should be closed", 
                   method.shouldCloseConnection(connectionManager.getConection()));
  
  
  
  1.19      +7 -7      jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestStreams.java
  
  Index: TestStreams.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestStreams.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- TestStreams.java	19 Sep 2004 19:07:21 -0000	1.18
  +++ TestStreams.java	31 Oct 2004 14:04:13 -0000	1.19
  @@ -55,7 +55,7 @@
       public void testChunkedInputStream() throws IOException {
           String correctInput = "10;key=\"value\r\nnewline\"\r\n1234567890123456\r\n5\r\n12345\r\n0\r\nFooter1:
abcde\r\nFooter2: fghij\r\n";
           String correctResult = "123456789012345612345";
  -        HttpMethod method = new SimpleHttpMethod();
  +        HttpMethod method = new FakeHttpMethod();
   
           //Test for when buffer is larger than chunk size
           InputStream in = new ChunkedInputStream(new ByteArrayInputStream(
  @@ -73,7 +73,7 @@
           footer = method.getResponseFooter("footer2");
           assertEquals(footer.getValue(), "fghij");
   
  -        method = new SimpleHttpMethod();
  +        method = new FakeHttpMethod();
   
           //Test for when buffer is smaller than chunk size.
           in = new ChunkedInputStream(new ByteArrayInputStream(
  @@ -94,7 +94,7 @@
       public void testCorruptChunkedInputStream1() throws IOException {
           //missing \r\n at the end of the first chunk
           String corrupInput = "10;key=\"value\"\r\n123456789012345\r\n5\r\n12345\r\n0\r\nFooter1:
abcde\r\nFooter2: fghij\r\n";
  -        HttpMethod method = new SimpleHttpMethod();
  +        HttpMethod method = new FakeHttpMethod();
   
           InputStream in = new ChunkedInputStream(new ByteArrayInputStream(
               EncodingUtil.getBytes(corrupInput, CONTENT_CHARSET)), method);
  @@ -113,7 +113,7 @@
   
       public void testEmptyChunkedInputStream() throws IOException {
           String input = "0\r\n";
  -        HttpMethod method = new SimpleHttpMethod();
  +        HttpMethod method = new FakeHttpMethod();
   
           InputStream in = new ChunkedInputStream(new ByteArrayInputStream(
               EncodingUtil.getBytes(input, CONTENT_CHARSET)), method);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message