From 264b22498ea2fe3b68c6d3524dcddfe9320a6f8a Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Fri, 15 Jul 2011 14:57:38 -0500 Subject: [PATCH] Add in a bit more to this test so it checks that actual values make it across the server boundry --- .../session/AbstractLastAccessTimeTest.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLastAccessTimeTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLastAccessTimeTest.java index 2e8aa033e4c..7d979d37afe 100644 --- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLastAccessTimeTest.java +++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLastAccessTimeTest.java @@ -13,6 +13,7 @@ package org.eclipse.jetty.server.session; import java.io.IOException; +import java.io.PrintWriter; import java.util.Random; import javax.servlet.ServletException; @@ -67,6 +68,7 @@ public abstract class AbstractLastAccessTimeTest client.send(exchange1); exchange1.waitForDone(); assertEquals(HttpServletResponse.SC_OK, exchange1.getResponseStatus()); + assertEquals("test", exchange1.getResponseContent()); String sessionCookie = exchange1.getResponseFields().getStringField("Set-Cookie"); assertTrue( sessionCookie != null ); // Mangle the cookie, replacing Path with $Path, etc. @@ -87,6 +89,9 @@ public abstract class AbstractLastAccessTimeTest client.send(exchange2); exchange2.waitForDone(); assertEquals(HttpServletResponse.SC_OK , exchange2.getResponseStatus()); + System.out.println("test/" + exchange2.getResponseContent()); + assertEquals("test", exchange2.getResponseContent()); + String setCookie = exchange1.getResponseFields().getStringField("Set-Cookie"); if (setCookie!=null) sessionCookie = setCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path="); @@ -136,13 +141,37 @@ public abstract class AbstractLastAccessTimeTest { HttpSession session = request.getSession(true); session.setAttribute("test", "test"); + + sendResult(session, httpServletResponse.getWriter()); + } else { HttpSession session = request.getSession(false); + + sendResult(session, httpServletResponse.getWriter()); + if (session!=null) + { session.setAttribute("test", "test"); + } + + } } + + private void sendResult(HttpSession session, PrintWriter writer) + { + if (session != null) + { + System.out.println("Putting in : " + session.getAttribute("test")); + + writer.print(session.getAttribute("test")); + } + else + { + writer.print("null"); + } + } } }