commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r399740 - /jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/test/org/apache/commons/httpclient/cookie/TestCookieVersionSupport.java
Date Thu, 04 May 2006 15:37:32 GMT
Author: olegk
Date: Thu May  4 08:37:31 2006
New Revision: 399740

URL: http://svn.apache.org/viewcvs?rev=399740&view=rev
Log:
Damn it

Modified:
    jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/test/org/apache/commons/httpclient/cookie/TestCookieVersionSupport.java

Modified: jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/test/org/apache/commons/httpclient/cookie/TestCookieVersionSupport.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/test/org/apache/commons/httpclient/cookie/TestCookieVersionSupport.java?rev=399740&r1=399739&r2=399740&view=diff
==============================================================================
--- jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/test/org/apache/commons/httpclient/cookie/TestCookieVersionSupport.java
(original)
+++ jakarta/commons/proper/httpclient/branches/COOKIE_2_BRANCH/src/test/org/apache/commons/httpclient/cookie/TestCookieVersionSupport.java
Thu May  4 08:37:31 2006
@@ -1,5 +1,5 @@
 /*
- * $HeaderURL$
+ * $HeadURL$
  * $Revision$
  * $Date$
  * ====================================================================
@@ -67,81 +67,81 @@
         return new TestSuite(TestCookieVersionSupport.class);
     }
 
-//    private static class CookieVer0Service implements HttpService {
-//
-//        public CookieVer0Service() {
-//            super();
-//        }
-//
-//        public boolean process(final SimpleRequest request, final SimpleResponse response)
-//            throws IOException
-//        {
-//            HttpVersion httpversion = request.getRequestLine().getHttpVersion();
-//            response.setStatusLine(httpversion, HttpStatus.SC_OK);
-//            response.addHeader(new Header("Set-Cookie", "name1=value1; path=/test"));
-//            response.setBodyString("whatever");
-//            return true;
-//        }
-//    }
-//    
-//    
-//    public void testCookieVersionSupportHeader1() throws IOException {
-//        this.server.setHttpService(new CookieVer0Service());
-//        this.client.getParams().setCookiePolicy(CookiePolicy.RFC_2965);
-//        GetMethod httpget1 = new GetMethod("/test/");
-//        try {
-//            this.client.executeMethod(httpget1);
-//        } finally {
-//            httpget1.releaseConnection();
-//        }
-//        GetMethod httpget2 = new GetMethod("/test/");
-//        try {
-//            this.client.executeMethod(httpget2);
-//        } finally {
-//            httpget2.releaseConnection();
-//        }
-//        Header cookiesupport = httpget2.getRequestHeader("Cookie2");
-//        assertNotNull(cookiesupport);
-//        assertEquals("$Version=\"1\"", cookiesupport.getValue());
-//    }
-//    
-//    private static class CookieVer1Service implements HttpService {
-//
-//        public CookieVer1Service() {
-//            super();
-//        }
-//
-//        public boolean process(final SimpleRequest request, final SimpleResponse response)
-//            throws IOException
-//        {
-//            HttpVersion httpversion = request.getRequestLine().getHttpVersion();
-//            response.setStatusLine(httpversion, HttpStatus.SC_OK);
-//            response.addHeader(new Header("Set-Cookie", "name1=value1; Path=\"/test\";
Version=\"1\""));
-//            response.addHeader(new Header("Set-Cookie2", "name2=value2; Path=\"/test\";
Version=\"1\""));
-//            response.setBodyString("whatever");
-//            return true;
-//        }
-//    }
-//    
-//    
-//    public void testCookieVersionSupportHeader2() throws IOException {
-//        this.server.setHttpService(new CookieVer1Service());
-//        this.client.getParams().setCookiePolicy(CookiePolicy.RFC_2965);
-//        GetMethod httpget1 = new GetMethod("/test/");
-//        try {
-//            this.client.executeMethod(httpget1);
-//        } finally {
-//            httpget1.releaseConnection();
-//        }
-//        GetMethod httpget2 = new GetMethod("/test/");
-//        try {
-//            this.client.executeMethod(httpget2);
-//        } finally {
-//            httpget2.releaseConnection();
-//        }
-//        Header cookiesupport = httpget2.getRequestHeader("Cookie2");
-//        assertNull(cookiesupport);
-//    }
+    private static class CookieVer0Service implements HttpService {
+
+        public CookieVer0Service() {
+            super();
+        }
+
+        public boolean process(final SimpleRequest request, final SimpleResponse response)
+            throws IOException
+        {
+            HttpVersion httpversion = request.getRequestLine().getHttpVersion();
+            response.setStatusLine(httpversion, HttpStatus.SC_OK);
+            response.addHeader(new Header("Set-Cookie", "name1=value1; path=/test"));
+            response.setBodyString("whatever");
+            return true;
+        }
+    }
+    
+    
+    public void testCookieVersionSupportHeader1() throws IOException {
+        this.server.setHttpService(new CookieVer0Service());
+        this.client.getParams().setCookiePolicy(CookiePolicy.RFC_2965);
+        GetMethod httpget1 = new GetMethod("/test/");
+        try {
+            this.client.executeMethod(httpget1);
+        } finally {
+            httpget1.releaseConnection();
+        }
+        GetMethod httpget2 = new GetMethod("/test/");
+        try {
+            this.client.executeMethod(httpget2);
+        } finally {
+            httpget2.releaseConnection();
+        }
+        Header cookiesupport = httpget2.getRequestHeader("Cookie2");
+        assertNotNull(cookiesupport);
+        assertEquals("$Version=\"1\"", cookiesupport.getValue());
+    }
+    
+    private static class CookieVer1Service implements HttpService {
+
+        public CookieVer1Service() {
+            super();
+        }
+
+        public boolean process(final SimpleRequest request, final SimpleResponse response)
+            throws IOException
+        {
+            HttpVersion httpversion = request.getRequestLine().getHttpVersion();
+            response.setStatusLine(httpversion, HttpStatus.SC_OK);
+            response.addHeader(new Header("Set-Cookie", "name1=value1; Path=\"/test\"; Version=\"1\""));
+            response.addHeader(new Header("Set-Cookie2", "name2=value2; Path=\"/test\"; Version=\"1\""));
+            response.setBodyString("whatever");
+            return true;
+        }
+    }
+    
+    
+    public void testCookieVersionSupportHeader2() throws IOException {
+        this.server.setHttpService(new CookieVer1Service());
+        this.client.getParams().setCookiePolicy(CookiePolicy.RFC_2965);
+        GetMethod httpget1 = new GetMethod("/test/");
+        try {
+            this.client.executeMethod(httpget1);
+        } finally {
+            httpget1.releaseConnection();
+        }
+        GetMethod httpget2 = new GetMethod("/test/");
+        try {
+            this.client.executeMethod(httpget2);
+        } finally {
+            httpget2.releaseConnection();
+        }
+        Header cookiesupport = httpget2.getRequestHeader("Cookie2");
+        assertNull(cookiesupport);
+    }
 
     private static class CookieVer2Service implements HttpService {
 



---------------------------------------------------------------------
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