Merge remote-tracking branch 'origin/jetty-9.4.x'
This commit is contained in:
commit
a4bc251bb0
|
@ -114,8 +114,6 @@ public class ReloadedSessionMissingClassTest
|
|||
assertTrue(sessionCookie != null);
|
||||
String sessionId = (String)webApp.getServletContext().getAttribute("foo");
|
||||
assertNotNull(sessionId);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
//Stop the webapp
|
||||
webApp.stop();
|
||||
|
@ -126,7 +124,6 @@ public class ReloadedSessionMissingClassTest
|
|||
webApp.start();
|
||||
|
||||
Request request = client.newRequest("http://localhost:" + port1 + contextPath + "/bar?action=get");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
|
||||
|
|
|
@ -83,8 +83,6 @@ public class CachingSessionDataStoreTest
|
|||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
String sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
String id = TestServer.extractSessionId(sessionCookie);
|
||||
|
||||
//check that the memcache contains the session, and the session data store contains the session
|
||||
|
@ -102,7 +100,6 @@ public class CachingSessionDataStoreTest
|
|||
//
|
||||
((MockDataStore)persistentStore).zeroLoadCount();
|
||||
Request request = client.newRequest("http://localhost:" + port + contextPath + servletMapping + "?action=update");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
assertEquals(0, ((MockDataStore)persistentStore).getLoadCount());
|
||||
|
|
|
@ -104,13 +104,11 @@ public abstract class AbstractClusteredInvalidationSessionTest extends AbstractT
|
|||
|
||||
// Invalidate on node1
|
||||
Request request1 = client.newRequest(urls[0] + "?action=invalidate");
|
||||
request1.header("Cookie", sessionCookie);
|
||||
response1 = request1.send();
|
||||
assertEquals(HttpServletResponse.SC_OK, response1.getStatus());
|
||||
|
||||
// Be sure on node2 we don't see the session anymore
|
||||
request2 = client.newRequest(urls[1] + "?action=test");
|
||||
request2.header("Cookie", sessionCookie);
|
||||
response2 = request2.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response2.getStatus());
|
||||
}
|
||||
|
|
|
@ -117,8 +117,6 @@ public abstract class AbstractClusteredSessionScavengingTest extends AbstractTes
|
|||
assertEquals(HttpServletResponse.SC_OK,response1.getStatus());
|
||||
String sessionCookie = response1.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
SessionHandler m1 = context1.getSessionHandler();
|
||||
assertEquals(1, m1.getSessionsCreated());
|
||||
|
||||
|
@ -212,7 +210,6 @@ public abstract class AbstractClusteredSessionScavengingTest extends AbstractTes
|
|||
|
||||
// Check that node1 does not have any local session cached
|
||||
request = client.newRequest(urls[0] + "?action=check");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response1 = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response1.getStatus());
|
||||
|
||||
|
@ -224,7 +221,6 @@ public abstract class AbstractClusteredSessionScavengingTest extends AbstractTes
|
|||
|
||||
// Check that node2 does not have any local session cached
|
||||
request = client.newRequest(urls[1] + "?action=check");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response2 = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response2.getStatus());
|
||||
}
|
||||
|
|
|
@ -81,18 +81,14 @@ public abstract class AbstractModifyMaxInactiveIntervalTest extends AbstractTest
|
|||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
String sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
//do another request to reduce the maxinactive interval
|
||||
Request request = client.newRequest("http://localhost:" + port + "/mod/test?action=change&val="+newMaxInactive+"&wait="+sleep);
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
|
||||
//do another request using the cookie to ensure the session is still there
|
||||
request= client.newRequest("http://localhost:" + port + "/mod/test?action=test&val="+newMaxInactive);
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
|
||||
|
@ -140,18 +136,14 @@ public abstract class AbstractModifyMaxInactiveIntervalTest extends AbstractTest
|
|||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
String sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
//do another request to increase the maxinactive interval, first waiting until the old expiration should have passed
|
||||
Request request = client.newRequest("http://localhost:" + port + "/mod/test?action=change&val="+newMaxInactive+"&wait="+sleep);
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
|
||||
//do another request using the cookie to ensure the session is still there
|
||||
request= client.newRequest("http://localhost:" + port + "/mod/test?action=test&val="+newMaxInactive);
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
|
||||
|
@ -199,18 +191,14 @@ public abstract class AbstractModifyMaxInactiveIntervalTest extends AbstractTest
|
|||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
String sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
//do another request to reduce the maxinactive interval
|
||||
Request request = client.newRequest("http://localhost:" + port + "/mod/test?action=change&val="+newMaxInactive+"&wait="+sleep);
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
|
||||
//do another request using the cookie to ensure the session is still there
|
||||
request= client.newRequest("http://localhost:" + port + "/mod/test?action=test&val="+newMaxInactive);
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
|
||||
|
@ -258,18 +246,14 @@ public abstract class AbstractModifyMaxInactiveIntervalTest extends AbstractTest
|
|||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
String sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
//do another request to reduce the maxinactive interval
|
||||
Request request = client.newRequest("http://localhost:" + port + "/mod/test?action=change&val="+newMaxInactive+"&wait="+sleep);
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
|
||||
//do another request using the cookie to ensure the session is still there
|
||||
request= client.newRequest("http://localhost:" + port + "/mod/test?action=test&val="+newMaxInactive);
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
|
||||
|
@ -314,18 +298,14 @@ public abstract class AbstractModifyMaxInactiveIntervalTest extends AbstractTest
|
|||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
String sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
//do another request to change the maxinactive interval
|
||||
Request request = client.newRequest("http://localhost:" + port + "/mod/test?action=change&val="+newMaxInactive+"&wait="+2);
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
|
||||
//do another request using the cookie to ensure the session is still there
|
||||
request= client.newRequest("http://localhost:" + port + "/mod/test?action=test&val="+newMaxInactive);
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
|
||||
|
@ -372,13 +352,10 @@ public abstract class AbstractModifyMaxInactiveIntervalTest extends AbstractTest
|
|||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
String sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
//do another request that will sleep long enough for the session expiry time to have passed
|
||||
//before trying to access the session and ensure it is still there
|
||||
Request request = client.newRequest("http://localhost:" + port + "/mod/test?action=sleep&val="+sleep);
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
|
@ -426,12 +403,9 @@ public abstract class AbstractModifyMaxInactiveIntervalTest extends AbstractTest
|
|||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
String sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
//do another request to change the maxinactive interval
|
||||
Request request = client.newRequest("http://localhost:" + port + "/mod/test?action=change&val="+newMaxInactive);
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
|
@ -441,7 +415,6 @@ public abstract class AbstractModifyMaxInactiveIntervalTest extends AbstractTest
|
|||
|
||||
//do another request using the cookie to ensure the session is still there
|
||||
request= client.newRequest("http://localhost:" + port + "/mod/test?action=test&val="+newMaxInactive);
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
|
||||
|
|
|
@ -96,8 +96,6 @@ public abstract class AbstractNonClusteredSessionScavengingTest extends Abstract
|
|||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
String sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
// Let's wait for the scavenger to run
|
||||
pause(maxInactivePeriod + scavengePeriod);
|
||||
|
@ -107,7 +105,6 @@ public abstract class AbstractNonClusteredSessionScavengingTest extends Abstract
|
|||
// The session should not be there anymore, but we present an old cookie
|
||||
// The server should create a new session.
|
||||
Request request = client.newRequest("http://localhost:" + port + contextPath + servletMapping.substring(1) + "?action=old-create");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
}
|
||||
|
@ -154,8 +151,6 @@ public abstract class AbstractNonClusteredSessionScavengingTest extends Abstract
|
|||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
String sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
// Let's wait for the scavenger to run
|
||||
pause(2*scavengePeriod);
|
||||
|
@ -164,7 +159,6 @@ public abstract class AbstractNonClusteredSessionScavengingTest extends Abstract
|
|||
|
||||
// Test that the session is still there
|
||||
Request request = client.newRequest("http://localhost:" + port + contextPath + servletMapping.substring(1) + "?action=old-test");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
}
|
||||
|
|
|
@ -108,8 +108,6 @@ public abstract class AbstractProxySerializationTest extends AbstractTestBase
|
|||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
String sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
//stop the context to be sure the sesssion will be passivated
|
||||
context.stop();
|
||||
|
@ -119,7 +117,6 @@ public abstract class AbstractProxySerializationTest extends AbstractTestBase
|
|||
|
||||
// Make another request using the session id from before
|
||||
Request request = client.newRequest("http://localhost:" + port + contextPath + servletMapping.substring(1) + "?action=test");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
}
|
||||
|
|
|
@ -141,8 +141,6 @@ public abstract class AbstractSessionExpiryTest extends AbstractTestBase
|
|||
assertEquals(HttpServletResponse.SC_OK,response1.getStatus());
|
||||
String sessionCookie = response1.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
String sessionId = TestServer.extractSessionId(sessionCookie);
|
||||
|
||||
|
@ -197,8 +195,6 @@ public abstract class AbstractSessionExpiryTest extends AbstractTestBase
|
|||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
String sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
//now stop the server
|
||||
server1.stop();
|
||||
|
@ -211,7 +207,6 @@ public abstract class AbstractSessionExpiryTest extends AbstractTestBase
|
|||
|
||||
//make another request, the session should not have expired
|
||||
Request request = client.newRequest(url + "?action=notexpired");
|
||||
request.getHeaders().add("Cookie", sessionCookie);
|
||||
ContentResponse response2 = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response2.getStatus());
|
||||
|
||||
|
@ -268,8 +263,6 @@ public abstract class AbstractSessionExpiryTest extends AbstractTestBase
|
|||
assertEquals(HttpServletResponse.SC_OK,response1.getStatus());
|
||||
String sessionCookie = response1.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
String sessionId = TestServer.extractSessionId(sessionCookie);
|
||||
|
||||
|
@ -292,7 +285,6 @@ public abstract class AbstractSessionExpiryTest extends AbstractTestBase
|
|||
|
||||
//make another request, the session should have expired
|
||||
Request request = client.newRequest(url + "?action=test");
|
||||
request.getHeaders().add("Cookie", sessionCookie);
|
||||
ContentResponse response2 = request.send();
|
||||
|
||||
assertEquals(HttpServletResponse.SC_OK,response2.getStatus());
|
||||
|
@ -343,15 +335,11 @@ public abstract class AbstractSessionExpiryTest extends AbstractTestBase
|
|||
ContentResponse response = client.GET(url + "?action=init");
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
String sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
assertTrue(sessionCookie != null);
|
||||
|
||||
//make another request to change the session timeout to a larger value
|
||||
int newInactivePeriod = 100;
|
||||
Request request = client.newRequest(url + "?action=change&val="+newInactivePeriod);
|
||||
request.getHeaders().add("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
|
||||
|
@ -364,7 +352,6 @@ public abstract class AbstractSessionExpiryTest extends AbstractTestBase
|
|||
pause(inactivePeriod);
|
||||
|
||||
request = client.newRequest(url + "?action=check");
|
||||
request.getHeaders().add("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
String sessionCookie2 = response.getHeaders().get("Set-Cookie");
|
||||
|
|
|
@ -123,12 +123,9 @@ public abstract class AbstractSessionInvalidateCreateScavengeTest extends Abstra
|
|||
assertEquals(HttpServletResponse.SC_OK,response1.getStatus());
|
||||
String sessionCookie = response1.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
// Make a request which will invalidate the existing session and create a new one
|
||||
Request request2 = client.newRequest(url + "?action=test");
|
||||
request2.header("Cookie", sessionCookie);
|
||||
ContentResponse response2 = request2.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response2.getStatus());
|
||||
|
||||
|
|
|
@ -107,8 +107,6 @@ public class CreationTest
|
|||
|
||||
String sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
//session should now be evicted from the cache
|
||||
String id = TestServer.extractSessionId(sessionCookie);
|
||||
|
@ -118,7 +116,6 @@ public class CreationTest
|
|||
|
||||
//make another request for the same session
|
||||
Request request = client.newRequest("http://localhost:" + port1 + contextPath + servletMapping + "?action=test");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
|
||||
|
|
|
@ -112,12 +112,9 @@ public class DirtyAttributeTest
|
|||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
String sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
|
||||
//do another request to change the session attribute
|
||||
Request request = client.newRequest("http://localhost:" + port + "/mod/test?action=setA");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
|
@ -128,7 +125,6 @@ public class DirtyAttributeTest
|
|||
|
||||
//do another request using the cookie to try changing the session attribute to the same value again
|
||||
request= client.newRequest("http://localhost:" + port + "/mod/test?action=setA");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
A_VALUE.assertPassivatesEquals(2);
|
||||
|
@ -138,7 +134,6 @@ public class DirtyAttributeTest
|
|||
|
||||
//do another request using the cookie and change to a different value
|
||||
request= client.newRequest("http://localhost:" + port + "/mod/test?action=setB");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
B_VALUE.assertPassivatesEquals(1);
|
||||
|
|
|
@ -105,8 +105,6 @@ public class IdleSessionTest
|
|||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
String sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
//and wait until the session should be idled out
|
||||
pause(evictionSec*3);
|
||||
|
@ -118,7 +116,6 @@ public class IdleSessionTest
|
|||
|
||||
//make another request to de-idle the session
|
||||
Request request = client.newRequest(url + "?action=test");
|
||||
request.getHeaders().add("Cookie", sessionCookie);
|
||||
ContentResponse response2 = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response2.getStatus());
|
||||
|
||||
|
@ -140,7 +137,6 @@ public class IdleSessionTest
|
|||
|
||||
//make a request
|
||||
request = client.newRequest(url + "?action=testfail");
|
||||
request.getHeaders().add("Cookie", sessionCookie);
|
||||
response2 = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response2.getStatus());
|
||||
|
||||
|
@ -150,8 +146,6 @@ public class IdleSessionTest
|
|||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
id = TestServer.extractSessionId(sessionCookie);
|
||||
|
||||
//and wait until the session should be idled out
|
||||
|
@ -170,7 +164,6 @@ public class IdleSessionTest
|
|||
|
||||
//make another request to de-idle the session
|
||||
request = client.newRequest(url + "?action=testfail");
|
||||
request.getHeaders().add("Cookie", sessionCookie);
|
||||
response2 = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response2.getStatus());
|
||||
|
||||
|
|
|
@ -96,8 +96,6 @@ public class ImmortalSessionTest
|
|||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
String sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
String resp = response.getContentAsString();
|
||||
assertEquals(resp.trim(),String.valueOf(value));
|
||||
|
@ -107,7 +105,6 @@ public class ImmortalSessionTest
|
|||
|
||||
// Be sure the session is still there
|
||||
Request request = client.newRequest("http://localhost:" + port + contextPath + servletMapping + "?action=get");
|
||||
request.header("Cookie", sessionCookie);
|
||||
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
|
|
|
@ -72,8 +72,6 @@ public class ReentrantRequestSessionTest
|
|||
|
||||
String sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
//make a request that will make a simultaneous request for the same session
|
||||
Request request = client.newRequest("http://localhost:" + port + contextPath + servletMapping + "?action=reenter&port=" + port + "&path=" + contextPath + servletMapping);
|
||||
|
|
|
@ -80,8 +80,7 @@ public class RemoveSessionTest
|
|||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
String sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
//ensure sessionCreated listener is called
|
||||
assertTrue (testListener.isCreated());
|
||||
assertEquals(1, m.getSessionsCreated());
|
||||
|
@ -90,7 +89,6 @@ public class RemoveSessionTest
|
|||
|
||||
//now delete the session
|
||||
Request request = client.newRequest("http://localhost:" + port + contextPath + servletMapping + "?action=delete");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
//ensure sessionDestroyed listener is called
|
||||
|
@ -104,7 +102,6 @@ public class RemoveSessionTest
|
|||
|
||||
// The session is not there anymore, even if we present an old cookie
|
||||
request = client.newRequest("http://localhost:" + port + contextPath + servletMapping + "?action=check");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
assertEquals(0, ((DefaultSessionCache)m.getSessionCache()).getSessionsCurrent());
|
||||
|
|
|
@ -93,8 +93,6 @@ public class SameContextForwardedSessionTest
|
|||
assertEquals(HttpServletResponse.SC_OK, response.getStatus());
|
||||
String sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
//wait until all of the request handling has finished
|
||||
_synchronizer.await();
|
||||
|
@ -105,7 +103,6 @@ public class SameContextForwardedSessionTest
|
|||
|
||||
//Make a fresh request
|
||||
Request request = client.newRequest("http://localhost:" + serverPort + "/context/four");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK, response.getStatus());
|
||||
|
||||
|
|
|
@ -83,8 +83,6 @@ public class SameNodeLoadTest
|
|||
assertEquals(HttpServletResponse.SC_OK,response1.getStatus());
|
||||
String sessionCookie = response1.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
//simulate 10 clients making 100 requests each
|
||||
ExecutorService executor = Executors.newCachedThreadPool();
|
||||
|
@ -110,7 +108,6 @@ public class SameNodeLoadTest
|
|||
|
||||
// Perform one request to get the result
|
||||
Request request = client.newRequest( url + "?action=result" );
|
||||
request.header("Cookie", sessionCookie);
|
||||
ContentResponse response2 = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response2.getStatus());
|
||||
String response = response2.getContentAsString();
|
||||
|
@ -174,7 +171,6 @@ public class SameNodeLoadTest
|
|||
Thread.currentThread().sleep(pauseMsec);
|
||||
}
|
||||
Request request = client.newRequest(url + "?action=increment");
|
||||
request.header("Cookie", sessionCookie);
|
||||
ContentResponse response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
}
|
||||
|
|
|
@ -159,11 +159,8 @@ public class SaveOptimizeTest
|
|||
//make a few requests to access the session but not change it
|
||||
for (int i=0;i<5; i++)
|
||||
{
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
// Perform a request to contextB with the same session cookie
|
||||
Request request = client.newRequest("http://localhost:" + port1 + contextPath + servletMapping+"?action=noop");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
|
||||
//check session is unchanged
|
||||
|
@ -237,9 +234,7 @@ public class SaveOptimizeTest
|
|||
|
||||
|
||||
// Perform a request to do nothing with the same session cookie
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
Request request = client.newRequest("http://localhost:" + port1 + contextPath + servletMapping+"?action=noop");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
|
||||
//check session not saved
|
||||
|
@ -249,7 +244,6 @@ public class SaveOptimizeTest
|
|||
|
||||
// Perform a request to mutate the session
|
||||
request = client.newRequest("http://localhost:" + port1 + contextPath + servletMapping+"?action=mutate");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
|
||||
//check session is saved
|
||||
|
@ -316,11 +310,9 @@ public class SaveOptimizeTest
|
|||
long lastSaved = data.getLastSaved();
|
||||
|
||||
//make another request, session should not change
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
// Perform a request to do nothing with the same session cookie
|
||||
Request request = client.newRequest("http://localhost:" + port1 + contextPath + servletMapping+"?action=noop");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
|
||||
//check session not saved
|
||||
|
@ -333,7 +325,6 @@ public class SaveOptimizeTest
|
|||
|
||||
// Perform a request to do nothing with the same session cookie
|
||||
request = client.newRequest("http://localhost:" + port1 + contextPath + servletMapping+"?action=noop");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
|
||||
//check session is saved
|
||||
|
@ -401,12 +392,8 @@ public class SaveOptimizeTest
|
|||
long lastSaved = data.getLastSaved();
|
||||
assertTrue(lastSaved > 0); //check session created was saved
|
||||
|
||||
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
// Perform a request to do nothing with the same session cookie, check the session object is different
|
||||
Request request = client.newRequest("http://localhost:" + port1 + contextPath + servletMapping+"?action=noop&check=diff");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
|
||||
//check session not saved
|
||||
|
@ -476,12 +463,8 @@ public class SaveOptimizeTest
|
|||
long lastSaved = data.getLastSaved();
|
||||
assertTrue(lastSaved > 0); //check session created was saved
|
||||
|
||||
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
// Perform a request to change maxInactive on session
|
||||
Request request = client.newRequest("http://localhost:" + port1 + contextPath + servletMapping+"?action=max&value=60");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
|
||||
//check session is saved, even though the save optimisation interval has not passed
|
||||
|
|
|
@ -237,9 +237,7 @@ public class SessionEvictionFailureTest
|
|||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
String sessionCookie = response.getHeaders().get("Set-Cookie");
|
||||
assertNotNull(sessionCookie);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
|
||||
//Wait for the eviction period to expire - save on evict should fail but session
|
||||
//should remain in the cache
|
||||
pause(evictionPeriod+(int)(evictionPeriod*0.5));
|
||||
|
@ -248,7 +246,6 @@ public class SessionEvictionFailureTest
|
|||
// Make another request to see if the session is still in the cache and can be used,
|
||||
//allow it to be saved this time
|
||||
Request request = client.newRequest(url + "?action=test");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
assertNull(response.getHeaders().get("Set-Cookie")); //check that the cookie wasn't reset
|
||||
|
@ -259,7 +256,6 @@ public class SessionEvictionFailureTest
|
|||
|
||||
|
||||
request = client.newRequest(url + "?action=test");
|
||||
request.header("Cookie", sessionCookie);
|
||||
response = request.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response.getStatus());
|
||||
}
|
||||
|
|
|
@ -109,15 +109,11 @@ public class SessionListenerTest
|
|||
assertEquals(HttpServletResponse.SC_OK,response1.getStatus());
|
||||
String sessionCookie = response1.getHeaders().get("Set-Cookie");
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
assertTrue (servlet.listener.bound);
|
||||
|
||||
|
||||
// Make a request which will invalidate the existing session
|
||||
Request request2 = client.newRequest(url + "?action=test");
|
||||
request2.header("Cookie", sessionCookie);
|
||||
ContentResponse response2 = request2.send();
|
||||
assertEquals(HttpServletResponse.SC_OK,response2.getStatus());
|
||||
|
||||
|
|
|
@ -135,7 +135,6 @@ public class SessionRenewTest
|
|||
|
||||
//make a request to change the sessionid
|
||||
Request request = client.newRequest("http://localhost:" + port + contextPath + servletMapping + "?action=renew");
|
||||
request.header("Cookie", sessionCookie);
|
||||
ContentResponse renewResponse = request.send();
|
||||
|
||||
assertEquals(HttpServletResponse.SC_OK,renewResponse.getStatus());
|
||||
|
|
Loading…
Reference in New Issue