Mercurial > stress-tester
changeset 498:4d25ddc19ecb
HttpSessionCookieFilterTest - resetting scopes
author | Devel 1 |
---|---|
date | Wed, 16 Aug 2017 09:33:45 +0200 |
parents | 874079c35460 |
children | 5588b03739b0 |
files | stress-tester/src/test/java/com/passus/st/client/http/filter/HttpSessionCookieFilterTest.java |
diffstat | 1 files changed, 13 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpSessionCookieFilterTest.java Wed Aug 16 09:30:29 2017 +0200 +++ b/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpSessionCookieFilterTest.java Wed Aug 16 09:33:45 2017 +0200 @@ -8,9 +8,8 @@ import com.passus.net.http.HttpResponseBuilder; import static com.passus.st.client.http.HttpConsts.TAG_SESSION_ID; import com.passus.st.client.http.HttpFlowContext; -import com.passus.st.client.http.HttpScopes; +import static com.passus.st.client.http.filter.HttpFilterTestUtils.createMockContext; import static com.passus.st.utils.TestHttpUtils.*; -import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import static org.testng.Assert.*; import org.testng.annotations.Test; @@ -24,12 +23,6 @@ private final String cookieName = "PHPSESSID"; private final HttpFlowContext fc = null; private final HttpMessageHelper mh = HttpMessageHelper.NOT_STRICT; - private final HttpFlowContext mockContext = mock(HttpFlowContext.class); - private final HttpScopes scopes = new HttpScopes(); - - { - when(mockContext.scopes()).thenReturn(scopes); - } private final String req1Obsolete = "GET /login HTTP/1.1\r\n" + "Host: 172.16.60.23\r\n" @@ -72,7 +65,7 @@ HttpResponse resp3 = HttpResponseBuilder.ok().build(); HttpSessionCookieFilter processor = new HttpSessionCookieFilter("PHPSESSID"); - scopes.clear(); + HttpFlowContext mockContext = createMockContext(); when(mockContext.origReponse()).thenReturn(resp1); processor.filterOutbound(req1, resp1, mockContext); @@ -104,7 +97,7 @@ HttpResponse resp3 = HttpResponseBuilder.ok().build(); HttpSessionCookieFilter processor = new HttpSessionCookieFilter("PHPSESSID"); - scopes.clear(); + HttpFlowContext mockContext = createMockContext(); when(mockContext.origReponse()).thenReturn(resp1); processor.filterOutbound(req1, resp1, fc); @@ -125,6 +118,7 @@ public void testFilter1() { /** * req: orig, origResp: -, resp: newSessId + * * req: newSessId */ @@ -143,7 +137,7 @@ HttpResponse origResp2 = HttpResponseBuilder.ok().build(); HttpSessionCookieFilter filter = new HttpSessionCookieFilter(); - scopes.clear(); + HttpFlowContext mockContext = createMockContext(); when(mockContext.origReponse()).thenReturn(origResp); filter.filterInbound(req, respLive, mockContext); @@ -157,6 +151,7 @@ public void testFilter2() { /** * req: orig, origResp: -, resp: - + * * req: orig */ @@ -172,7 +167,7 @@ HttpResponse origResp2 = HttpResponseBuilder.ok().build(); HttpSessionCookieFilter filter = new HttpSessionCookieFilter(); - scopes.clear(); + HttpFlowContext mockContext = createMockContext(); when(mockContext.origReponse()).thenReturn(origResp); filter.filterInbound(req, respLive, mockContext); @@ -186,6 +181,7 @@ public void testFilter3() { /** * req: -, origResp: -, resp: newSessId + * * req: - */ @@ -199,7 +195,7 @@ HttpResponse origResp2 = HttpResponseBuilder.ok().build(); HttpSessionCookieFilter filter = new HttpSessionCookieFilter(); - scopes.clear(); + HttpFlowContext mockContext = createMockContext(); when(mockContext.origReponse()).thenReturn(origResp); filter.filterInbound(req, respLive, mockContext); @@ -213,6 +209,7 @@ public void testFilter4() { /** * req: orig, resp: newSessId, origResp: origNew + * * req: newSessId (origNew) */ @@ -232,7 +229,7 @@ HttpResponse origResp2 = HttpResponseBuilder.ok().build(); HttpSessionCookieFilter filter = new HttpSessionCookieFilter(); - scopes.clear(); + HttpFlowContext mockContext = createMockContext(); when(mockContext.origReponse()).thenReturn(origResp); filter.filterInbound(req, respLive, mockContext); @@ -246,6 +243,7 @@ public void testFilter5() { /** * req: -, resp: newSessId, origResp: origNew + * * req: newSessId (origNew) */ @@ -264,7 +262,7 @@ HttpResponse origResp2 = HttpResponseBuilder.ok().build(); HttpSessionCookieFilter filter = new HttpSessionCookieFilter(); - scopes.clear(); + HttpFlowContext mockContext = createMockContext(); when(mockContext.origReponse()).thenReturn(origResp); filter.filterInbound(req, respLive, mockContext);