Mercurial > stress-tester
changeset 451:e4ec98696716
HttpSessionCookieFilterTest.testFilter5
author | Devel 2 |
---|---|
date | Mon, 31 Jul 2017 15:07:55 +0200 |
parents | 3d993ed9ae3a |
children | 03d58388d5fb |
files | stress-tester/src/test/java/com/passus/st/client/http/filter/HttpSessionCookieFilterTest.java |
diffstat | 1 files changed, 34 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpSessionCookieFilterTest.java Mon Jul 31 15:07:28 2017 +0200 +++ b/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpSessionCookieFilterTest.java Mon Jul 31 15:07:55 2017 +0200 @@ -248,4 +248,38 @@ assertEquals(cookie.getValue().toString(), "newSessId"); } + @Test + public void testFilter5() { + /** + * req: + * resp: newSessId + * origResp: origNew + + * req: newSessId (origNew) + */ + + HttpRequest req = HttpRequestBuilder.get("http://test/test") + .build(); + HttpResponse origResp = HttpResponseBuilder.ok() + .cookie("JSESSIONID", "origNew") + .build(); + HttpResponse respLive = HttpResponseBuilder.ok() + .cookie("JSESSIONID", "newSessId") + .build(); + + HttpRequest req2 = HttpRequestBuilder.get("http://test/test") + .cookie("JSESSIONID", "origNew") + .build(); + HttpResponse origResp2 = HttpResponseBuilder.ok().build(); + + HttpSessionCookieFilter filter = new HttpSessionCookieFilter(); + + when(mockContext.origReponse()).thenReturn(origResp); + filter.filterInbound(req, respLive, mockContext); + filter.filterOutbound(req2, origResp2, mockContext); + + HttpCookie cookie = mh.getCookie(req2, "JSESSIONID"); + assertEquals(cookie.getValue().toString(), "newSessId"); + } + }