Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2011-04-12 21:29:18 -0400
committerGreg Wilkins2011-04-12 21:29:18 -0400
commit65aa81c018c8cf4b8fe0b466abea8e15744b958d (patch)
treeeda33bda642b5e3465b81f50968cca7fb85c83eb
parentc226f9c5a83f954d2bcd4a69b0f7c86fc27cd2c5 (diff)
downloadorg.eclipse.jetty.project-65aa81c018c8cf4b8fe0b466abea8e15744b958d.tar.gz
org.eclipse.jetty.project-65aa81c018c8cf4b8fe0b466abea8e15744b958d.tar.xz
org.eclipse.jetty.project-65aa81c018c8cf4b8fe0b466abea8e15744b958d.zip
use port 0 instead of random port
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@3011 7e9141cc-0065-0410-87d8-b60c137991c4
-rw-r--r--VERSION.txt1
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java9
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractClientCrossContextSessionTest.java7
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractImmortalSessionTest.java7
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractInvalidationSessionTest.java10
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLastAccessTimeTest.java2
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLightLoadTest.java10
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLocalSessionScavengingTest.java9
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractNewSessionTest.java6
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractOrphanedSessionTest.java2
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractReentrantRequestSessionTest.java6
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractRemoveSessionTest.java6
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractServerCrossContextSessionTest.java6
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionMigrationTest.java10
-rw-r--r--tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractWebAppObjectInSessionTest.java9
15 files changed, 35 insertions, 65 deletions
diff --git a/VERSION.txt b/VERSION.txt
index 46065ce642..bd2ac7f1aa 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1,6 +1,7 @@
jetty-7.4.0-SNAPSHOT
+ 342504 Scanner Listener
+ JETTY-1362 Set root cause of UnavailableException
+ + Various test harness cleanups to avoid random failures
jetty-7.4.0.RC0
+ 324110 Added test harnesses for merging of QueryStrings.
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java
index 11476e528d..5954ffdb28 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java
@@ -113,9 +113,6 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
}
/* ------------------------------------------------------------ */
- /*
- * @see org.eclipse.jetty.http.HttpListener#getHttpServer()
- */
public ThreadPool getThreadPool()
{
return _threadPool;
@@ -144,18 +141,12 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
}
/* ------------------------------------------------------------ */
- /*
- * @see org.eclipse.jetty.server.server.HttpListener#setPort(int)
- */
public void setPort(int port)
{
_port = port;
}
/* ------------------------------------------------------------ */
- /*
- * @see org.eclipse.jetty.server.server.HttpListener#getPort()
- */
public int getPort()
{
return _port;
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractClientCrossContextSessionTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractClientCrossContextSessionTest.java
index c1cafa61ec..845c9a6ec7 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractClientCrossContextSessionTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractClientCrossContextSessionTest.java
@@ -42,18 +42,17 @@ public abstract class AbstractClientCrossContextSessionTest
@Test
public void testCrossContextDispatch() throws Exception
{
- Random random = new Random(System.nanoTime());
-
String contextA = "/contextA";
String contextB = "/contextB";
String servletMapping = "/server";
- int port = random.nextInt(50000) + 10000;
- AbstractTestServer server = createServer(port);
+ AbstractTestServer server = createServer(0);
ServletContextHandler ctxA = server.addContext(contextA);
ctxA.addServlet(TestServletA.class, servletMapping);
ServletContextHandler ctxB = server.addContext(contextB);
ctxB.addServlet(TestServletB.class, servletMapping);
server.start();
+ int port = server.getPort();
+
try
{
HttpClient client = new HttpClient();
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractImmortalSessionTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractImmortalSessionTest.java
index 60cf85a0af..ec026af03b 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractImmortalSessionTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractImmortalSessionTest.java
@@ -41,15 +41,14 @@ public abstract class AbstractImmortalSessionTest
@Test
public void testImmortalSession() throws Exception
{
- Random random = new Random(System.nanoTime());
-
String contextPath = "";
String servletMapping = "/server";
- int port = random.nextInt(50000) + 10000;
int scavengePeriod = 2;
- AbstractTestServer server = createServer(port, -1, scavengePeriod);
+ AbstractTestServer server = createServer(0, -1, scavengePeriod);
server.addContext(contextPath).addServlet(TestServlet.class, servletMapping);
server.start();
+ int port=server.getPort();
+
try
{
HttpClient client = new HttpClient();
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractInvalidationSessionTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractInvalidationSessionTest.java
index d7f7929447..5a1c5af48c 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractInvalidationSessionTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractInvalidationSessionTest.java
@@ -42,20 +42,18 @@ public abstract class AbstractInvalidationSessionTest
@Test
public void testInvalidation() throws Exception
{
- Random random = new Random(System.nanoTime());
-
String contextPath = "";
String servletMapping = "/server";
- int port1 = random.nextInt(50000) + 10000;
- AbstractTestServer server1 = createServer(port1);
+ AbstractTestServer server1 = createServer(0);
server1.addContext(contextPath).addServlet(TestServlet.class, servletMapping);
server1.start();
+ int port1 = server1.getPort();
try
{
- int port2 = random.nextInt(50000) + 10000;
- AbstractTestServer server2 = createServer(port2);
+ AbstractTestServer server2 = createServer(0);
server2.addContext(contextPath).addServlet(TestServlet.class, servletMapping);
server2.start();
+ int port2=server2.getPort();
try
{
HttpClient client = new HttpClient();
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 c61507df0e..666a2360f9 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
@@ -39,8 +39,6 @@ public abstract class AbstractLastAccessTimeTest
@Test
public void testLastAccessTime() throws Exception
{
- Random random = new Random(System.nanoTime());
-
String contextPath = "";
String servletMapping = "/server";
int maxInactivePeriod = 8;
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLightLoadTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLightLoadTest.java
index 9b61a3dbab..fcb38b3b76 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLightLoadTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLightLoadTest.java
@@ -50,20 +50,18 @@ public abstract class AbstractLightLoadTest
{
if ( _stress )
{
- Random random = new Random( System.nanoTime() );
-
String contextPath = "";
String servletMapping = "/server";
- int port1 = random.nextInt( 50000 ) + 10000;
- AbstractTestServer server1 = createServer( port1 );
+ AbstractTestServer server1 = createServer( 0 );
server1.addContext( contextPath ).addServlet( TestServlet.class, servletMapping );
server1.start();
+ int port1 = server1.getPort();
try
{
- int port2 = random.nextInt( 50000 ) + 10000;
- AbstractTestServer server2 = createServer( port2 );
+ AbstractTestServer server2 = createServer( 0 );
server2.addContext( contextPath ).addServlet( TestServlet.class, servletMapping );
server2.start();
+ int port2=server2.getPort();
try
{
HttpClient client = new HttpClient();
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLocalSessionScavengingTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLocalSessionScavengingTest.java
index 8261d73951..afb561b111 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLocalSessionScavengingTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractLocalSessionScavengingTest.java
@@ -52,21 +52,20 @@ public abstract class AbstractLocalSessionScavengingTest
@Test
public void testLocalSessionsScavenging() throws Exception
{
- Random random = new Random(System.nanoTime());
String contextPath = "";
String servletMapping = "/server";
- int port1 = random.nextInt(50000) + 10000;
int inactivePeriod = 1;
int scavengePeriod = 2;
- AbstractTestServer server1 = createServer(port1, inactivePeriod, scavengePeriod);
+ AbstractTestServer server1 = createServer(0, inactivePeriod, scavengePeriod);
server1.addContext(contextPath).addServlet(TestServlet.class, servletMapping);
server1.start();
+ int port1 = server1.getPort();
try
{
- int port2 = random.nextInt(50000) + 10000;
- AbstractTestServer server2 = createServer(port2, inactivePeriod, scavengePeriod * 3);
+ AbstractTestServer server2 = createServer(0, inactivePeriod, scavengePeriod * 3);
server2.addContext(contextPath).addServlet(TestServlet.class, servletMapping);
server2.start();
+ int port2 = server2.getPort();
try
{
HttpClient client = new HttpClient();
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractNewSessionTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractNewSessionTest.java
index 9166235100..53cecfd872 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractNewSessionTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractNewSessionTest.java
@@ -51,16 +51,14 @@ public abstract class AbstractNewSessionTest
@Test
public void testNewSession() throws Exception
{
- Random random = new Random(System.nanoTime());
-
String contextPath = "";
String servletMapping = "/server";
- int port = random.nextInt(50000) + 10000;
int scavengePeriod = 3;
- AbstractTestServer server = createServer(port, 1, scavengePeriod);
+ AbstractTestServer server = createServer(0, 1, scavengePeriod);
ServletContextHandler context = server.addContext(contextPath);
context.addServlet(TestServlet.class, servletMapping);
server.start();
+ int port=server.getPort();
try
{
HttpClient client = new HttpClient();
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractOrphanedSessionTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractOrphanedSessionTest.java
index 4d22205fb2..0d0bef100e 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractOrphanedSessionTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractOrphanedSessionTest.java
@@ -45,8 +45,6 @@ public abstract class AbstractOrphanedSessionTest
@Test
public void testOrphanedSession() throws Exception
{
- Random random = new Random(System.nanoTime());
-
// Disable scavenging for the first server, so that we simulate its "crash".
String contextPath = "";
String servletMapping = "/server";
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractReentrantRequestSessionTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractReentrantRequestSessionTest.java
index 1304fee5fc..ad1d8ffaca 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractReentrantRequestSessionTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractReentrantRequestSessionTest.java
@@ -40,14 +40,12 @@ public abstract class AbstractReentrantRequestSessionTest
@Test
public void testReentrantRequestSession() throws Exception
{
- Random random = new Random(System.nanoTime());
-
String contextPath = "";
String servletMapping = "/server";
- int port = random.nextInt(50000) + 10000;
- AbstractTestServer server = createServer(port);
+ AbstractTestServer server = createServer(0);
server.addContext(contextPath).addServlet(TestServlet.class, servletMapping);
server.start();
+ int port = server.getPort();
try
{
HttpClient client = new HttpClient();
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractRemoveSessionTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractRemoveSessionTest.java
index 5d0de13133..d2f7768a54 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractRemoveSessionTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractRemoveSessionTest.java
@@ -25,16 +25,14 @@ public abstract class AbstractRemoveSessionTest
@Test
public void testRemoveSession() throws Exception
{
- Random random = new Random(System.nanoTime());
-
String contextPath = "";
String servletMapping = "/server";
- int port = random.nextInt(50000) + 10000;
int scavengePeriod = 3;
- AbstractTestServer server = createServer(port, 1, scavengePeriod);
+ AbstractTestServer server = createServer(0, 1, scavengePeriod);
ServletContextHandler context = server.addContext(contextPath);
context.addServlet(TestServlet.class, servletMapping);
server.start();
+ int port = server.getPort();
try
{
HttpClient client = new HttpClient();
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractServerCrossContextSessionTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractServerCrossContextSessionTest.java
index 8c01f575b0..0ce9078b2d 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractServerCrossContextSessionTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractServerCrossContextSessionTest.java
@@ -44,18 +44,16 @@ public abstract class AbstractServerCrossContextSessionTest
@Test
public void testCrossContextDispatch() throws Exception
{
- Random random = new Random(System.nanoTime());
-
String contextA = "/contextA";
String contextB = "/contextB";
String servletMapping = "/server";
- int port = random.nextInt(50000) + 10000;
- AbstractTestServer server = createServer(port);
+ AbstractTestServer server = createServer(0);
ServletContextHandler ctxA = server.addContext(contextA);
ctxA.addServlet(TestServletA.class, servletMapping);
ServletContextHandler ctxB = server.addContext(contextB);
ctxB.addServlet(TestServletB.class, servletMapping);
server.start();
+ int port=server.getPort();
try
{
HttpClient client = new HttpClient();
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionMigrationTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionMigrationTest.java
index 36123e8591..ff9b489287 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionMigrationTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractSessionMigrationTest.java
@@ -40,20 +40,18 @@ public abstract class AbstractSessionMigrationTest
@Test
public void testSessionMigration() throws Exception
{
- Random random = new Random(System.nanoTime());
-
String contextPath = "";
String servletMapping = "/server";
- int port1 = random.nextInt(50000) + 10000;
- AbstractTestServer server1 = createServer(port1);
+ AbstractTestServer server1 = createServer(0);
server1.addContext(contextPath).addServlet(TestServlet.class, servletMapping);
server1.start();
+ int port1=server1.getPort();
try
{
- int port2 = random.nextInt(50000) + 10000;
- AbstractTestServer server2 = createServer(port2);
+ AbstractTestServer server2 = createServer(0);
server2.addContext(contextPath).addServlet(TestServlet.class, servletMapping);
server2.start();
+ int port2=server2.getPort();
try
{
HttpClient client = new HttpClient();
diff --git a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractWebAppObjectInSessionTest.java b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractWebAppObjectInSessionTest.java
index 85bbcf3dc3..7be8cc1c29 100644
--- a/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractWebAppObjectInSessionTest.java
+++ b/tests/test-sessions/test-sessions-common/src/main/java/org/eclipse/jetty/server/session/AbstractWebAppObjectInSessionTest.java
@@ -87,18 +87,17 @@ public abstract class AbstractWebAppObjectInSessionTest
targetFile = new File(packageDirs, resourceName);
//copy(sourceFile, targetFile);
IO.copy(resource.getInputStream(), new FileOutputStream(targetFile));
- Random random = new Random(System.nanoTime());
- int port1 = random.nextInt(50000) + 10000;
- AbstractTestServer server1 = createServer(port1);
+ AbstractTestServer server1 = createServer(0);
server1.addWebAppContext(warDir.getCanonicalPath(), contextPath).addServlet(WebAppObjectInSessionServlet.class.getName(), servletMapping);
server1.start();
+ int port1 = server1.getPort();
try
{
- int port2 = random.nextInt(50000) + 10000;
- AbstractTestServer server2 = createServer(port2);
+ AbstractTestServer server2 = createServer(0);
server2.addWebAppContext(warDir.getCanonicalPath(), contextPath).addServlet(WebAppObjectInSessionServlet.class.getName(), servletMapping);
server2.start();
+ int port2 = server2.getPort();
try
{
HttpClient client = new HttpClient();

Back to the top