changeset 497:874079c35460

HttpSessionCookieFilterTest - resetting scopes
author Devel 1
date Wed, 16 Aug 2017 09:30:29 +0200
parents edc36abb1445
children 4d25ddc19ecb
files stress-tester/src/test/java/com/passus/st/client/http/filter/HttpSessionCookieFilterTest.java
diffstat 1 files changed, 18 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpSessionCookieFilterTest.java	Wed Aug 16 09:13:27 2017 +0200
+++ b/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpSessionCookieFilterTest.java	Wed Aug 16 09:30:29 2017 +0200
@@ -72,6 +72,7 @@
         HttpResponse resp3 = HttpResponseBuilder.ok().build();
 
         HttpSessionCookieFilter processor = new HttpSessionCookieFilter("PHPSESSID");
+        scopes.clear();
 
         when(mockContext.origReponse()).thenReturn(resp1);
         processor.filterOutbound(req1, resp1, mockContext);
@@ -103,6 +104,7 @@
         HttpResponse resp3 = HttpResponseBuilder.ok().build();
 
         HttpSessionCookieFilter processor = new HttpSessionCookieFilter("PHPSESSID");
+        scopes.clear();
 
         when(mockContext.origReponse()).thenReturn(resp1);
         processor.filterOutbound(req1, resp1, fc);
@@ -122,10 +124,7 @@
     @Test
     public void testFilter1() {
         /**
-         * req: orig 
-         * origResp: 
-         * resp: newSessId
-         *
+         * req: orig, origResp: -, resp: newSessId
          * req: newSessId
          */
 
@@ -144,6 +143,7 @@
         HttpResponse origResp2 = HttpResponseBuilder.ok().build();
 
         HttpSessionCookieFilter filter = new HttpSessionCookieFilter();
+        scopes.clear();
 
         when(mockContext.origReponse()).thenReturn(origResp);
         filter.filterInbound(req, respLive, mockContext);
@@ -156,10 +156,7 @@
     @Test
     public void testFilter2() {
         /**
-         * req: orig 
-         * origResp: 
-         * resp:
-         *
+         * req: orig, origResp: -, resp: -
          * req: orig
          */
 
@@ -175,7 +172,8 @@
         HttpResponse origResp2 = HttpResponseBuilder.ok().build();
 
         HttpSessionCookieFilter filter = new HttpSessionCookieFilter();
-        
+        scopes.clear();
+
         when(mockContext.origReponse()).thenReturn(origResp);
         filter.filterInbound(req, respLive, mockContext);
         filter.filterOutbound(req2, origResp2, mockContext);
@@ -187,11 +185,8 @@
     @Test
     public void testFilter3() {
         /**
-         * req: 
-         * origResp: 
-         * resp: newSessId
-         *
-         * req: 
+         * req: -, origResp: -, resp: newSessId
+         * req: -
          */
 
         HttpRequest req = HttpRequestBuilder.get("http://test/test").build();
@@ -204,6 +199,7 @@
         HttpResponse origResp2 = HttpResponseBuilder.ok().build();
 
         HttpSessionCookieFilter filter = new HttpSessionCookieFilter();
+        scopes.clear();
 
         when(mockContext.origReponse()).thenReturn(origResp);
         filter.filterInbound(req, respLive, mockContext);
@@ -212,17 +208,14 @@
         HttpCookie cookie = mh.getCookie(req2, "JSESSIONID");
         assertNull(cookie);
     }
-    
+
     @Test
     public void testFilter4() {
         /**
-         * req: orig
-         * resp: newSessId
-         * origResp: origNew
-         * 
+         * req: orig, resp: newSessId, origResp: origNew
          * req: newSessId (origNew)
          */
-        
+
         HttpRequest req = HttpRequestBuilder.get("http://test/test")
                 .cookie("JSESSIONID", "orig")
                 .build();
@@ -239,6 +232,7 @@
         HttpResponse origResp2 = HttpResponseBuilder.ok().build();
 
         HttpSessionCookieFilter filter = new HttpSessionCookieFilter();
+        scopes.clear();
 
         when(mockContext.origReponse()).thenReturn(origResp);
         filter.filterInbound(req, respLive, mockContext);
@@ -251,13 +245,10 @@
     @Test
     public void testFilter5() {
         /**
-         * req: 
-         * resp: newSessId
-         * origResp: origNew
-
+         * req: -, resp: newSessId, origResp: origNew
          * req: newSessId (origNew)
          */
-        
+
         HttpRequest req = HttpRequestBuilder.get("http://test/test")
                 .build();
         HttpResponse origResp = HttpResponseBuilder.ok()
@@ -273,6 +264,7 @@
         HttpResponse origResp2 = HttpResponseBuilder.ok().build();
 
         HttpSessionCookieFilter filter = new HttpSessionCookieFilter();
+        scopes.clear();
 
         when(mockContext.origReponse()).thenReturn(origResp);
         filter.filterInbound(req, respLive, mockContext);
@@ -281,5 +273,5 @@
         HttpCookie cookie = mh.getCookie(req2, "JSESSIONID");
         assertEquals(cookie.getValue().toString(), "newSessId");
     }
-    
+
 }