diff --git a/VERSION.txt b/VERSION.txt index 46065ce6423..bd2ac7f1aa6 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 11476e528d2..5954ffdb288 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 c1cafa61ecd..845c9a6ec7f 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 60cf85a0af8..ec026af03bf 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 d7f79294479..5a1c5af48c9 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 c61507df0e7..666a2360f9d 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 9b61a3dbabe..fcb38b3b762 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 8261d73951c..afb561b111a 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 91662351001..53cecfd8723 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 4d22205fb29..0d0bef100e6 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 1304fee5fce..ad1d8ffaca2 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 5d0de13133d..d2f7768a54b 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 8c01f575b03..0ce9078b2df 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 36123e85915..ff9b489287a 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 85bbcf3dc3d..7be8cc1c294 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();