diff options
5 files changed, 75 insertions, 15 deletions
diff --git a/VERSION.txt b/VERSION.txt index d81d4976db..191cb0a21d 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,6 +1,7 @@ jetty-7.4.3-SNAPSHOT + 295832 ProxyServlet more extensible and configurable + 302566 GZIP handler for embedded Jetty servers + + 308851 Converted HttpExchangeTest and related tests to JUnit 4 + 332200 Eliminate expected exceptions from log while using org.eclipse.jetty.jmx bundle + 347468 o.e.j.deploy.binding.GlobalWebappConfigBindingTest fails on Windows platform + 347617 Dynamically install/update/remove OSGi bundles discovered in the contexts folder diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/AsyncSslHttpExchangeTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/AsyncSslHttpExchangeTest.java index 48030d4cbd..f4103bd4e4 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/AsyncSslHttpExchangeTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/AsyncSslHttpExchangeTest.java @@ -16,7 +16,7 @@ package org.eclipse.jetty.client; public class AsyncSslHttpExchangeTest extends SslHttpExchangeTest { @Override - protected void setUp() throws Exception + public void setUp() throws Exception { _scheme="https://"; startServer(); @@ -28,5 +28,4 @@ public class AsyncSslHttpExchangeTest extends SslHttpExchangeTest _httpClient.setMaxConnectionsPerAddress(2); _httpClient.start(); } - } diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/ExternalKeyStoreAsyncSslHttpExchangeTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/ExternalKeyStoreAsyncSslHttpExchangeTest.java index 9ef4e4e3c3..0f47db5f3f 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/ExternalKeyStoreAsyncSslHttpExchangeTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/ExternalKeyStoreAsyncSslHttpExchangeTest.java @@ -20,7 +20,7 @@ import org.eclipse.jetty.toolchain.test.MavenTestingUtils; public class ExternalKeyStoreAsyncSslHttpExchangeTest extends SslHttpExchangeTest { @Override - protected void setUp() throws Exception + public void setUp() throws Exception { _scheme = "https://"; startServer(); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpExchangeTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpExchangeTest.java index a6247dfa4e..2c571d29f4 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpExchangeTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpExchangeTest.java @@ -13,6 +13,11 @@ package org.eclipse.jetty.client; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; @@ -26,8 +31,6 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import junit.framework.TestCase; - import org.eclipse.jetty.client.security.ProxyAuthorization; import org.eclipse.jetty.http.HttpHeaders; import org.eclipse.jetty.http.HttpMethods; @@ -44,11 +47,15 @@ import org.eclipse.jetty.server.nio.SelectChannelConnector; import org.eclipse.jetty.toolchain.test.Stress; import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.log.Log; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +/* ------------------------------------------------------------ */ /** * Functional testing for HttpExchange. */ -public class HttpExchangeTest extends TestCase +public class HttpExchangeTest { protected int _maxConnectionsPerAddress = 2; protected String _scheme = "http://"; @@ -58,8 +65,9 @@ public class HttpExchangeTest extends TestCase protected Connector _connector; protected AtomicInteger _count = new AtomicInteger(); - @Override - protected void setUp() throws Exception + /* ------------------------------------------------------------ */ + @Before + public void setUp() throws Exception { startServer(); _httpClient=new HttpClient(); @@ -71,20 +79,25 @@ public class HttpExchangeTest extends TestCase _httpClient.start(); } - @Override - protected void tearDown() throws Exception + /* ------------------------------------------------------------ */ + @After + public void tearDown() throws Exception { _httpClient.stop(); Thread.sleep(500); stopServer(); } + /* ------------------------------------------------------------ */ + @Test public void testResetNewExchange() throws Exception { HttpExchange exchange = new HttpExchange(); exchange.reset(); } + /* ------------------------------------------------------------ */ + @Test public void testPerf() throws Exception { sender(1,false); @@ -104,6 +117,7 @@ public class HttpExchangeTest extends TestCase } } + /* ------------------------------------------------------------ */ /** * Test sending data through the exchange. * @@ -124,12 +138,15 @@ public class HttpExchangeTest extends TestCase { String result="pending"; int len=0; + + /* ------------------------------------------------------------ */ @Override protected void onRequestCommitted() { result="committed"; } + /* ------------------------------------------------------------ */ @Override protected void onRequestComplete() throws IOException { @@ -137,16 +154,19 @@ public class HttpExchangeTest extends TestCase } @Override + /* ------------------------------------------------------------ */ protected void onResponseStatus(Buffer version, int status, Buffer reason) { result="status"; } + /* ------------------------------------------------------------ */ @Override protected void onResponseHeader(Buffer name, Buffer value) { } + /* ------------------------------------------------------------ */ @Override protected void onResponseHeaderComplete() throws IOException { @@ -154,12 +174,14 @@ public class HttpExchangeTest extends TestCase super.onResponseHeaderComplete(); } + /* ------------------------------------------------------------ */ @Override protected void onResponseContent(Buffer content) { len+=content.length(); } + /* ------------------------------------------------------------ */ @Override protected void onResponseComplete() { @@ -173,6 +195,7 @@ public class HttpExchangeTest extends TestCase complete.countDown(); } + /* ------------------------------------------------------------ */ @Override protected void onConnectionFailed(Throwable ex) { @@ -182,6 +205,7 @@ public class HttpExchangeTest extends TestCase super.onConnectionFailed(ex); } + /* ------------------------------------------------------------ */ @Override protected void onException(Throwable ex) { @@ -191,6 +215,7 @@ public class HttpExchangeTest extends TestCase super.onException(ex); } + /* ------------------------------------------------------------ */ @Override protected void onExpire() { @@ -200,6 +225,7 @@ public class HttpExchangeTest extends TestCase super.onExpire(); } + /* ------------------------------------------------------------ */ @Override public String toString() { @@ -228,6 +254,8 @@ public class HttpExchangeTest extends TestCase assertEquals("nb="+nb+" close="+close,0,latch.getCount()); } + /* ------------------------------------------------------------ */ + @Test public void testPostWithContentExchange() throws Exception { for (int i=0;i<20;i++) @@ -246,6 +274,8 @@ public class HttpExchangeTest extends TestCase } } + /* ------------------------------------------------------------ */ + @Test public void testGetWithContentExchange() throws Exception { for (int i=0;i<10;i++) @@ -264,6 +294,8 @@ public class HttpExchangeTest extends TestCase } } + /* ------------------------------------------------------------ */ + @Test public void testLocalAddressAvailabilityWithContentExchange() throws Exception { for (int i=0;i<10;i++) @@ -287,6 +319,8 @@ public class HttpExchangeTest extends TestCase } } + /* ------------------------------------------------------------ */ + @Test public void testShutdownWithExchange() throws Exception { final AtomicReference<Throwable> throwable=new AtomicReference<Throwable>(); @@ -304,6 +338,10 @@ public class HttpExchangeTest extends TestCase throwable.set(x); } + /* ------------------------------------------------------------ */ + /** + * @see org.eclipse.jetty.client.HttpExchange#onConnectionFailed(java.lang.Throwable) + */ @Override protected void onConnectionFailed(Throwable x) { @@ -330,6 +368,8 @@ public class HttpExchangeTest extends TestCase assertEquals(HttpExchange.STATUS_EXCEPTED, status); } + /* ------------------------------------------------------------ */ + @Test public void testBigPostWithContentExchange() throws Exception { int size =32; @@ -370,6 +410,8 @@ public class HttpExchangeTest extends TestCase assertEquals(HttpExchange.STATUS_COMPLETED, status); } + /* ------------------------------------------------------------ */ + @Test public void testSlowPost() throws Exception { ContentExchange httpExchange=new ContentExchange() @@ -431,6 +473,8 @@ public class HttpExchangeTest extends TestCase assertEquals(data,result); } + /* ------------------------------------------------------------ */ + @Test public void testProxy() throws Exception { if (_scheme.equals("https://")) @@ -460,6 +504,8 @@ public class HttpExchangeTest extends TestCase } + /* ------------------------------------------------------------ */ + @Test public void testReserveConnections () throws Exception { final HttpDestination destination = _httpClient.getDestination (new Address("localhost", _port), _scheme.equalsIgnoreCase("https://")); @@ -485,10 +531,10 @@ public class HttpExchangeTest extends TestCase //reserving one should now work c = destination.reserveConnection(500); assertNotNull(c); - - } - public static void copyStrxeam(InputStream in, OutputStream out) + + /* ------------------------------------------------------------ */ + public static void copyStream(InputStream in, OutputStream out) { try { @@ -509,6 +555,7 @@ public class HttpExchangeTest extends TestCase } } + /* ------------------------------------------------------------ */ protected void newServer() throws Exception { _server=new Server(); @@ -521,6 +568,7 @@ public class HttpExchangeTest extends TestCase _server.setConnectors(new Connector[] { _connector }); } + /* ------------------------------------------------------------ */ protected void startServer() throws Exception { newServer(); @@ -587,6 +635,7 @@ public class HttpExchangeTest extends TestCase _port=_connector.getLocalPort(); } + /* ------------------------------------------------------------ */ private void stopServer() throws Exception { _server.stop(); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/SslHttpExchangeTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/SslHttpExchangeTest.java index fab7ad6d6c..eec253367b 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/SslHttpExchangeTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/SslHttpExchangeTest.java @@ -24,6 +24,8 @@ import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.eclipse.jetty.toolchain.test.OS; import org.eclipse.jetty.toolchain.test.Stress; import org.junit.Assume; +import org.junit.Before; +import org.junit.Test; /** * Functional testing for HttpExchange. @@ -33,8 +35,10 @@ import org.junit.Assume; */ public class SslHttpExchangeTest extends HttpExchangeTest { + /* ------------------------------------------------------------ */ + @Before @Override - protected void setUp() throws Exception + public void setUp() throws Exception { _scheme="https://"; startServer(); @@ -48,6 +52,7 @@ public class SslHttpExchangeTest extends HttpExchangeTest _httpClient.start(); } + /* ------------------------------------------------------------ */ @Override protected void newServer() { @@ -69,7 +74,9 @@ public class SslHttpExchangeTest extends HttpExchangeTest _connector=connector; } - private void IgnoreTestOnBuggyIBM() { + /* ------------------------------------------------------------ */ + private void IgnoreTestOnBuggyIBM() + { // Use Junit 4.x to flag test as ignored if encountering IBM JVM // Will show up in various junit reports as an ignored test as well. Assume.assumeThat(System.getProperty("java.vendor").toLowerCase(),not(containsString("ibm"))); @@ -79,6 +86,7 @@ public class SslHttpExchangeTest extends HttpExchangeTest /** * @see org.eclipse.jetty.client.HttpExchangeTest#testGetWithContentExchange() */ + @Test @Override public void testGetWithContentExchange() throws Exception { @@ -91,6 +99,7 @@ public class SslHttpExchangeTest extends HttpExchangeTest /** * @see org.eclipse.jetty.client.HttpExchangeTest#testPerf() */ + @Test @Override public void testPerf() throws Exception { @@ -106,6 +115,7 @@ public class SslHttpExchangeTest extends HttpExchangeTest /** * @see org.eclipse.jetty.client.HttpExchangeTest#testPostWithContentExchange() */ + @Test @Override public void testPostWithContentExchange() throws Exception { @@ -118,6 +128,7 @@ public class SslHttpExchangeTest extends HttpExchangeTest /** * @see org.eclipse.jetty.client.HttpExchangeTest#testReserveConnections() */ + @Test @Override public void testReserveConnections() throws Exception { |