313196 randomly allocate ports for session test.

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1815 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2010-05-17 20:02:09 +00:00
parent a4473b746b
commit f5559e3f3a
3 changed files with 12 additions and 4 deletions

View File

@ -1,3 +1,6 @@
jetty-SNAPSHOT
+ 313196 randomly allocate ports for session test.
jetty-7.1.1.v20100517 jetty-7.1.1.v20100517
+ 302344 Make the list of available contexts if root context is not configured optional + 302344 Make the list of available contexts if root context is not configured optional
+ 304803 Remove TypeUtil Integer and Long caches + 304803 Remove TypeUtil Integer and Long caches

View File

@ -51,18 +51,18 @@ public abstract class AbstractOrphanedSessionTest
// Disable scavenging for the first server, so that we simulate its "crash". // Disable scavenging for the first server, so that we simulate its "crash".
String contextPath = ""; String contextPath = "";
String servletMapping = "/server"; String servletMapping = "/server";
int port1 = random.nextInt(50000) + 10000;
int inactivePeriod = 5; int inactivePeriod = 5;
AbstractTestServer server1 = createServer(port1, inactivePeriod, -1); AbstractTestServer server1 = createServer(0, inactivePeriod, -1);
server1.addContext(contextPath).addServlet(TestServlet.class, servletMapping); server1.addContext(contextPath).addServlet(TestServlet.class, servletMapping);
server1.start(); server1.start();
int port1 = server1.getPort();
try try
{ {
int port2 = random.nextInt(50000) + 10000;
int scavengePeriod = 2; int scavengePeriod = 2;
AbstractTestServer server2 = createServer(port2, inactivePeriod, scavengePeriod); AbstractTestServer server2 = createServer(0, inactivePeriod, scavengePeriod);
server2.addContext(contextPath).addServlet(TestServlet.class, servletMapping); server2.addContext(contextPath).addServlet(TestServlet.class, servletMapping);
server2.start(); server2.start();
int port2 = server2.getPort();
try try
{ {
HttpClient client = new HttpClient(); HttpClient client = new HttpClient();

View File

@ -61,6 +61,11 @@ public abstract class AbstractTestServer
_server.start(); _server.start();
} }
public int getPort()
{
return _server.getConnectors()[0].getLocalPort();
}
public ServletContextHandler addContext(String contextPath) public ServletContextHandler addContext(String contextPath)
{ {
ServletContextHandler context = new ServletContextHandler(_contexts, contextPath); ServletContextHandler context = new ServletContextHandler(_contexts, contextPath);