hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r418574 - in /jakarta/httpcomponents/httpclient/trunk/src: java/org/apache/http/cookie/impl/ test/org/apache/http/cookie/impl/ test/org/apache/httpclient/impl/
Date Sun, 02 Jul 2006 11:10:24 GMT
Author: olegk
Date: Sun Jul  2 04:10:24 2006
New Revision: 418574

URL: http://svn.apache.org/viewvc?rev=418574&view=rev
Log:
[HTTPCORE-5] Made Header an interface

Modified:
    jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/BrowserCompatSpec.java
    jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/NetscapeDraftSpec.java
    jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/RFC2109Spec.java
    jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/impl/TestBrowserCompatSpec.java
    jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/impl/TestCookieNetscapeDraft.java
    jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/impl/TestCookieRFC2109Spec.java
    jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/httpclient/impl/TestDefaultResponseConsumedWatcher.java

Modified: jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/BrowserCompatSpec.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/BrowserCompatSpec.java?rev=418574&r1=418573&r2=418574&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/BrowserCompatSpec.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/BrowserCompatSpec.java
Sun Jul  2 04:10:24 2006
@@ -35,6 +35,7 @@
 import org.apache.http.cookie.CookieOrigin;
 import org.apache.http.cookie.MalformedCookieException;
 import org.apache.http.io.CharArrayBuffer;
+import org.apache.http.message.BasicHeader;
 import org.apache.http.util.DateParseException;
 import org.apache.http.util.DateUtils;
 
@@ -143,7 +144,7 @@
                 buffer.append(s);
             }
         }
-        return new Header[] { new Header("Cookie", buffer.toString()) };
+        return new Header[] { new BasicHeader("Cookie", buffer.toString()) };
     }
     
 }

Modified: jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/NetscapeDraftSpec.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/NetscapeDraftSpec.java?rev=418574&r1=418573&r2=418574&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/NetscapeDraftSpec.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/NetscapeDraftSpec.java
Sun Jul  2 04:10:24 2006
@@ -35,6 +35,7 @@
 import org.apache.http.cookie.CookieOrigin;
 import org.apache.http.cookie.MalformedCookieException;
 import org.apache.http.io.CharArrayBuffer;
+import org.apache.http.message.BasicHeader;
 
 /**
  * Netscape cookie draft compliant cookie policy
@@ -125,7 +126,7 @@
                 buffer.append(s);
             }
         }
-        return new Header[] { new Header("Cookie", buffer.toString()) };
+        return new Header[] { new BasicHeader("Cookie", buffer.toString()) };
     }
 
 }

Modified: jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/RFC2109Spec.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/RFC2109Spec.java?rev=418574&r1=418573&r2=418574&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/RFC2109Spec.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/RFC2109Spec.java
Sun Jul  2 04:10:24 2006
@@ -38,6 +38,7 @@
 import org.apache.http.cookie.CookiePathComparator;
 import org.apache.http.cookie.MalformedCookieException;
 import org.apache.http.io.CharArrayBuffer;
+import org.apache.http.message.BasicHeader;
 import org.apache.http.util.DateUtils;
 
 /**
@@ -151,7 +152,7 @@
             Cookie cookie = cookies[i];
             formatCookieAsVer(buffer, cookie, version);
         }
-        return new Header[] {new Header("Cookie", buffer.toString())};
+        return new Header[] {new BasicHeader("Cookie", buffer.toString())};
     }
 
     private Header[] doFormatManyHeaders(final Cookie[] cookies) {
@@ -163,7 +164,7 @@
             formatParamAsVer(buffer, "$Version", Integer.toString(version), version);
             buffer.append("; ");
             formatCookieAsVer(buffer, cookies[i], version);
-            headers[i] = new Header("Cookie", buffer.toString());
+            headers[i] = new BasicHeader("Cookie", buffer.toString());
         }
         return headers;
     }

Modified: jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/impl/TestBrowserCompatSpec.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/impl/TestBrowserCompatSpec.java?rev=418574&r1=418573&r2=418574&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/impl/TestBrowserCompatSpec.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/impl/TestBrowserCompatSpec.java
Sun Jul  2 04:10:24 2006
@@ -35,6 +35,7 @@
 import org.apache.http.cookie.CookieOrigin;
 import org.apache.http.cookie.CookieSpec;
 import org.apache.http.cookie.MalformedCookieException;
+import org.apache.http.message.BasicHeader;
 import org.apache.http.util.DateUtils;
 
 import junit.framework.Test;
@@ -76,7 +77,7 @@
      * Tests whether domain attribute check is case-insensitive.
      */
     public void testDomainCaseInsensitivity() throws Exception {
-        Header header = new Header("Set-Cookie", 
+        Header header = new BasicHeader("Set-Cookie", 
             "name=value; path=/; domain=.whatever.com");
 
         CookieSpec cookiespec = new BrowserCompatSpec();
@@ -97,7 +98,7 @@
         String headerValue = "custno = 12345; comment=test; version=1," +
             " name=John; version=1; max-age=600; secure; domain=.apache.org";
 
-        Header header = new Header("set-cookie", headerValue);
+        Header header = new BasicHeader("set-cookie", headerValue);
 
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("www.apache.org", 80, "/", false);
@@ -131,7 +132,7 @@
         String headerValue = "custno=12345;comment=test; version=1," +
             "name=John;version=1;max-age=600;secure;domain=.apache.org";
 
-        Header header = new Header("set-cookie", headerValue);
+        Header header = new BasicHeader("set-cookie", headerValue);
 
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("www.apache.org", 80, "/", false);
@@ -166,7 +167,7 @@
     public void testParse3() throws Exception {
         String headerValue =
             "name=\"Doe, John\";version=1;max-age=600;secure;domain=.apache.org";
-        Header header = new Header("set-cookie", headerValue);
+        Header header = new BasicHeader("set-cookie", headerValue);
 
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("www.apache.org", 80, "/", false);
@@ -191,7 +192,7 @@
     public void testQuotedExpiresAttribute() throws Exception {
         String headerValue = "custno=12345;Expires='Thu, 01-Jan-2070 00:00:10 GMT'";
 
-        Header header = new Header("set-cookie", headerValue);
+        Header header = new BasicHeader("set-cookie", headerValue);
 
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("www.apache.org", 80, "/", true);
@@ -207,7 +208,7 @@
     public void testSecurityError() throws Exception {
         String headerValue = "custno=12345;comment=test; version=1," +
             "name=John;version=1;max-age=600;secure;domain=jakarta.apache.org";
-        Header header = new Header("set-cookie", headerValue);
+        Header header = new BasicHeader("set-cookie", headerValue);
 
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("www.apache.org", 80, "/", true);
@@ -223,7 +224,7 @@
     }
 
     public void testParseSimple() throws Exception {
-        Header header = new Header("Set-Cookie","cookie-name=cookie-value");
+        Header header = new BasicHeader("Set-Cookie","cookie-name=cookie-value");
         
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("127.0.0.1", 80, "/path/path", false);
@@ -245,7 +246,7 @@
     }
  
     public void testParseSimple2() throws Exception {
-        Header header = new Header("Set-Cookie", "cookie-name=cookie-value");
+        Header header = new BasicHeader("Set-Cookie", "cookie-name=cookie-value");
     
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("127.0.0.1", 80, "/path", false);
@@ -267,7 +268,7 @@
     }
  
     public void testParseNoName() throws Exception {
-        Header header = new Header("Set-Cookie","=stuff; path=/");
+        Header header = new BasicHeader("Set-Cookie","=stuff; path=/");
 
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("127.0.0.1", 80, "/", false);
@@ -283,7 +284,7 @@
     }
  
     public void testParseNoValue() throws Exception {
-        Header header = new Header("Set-Cookie","cookie-name=");
+        Header header = new BasicHeader("Set-Cookie","cookie-name=");
 
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("127.0.0.1", 80, "/", false);
@@ -305,7 +306,7 @@
     }
 
     public void testParseWithWhiteSpace() throws Exception {
-        Header header = new Header("Set-Cookie"," cookie-name  =    cookie-value  ");
+        Header header = new BasicHeader("Set-Cookie"," cookie-name  =    cookie-value  ");
 
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("127.0.0.1", 80, "/", false);
@@ -324,7 +325,7 @@
     }
 
     public void testParseWithQuotes() throws Exception {
-        Header header = new Header("Set-Cookie"," cookie-name  =  \" cookie-value \" ;path=/");
+        Header header = new BasicHeader("Set-Cookie"," cookie-name  =  \" cookie-value \"
;path=/");
 
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("127.0.0.1",80, "/", false);
@@ -343,7 +344,7 @@
     }
 
     public void testParseWithPath() throws Exception {
-        Header header = new Header("Set-Cookie","cookie-name=cookie-value; Path=/path/");
+        Header header = new BasicHeader("Set-Cookie","cookie-name=cookie-value; Path=/path/");
 
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("127.0.0.1", 80, "/path/path", false);
@@ -362,7 +363,7 @@
     }
 
     public void testParseWithDomain() throws Exception {
-        Header header = new Header("Set-Cookie","cookie-name=cookie-value; Domain=127.0.0.1");
+        Header header = new BasicHeader("Set-Cookie","cookie-name=cookie-value; Domain=127.0.0.1");
 
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("127.0.0.1", 80, "/", false);
@@ -381,7 +382,7 @@
     }
 
     public void testParseWithSecure() throws Exception {
-        Header header = new Header("Set-Cookie","cookie-name=cookie-value; secure");
+        Header header = new BasicHeader("Set-Cookie","cookie-name=cookie-value; secure");
 
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("127.0.0.1", 80, "/", true);
@@ -400,7 +401,7 @@
     }
 
     public void testParseWithComment() throws Exception {
-        Header header = new Header("Set-Cookie",
+        Header header = new BasicHeader("Set-Cookie",
             "cookie-name=cookie-value; comment=\"This is a comment.\"");
 
         CookieSpec cookiespec = new BrowserCompatSpec();
@@ -420,7 +421,7 @@
     }
 
     public void testParseWithExpires() throws Exception {
-        Header header = new Header("Set-Cookie",
+        Header header = new BasicHeader("Set-Cookie",
             "cookie-name=cookie-value;Expires=Thu, 01-Jan-1970 00:00:10 GMT");
 
         CookieSpec cookiespec = new BrowserCompatSpec();
@@ -440,7 +441,7 @@
     }
 
     public void testParseWithAll() throws Exception {
-        Header header = new Header("Set-Cookie",
+        Header header = new BasicHeader("Set-Cookie",
             "cookie-name=cookie-value;Version=1;Path=/commons;Domain=.apache.org;" + 
             "Comment=This is a comment.;secure;Expires=Thu, 01-Jan-1970 00:00:10 GMT");
 
@@ -462,7 +463,7 @@
     }
 
     public void testParseMultipleDifferentPaths() throws Exception {
-        Header header = new Header("Set-Cookie",
+        Header header = new BasicHeader("Set-Cookie",
             "name1=value1;Version=1;Path=/commons,name1=value2;Version=1;" +
             "Path=/commons/httpclient;Version=1");
 
@@ -480,7 +481,7 @@
     }
 
     public void testParseRelativePath() throws Exception {
-        Header header = new Header("Set-Cookie", "name1=value1;Path=whatever");
+        Header header = new BasicHeader("Set-Cookie", "name1=value1;Path=whatever");
 
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("www.apache.org", 80, "whatever", true);
@@ -495,7 +496,7 @@
     }
 
     public void testParseWithWrongDomain() throws Exception {
-        Header header = new Header("Set-Cookie",
+        Header header = new BasicHeader("Set-Cookie",
             "cookie-name=cookie-value; domain=127.0.0.1; version=1");
 
         CookieSpec cookiespec = new BrowserCompatSpec();
@@ -512,7 +513,7 @@
     }
 
     public void testParseWithPathMismatch() throws Exception {
-        Header header = new Header("Set-Cookie",
+        Header header = new BasicHeader("Set-Cookie",
             "cookie-name=cookie-value; path=/path/path/path");
 
         CookieSpec cookiespec = new BrowserCompatSpec();
@@ -529,7 +530,7 @@
     }
     
     public void testParseWithPathMismatch2() throws Exception {
-        Header header = new Header("Set-Cookie",
+        Header header = new BasicHeader("Set-Cookie",
             "cookie-name=cookie-value; path=/foobar");
 
         CookieSpec cookiespec = new BrowserCompatSpec();
@@ -549,7 +550,7 @@
      * Tests if cookie constructor rejects cookie name containing blanks.
      */
     public void testCookieNameWithBlanks() throws Exception {
-        Header header = new Header("Set-Cookie", "invalid name=");
+        Header header = new BasicHeader("Set-Cookie", "invalid name=");
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("127.0.0.1", 80, "/", false);
         Cookie[] parsed = cookiespec.parse(header, origin);
@@ -564,7 +565,7 @@
      * Tests if cookie constructor rejects cookie name containing blanks.
      */
     public void testCookieNameBlank() throws Exception {
-        Header header = new Header("Set-Cookie", "=stuff");
+        Header header = new BasicHeader("Set-Cookie", "=stuff");
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("127.0.0.1", 80, "/", false);
         try {
@@ -581,7 +582,7 @@
      * Tests if cookie constructor rejects cookie name starting with $.
      */
     public void testCookieNameStartingWithDollarSign() throws Exception {
-        Header header = new Header("Set-Cookie", "$invalid_name=");
+        Header header = new BasicHeader("Set-Cookie", "$invalid_name=");
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("127.0.0.1", 80, "/", false);
         Cookie[] parsed = cookiespec.parse(header, origin);
@@ -597,7 +598,7 @@
      * Tests if malformatted expires attribute is parsed correctly.
      */
     public void testCookieWithComma() throws Exception {
-        Header header = new Header("Set-Cookie", "name=value; expires=\"Thu, 01-Jan-1970
00:00:00 GMT");
+        Header header = new BasicHeader("Set-Cookie", "name=value; expires=\"Thu, 01-Jan-1970
00:00:00 GMT");
 
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("localhost", 80, "/", false);
@@ -641,7 +642,7 @@
     }
 
     private void checkDate(String date) throws Exception {
-        Header header = new Header("Set-Cookie", "custno=12345;Expires='"+date+"';");
+        Header header = new BasicHeader("Set-Cookie", "custno=12345;Expires='"+date+"';");
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("localhost", 80, "/", false);
         Cookie[] parsed = cookiespec.parse(header, origin);
@@ -859,7 +860,7 @@
      * Tests generic cookie formatting.
      */
     public void testGenericCookieFormatting() throws Exception {
-        Header header = new Header("Set-Cookie", 
+        Header header = new BasicHeader("Set-Cookie", 
             "name=value; path=/; domain=.mydomain.com");
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("myhost.mydomain.com", 80, "/", false); 
@@ -892,7 +893,7 @@
      * Tests generic cookie formatting.
      */
     public void testFormatSeveralCookies() throws Exception {
-        Header header = new Header("Set-Cookie", 
+        Header header = new BasicHeader("Set-Cookie", 
             "name1=value1; path=/; domain=.mydomain.com, name2 = value2 ; path=/; domain=.mydomain.com");
         CookieSpec cookiespec = new BrowserCompatSpec();
         CookieOrigin origin = new CookieOrigin("myhost.mydomain.com", 80, "/", false); 
@@ -918,7 +919,7 @@
             // expected
         }
         try {
-            cookiespec.parse(new Header("Set-Cookie", "name=value"), null);
+            cookiespec.parse(new BasicHeader("Set-Cookie", "name=value"), null);
             fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected

Modified: jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/impl/TestCookieNetscapeDraft.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/impl/TestCookieNetscapeDraft.java?rev=418574&r1=418573&r2=418574&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/impl/TestCookieNetscapeDraft.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/impl/TestCookieNetscapeDraft.java
Sun Jul  2 04:10:24 2006
@@ -33,6 +33,7 @@
 import org.apache.http.cookie.CookieOrigin;
 import org.apache.http.cookie.CookieSpec;
 import org.apache.http.cookie.MalformedCookieException;
+import org.apache.http.message.BasicHeader;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -60,7 +61,7 @@
     }
 
     public void testParseAbsPath() throws Exception {
-        Header header = new Header("Set-Cookie", "name1=value1;Path=/path/");
+        Header header = new BasicHeader("Set-Cookie", "name1=value1;Path=/path/");
 
         CookieSpec cookiespec = new NetscapeDraftSpec();
         CookieOrigin origin = new CookieOrigin("host", 80, "/path/", true);
@@ -76,7 +77,7 @@
     }
 
     public void testParseAbsPath2() throws Exception {
-        Header header = new Header("Set-Cookie", "name1=value1;Path=/");
+        Header header = new BasicHeader("Set-Cookie", "name1=value1;Path=/");
 
         CookieSpec cookiespec = new NetscapeDraftSpec();
         CookieOrigin origin = new CookieOrigin("host", 80, "/", true);
@@ -92,7 +93,7 @@
     }
 
     public void testParseRelativePath() throws Exception {
-        Header header = new Header("Set-Cookie", "name1=value1;Path=whatever");
+        Header header = new BasicHeader("Set-Cookie", "name1=value1;Path=whatever");
 
         CookieSpec cookiespec = new NetscapeDraftSpec();
         CookieOrigin origin = new CookieOrigin("host", 80, "whatever", true);
@@ -108,7 +109,7 @@
     }
 
     public void testParseWithIllegalNetscapeDomain1() throws Exception {
-        Header header = new Header("Set-Cookie","cookie-name=cookie-value; domain=.com");
+        Header header = new BasicHeader("Set-Cookie","cookie-name=cookie-value; domain=.com");
 
         CookieSpec cookiespec = new NetscapeDraftSpec();
         try {
@@ -124,7 +125,7 @@
     }
 
     public void testParseWithWrongNetscapeDomain2() throws Exception {
-        Header header = new Header("Set-Cookie","cookie-name=cookie-value; domain=.y.z");
+        Header header = new BasicHeader("Set-Cookie","cookie-name=cookie-value; domain=.y.z");
         
         CookieSpec cookiespec = new NetscapeDraftSpec();
         try {
@@ -143,7 +144,7 @@
      * Tests Netscape specific cookie formatting.
      */
     public void testNetscapeCookieFormatting() throws Exception {
-        Header header = new Header(
+        Header header = new BasicHeader(
           "Set-Cookie", "name=value; path=/; domain=.mydomain.com");
         CookieSpec cookiespec = new NetscapeDraftSpec();
         CookieOrigin origin = new CookieOrigin("myhost.mydomain.com", 80, "/", false);
@@ -159,12 +160,12 @@
      */
     public void testNetscapeCookieExpireAttribute() throws Exception {
         CookieSpec cookiespec = new NetscapeDraftSpec();
-        Header header = new Header("Set-Cookie", 
+        Header header = new BasicHeader("Set-Cookie", 
             "name=value; path=/; domain=.mydomain.com; expires=Thu, 01-Jan-2070 00:00:10
GMT; comment=no_comment");
         CookieOrigin origin = new CookieOrigin("myhost.mydomain.com", 80, "/", false);
         Cookie[] cookies = cookiespec.parse(header, origin);
         cookiespec.validate(cookies[0], origin);
-        header = new Header("Set-Cookie", 
+        header = new BasicHeader("Set-Cookie", 
             "name=value; path=/; domain=.mydomain.com; expires=Thu 01-Jan-2070 00:00:10 GMT;
comment=no_comment");
         try {
             cookies = cookiespec.parse(header, origin);
@@ -180,7 +181,7 @@
      */
     public void testNetscapeCookieExpireAttributeNoTimeZone() throws Exception {
         CookieSpec cookiespec = new NetscapeDraftSpec();
-        Header header = new Header("Set-Cookie", 
+        Header header = new BasicHeader("Set-Cookie", 
             "name=value; expires=Thu, 01-Jan-2006 00:00:00 ");
         CookieOrigin origin = new CookieOrigin("myhost.mydomain.com", 80, "/", false);
         try {
@@ -195,7 +196,7 @@
      * Tests if cookie values with embedded comma are handled correctly.
      */
     public void testCookieWithComma() throws Exception {
-        Header header = new Header("Set-Cookie", "a=b,c");
+        Header header = new BasicHeader("Set-Cookie", "a=b,c");
 
         CookieSpec cookiespec = new NetscapeDraftSpec();
         CookieOrigin origin = new CookieOrigin("localhost", 80, "/", false);
@@ -231,7 +232,7 @@
             // expected
         }
         try {
-            cookiespec.parse(new Header("Set-Cookie", "name=value"), null);
+            cookiespec.parse(new BasicHeader("Set-Cookie", "name=value"), null);
             fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected

Modified: jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/impl/TestCookieRFC2109Spec.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/impl/TestCookieRFC2109Spec.java?rev=418574&r1=418573&r2=418574&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/impl/TestCookieRFC2109Spec.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/http/cookie/impl/TestCookieRFC2109Spec.java
Sun Jul  2 04:10:24 2006
@@ -33,6 +33,7 @@
 import org.apache.http.cookie.CookieOrigin;
 import org.apache.http.cookie.CookieSpec;
 import org.apache.http.cookie.MalformedCookieException;
+import org.apache.http.message.BasicHeader;
 import org.apache.http.util.DateUtils;
 
 import junit.framework.Test;
@@ -68,7 +69,7 @@
     }
     
     public void testParseVersion() throws Exception {
-        Header header = new Header("Set-Cookie","cookie-name=cookie-value; version=1");
+        Header header = new BasicHeader("Set-Cookie","cookie-name=cookie-value; version=1");
 
         CookieSpec cookiespec = new RFC2109Spec();
         CookieOrigin origin = new CookieOrigin("127.0.0.1", 80, "/", false);
@@ -86,7 +87,7 @@
      * Test domain equals host 
      */
     public void testParseDomainEqualsHost() throws Exception {
-        Header header = new Header("Set-Cookie",
+        Header header = new BasicHeader("Set-Cookie",
             "cookie-name=cookie-value; domain=www.b.com; version=1");
 
         CookieSpec cookiespec = new RFC2109Spec();
@@ -104,7 +105,7 @@
      * Domain does not start with a dot
      */
     public void testParseWithIllegalDomain1() throws Exception {
-        Header header = new Header("Set-Cookie",
+        Header header = new BasicHeader("Set-Cookie",
             "cookie-name=cookie-value; domain=a.b.com; version=1");
 
         CookieSpec cookiespec = new RFC2109Spec();
@@ -124,7 +125,7 @@
      * Domain must have alt least one embedded dot
      */
     public void testParseWithIllegalDomain2() throws Exception {
-        Header header = new Header("Set-Cookie",
+        Header header = new BasicHeader("Set-Cookie",
             "cookie-name=cookie-value; domain=.com; version=1");
 
         CookieSpec cookiespec = new RFC2109Spec();
@@ -144,7 +145,7 @@
      * Host minus domain may not contain any dots
      */
     public void testParseWithIllegalDomain4() throws Exception {
-        Header header = new Header("Set-Cookie",
+        Header header = new BasicHeader("Set-Cookie",
             "cookie-name=cookie-value; domain=.c.com; version=1");
 
         CookieSpec cookiespec = new RFC2109Spec();
@@ -195,7 +196,7 @@
     }
     
     public void testParseWithWrongPath() throws Exception {
-        Header header = new Header("Set-Cookie",
+        Header header = new BasicHeader("Set-Cookie",
             "cookie-name=cookie-value; domain=127.0.0.1; path=/not/just/root");
 
         CookieSpec cookiespec = new RFC2109Spec();
@@ -215,7 +216,7 @@
      * Tests if cookie constructor rejects cookie name containing blanks.
      */
     public void testCookieNameWithBlanks() throws Exception {
-        Header setcookie = new Header("Set-Cookie", "invalid name=");
+        Header setcookie = new BasicHeader("Set-Cookie", "invalid name=");
         CookieSpec cookiespec = new RFC2109Spec();
         CookieOrigin origin = new CookieOrigin("127.0.0.1", 80, "/", false);
         try {
@@ -233,7 +234,7 @@
      * Tests if cookie constructor rejects cookie name starting with $.
      */
     public void testCookieNameStartingWithDollarSign() throws Exception {
-        Header setcookie = new Header("Set-Cookie", "$invalid_name=");
+        Header setcookie = new BasicHeader("Set-Cookie", "$invalid_name=");
         CookieSpec cookiespec = new RFC2109Spec();
         CookieOrigin origin = new CookieOrigin("127.0.0.1", 80, "/", false);
         try {
@@ -253,7 +254,7 @@
      */
     public void testInvalidDomainWithSimpleHostName() throws Exception {    
         CookieSpec cookiespec = new RFC2109Spec();
-        Header header = new Header("Set-Cookie", 
+        Header header = new BasicHeader("Set-Cookie", 
             "name=\"value\"; version=\"1\"; path=\"/\"; domain=\".mydomain.com\"");
         CookieOrigin origin1 = new CookieOrigin("host", 80, "/", false);
         Cookie[]cookies = cookiespec.parse(header, origin1);
@@ -264,7 +265,7 @@
         catch(MalformedCookieException expected) {
         }
         CookieOrigin origin2 = new CookieOrigin("host2", 80, "/", false);
-        header = new Header("Set-Cookie", 
+        header = new BasicHeader("Set-Cookie", 
             "name=\"value\"; version=\"1\"; path=\"/\"; domain=\"host1\"");
         cookies = cookiespec.parse(header, origin2);
         try {
@@ -279,7 +280,7 @@
      * Tests if cookie values with embedded comma are handled correctly.
      */
     public void testCookieWithComma() throws Exception {
-        Header header = new Header("Set-Cookie", "a=b,c");
+        Header header = new BasicHeader("Set-Cookie", "a=b,c");
 
         CookieSpec cookiespec = new RFC2109Spec();
         CookieOrigin origin = new CookieOrigin("localhost", 80, "/", false);
@@ -296,7 +297,7 @@
      */
     public void testRFC2109CookieFormatting() throws Exception {
         CookieSpec cookiespec = new RFC2109Spec(null, false);
-        Header header = new Header("Set-Cookie", 
+        Header header = new BasicHeader("Set-Cookie", 
             "name=\"value\"; version=\"1\"; path=\"/\"; domain=\".mydomain.com\"");
         CookieOrigin origin = new CookieOrigin("myhost.mydomain.com", 80, "/", false);
         Cookie[] cookies  = cookiespec.parse(header, origin);
@@ -307,7 +308,7 @@
         assertEquals("$Version=\"1\"; name=\"value\"; $Path=\"/\"; $Domain=\".mydomain.com\"",

                 headers[0].getValue());
 
-        header = new Header( "Set-Cookie", 
+        header = new BasicHeader( "Set-Cookie", 
             "name=value; path=/; domain=.mydomain.com");
         cookies = cookiespec.parse(header, origin);
         cookiespec.validate(cookies[0], origin);
@@ -320,7 +321,7 @@
 
     public void testRFC2109CookiesFormatting() throws Exception {
         CookieSpec cookiespec = new RFC2109Spec(null, true);
-        Header header = new Header("Set-Cookie", 
+        Header header = new BasicHeader("Set-Cookie", 
             "name1=value1; path=/; domain=.mydomain.com, " + 
             "name2=\"value2\"; version=\"1\"; path=\"/\"; domain=\".mydomain.com\"");
         CookieOrigin origin = new CookieOrigin("myhost.mydomain.com", 80, "/", false);
@@ -338,7 +339,7 @@
             "name2=value2; $Path=/; $Domain=.mydomain.com",
             headers[0].getValue());
 
-        header = new Header("Set-Cookie", 
+        header = new BasicHeader("Set-Cookie", 
             "name1=value1; version=1; path=/; domain=.mydomain.com, " + 
             "name2=\"value2\"; version=\"1\"; path=\"/\"; domain=\".mydomain.com\"");
         cookies = cookiespec.parse(header, origin);
@@ -432,7 +433,7 @@
             // expected
         }
         try {
-            cookiespec.parse(new Header("Set-Cookie", "name=value"), null);
+            cookiespec.parse(new BasicHeader("Set-Cookie", "name=value"), null);
             fail("IllegalArgumentException must have been thrown");
         } catch (IllegalArgumentException ex) {
             // expected

Modified: jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/httpclient/impl/TestDefaultResponseConsumedWatcher.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/httpclient/impl/TestDefaultResponseConsumedWatcher.java?rev=418574&r1=418573&r2=418574&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/httpclient/impl/TestDefaultResponseConsumedWatcher.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/src/test/org/apache/httpclient/impl/TestDefaultResponseConsumedWatcher.java
Sun Jul  2 04:10:24 2006
@@ -31,7 +31,6 @@
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 
-import org.apache.http.Header;
 import org.apache.http.HttpConnection;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpVersion;
@@ -89,7 +88,7 @@
         
         StatusLine statusline = new StatusLine(HttpVersion.HTTP_1_0, 200, "OK");
         HttpResponse response = new BasicHttpResponse(statusline);
-        response.setHeader(new Header("Connection", "Close"));
+        response.addHeader("Connection", "Close");
         response.setParams(new DefaultHttpParams(null));
         response.setEntity(entity);
         
@@ -111,7 +110,7 @@
         
         StatusLine statusline = new StatusLine(HttpVersion.HTTP_1_1, 200, "OK");
         HttpResponse response = new BasicHttpResponse(statusline);
-        response.setHeader(new Header("Connection", "Keep-alive"));
+        response.addHeader("Connection", "Keep-alive");
         response.setParams(new DefaultHttpParams(null));
         response.setEntity(entity);
         



Mime
View raw message