You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2017/02/07 12:27:59 UTC

svn commit: r1781997 - /jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestHC4CookieManager.java

Author: pmouawad
Date: Tue Feb  7 12:27:59 2017
New Revision: 1781997

URL: http://svn.apache.org/viewvc?rev=1781997&view=rev
Log:
Add tests 

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestHC4CookieManager.java

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestHC4CookieManager.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestHC4CookieManager.java?rev=1781997&r1=1781996&r2=1781997&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestHC4CookieManager.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestHC4CookieManager.java Tue Feb  7 12:27:59 2017
@@ -301,6 +301,27 @@ public class TestHC4CookieManager extend
             assertEquals("mySASession=s%3AcafPSGf6UJguyhddGFFeLdHBy9CYbzIS.NhYyA26LGTAVoLxhCQUK%2F2Bs34MW5kGHmErKzG6r3XI", s);
         }
 
+        // Test Secure cookie is parsed correctly and not transmitted for HTTP
+        @Test
+        public void testSecureCookieWithHttp() throws Exception {
+            URL url = new URL("http://a.b.c/");
+            man.addCookieFromHeader("mySASession=s%3AcafPSGf6UJguyhddGFFeLdHBy9CYbzIS.NhYyA26LGTAVoLxhCQUK%2F2Bs34MW5kGHmErKzG6r3XI; Path=/; Expires=Tue, 07 Feb 2990 09:13:14 GMT; HttpOnly; secure", url);
+            assertEquals(1,man.getCookieCount());
+            String s = man.getCookieHeaderForURL(url);
+            assertNull(s);
+        }
+
+        // Test Secure cookie is parsed correctly and transmitted for HTTPS
+        @Test
+        public void testSecureCookieWithHttps() throws Exception {
+            URL url = new URL("https://a.b.c/");
+            man.addCookieFromHeader("mySASession=s%3AcafPSGf6UJguyhddGFFeLdHBy9CYbzIS.NhYyA26LGTAVoLxhCQUK%2F2Bs34MW5kGHmErKzG6r3XI; Path=/; Expires=Tue, 07 Feb 2990 09:13:14 GMT; HttpOnly; secure", url);
+            assertEquals(1,man.getCookieCount());
+            String s = man.getCookieHeaderForURL(url);
+            assertNotNull(s);
+            assertEquals("mySASession=s%3AcafPSGf6UJguyhddGFFeLdHBy9CYbzIS.NhYyA26LGTAVoLxhCQUK%2F2Bs34MW5kGHmErKzG6r3XI", s);
+        }
+
         // Test multi-cookie header handling
         @Test
         public void testCookies1() throws Exception {