392237 cleaned up client test exceptions

This commit is contained in:
Greg Wilkins 2012-10-18 16:36:21 +11:00
parent 27e8efec94
commit 7796a49020
3 changed files with 43 additions and 18 deletions

View File

@ -35,10 +35,13 @@ import org.eclipse.jetty.client.util.BytesContentProvider;
import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http.HttpHeaderValue; import org.eclipse.jetty.http.HttpHeaderValue;
import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpMethod;
import org.eclipse.jetty.server.HttpChannel;
import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.toolchain.test.annotation.Slow; import org.eclipse.jetty.toolchain.test.annotation.Slow;
import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.StdErrLog;
import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@ -417,6 +420,11 @@ public class HttpClientContinueTest extends AbstractHttpClientServerTest
} }
}); });
try
{
Log.getLogger(HttpChannel.class).info("Expecting Close warning...");
((StdErrLog)Log.getLogger(HttpChannel.class)).setHideStacks(true);
byte[] content = new byte[1024]; byte[] content = new byte[1024];
final CountDownLatch latch = new CountDownLatch(1); final CountDownLatch latch = new CountDownLatch(1);
client.newRequest("localhost", connector.getLocalPort()) client.newRequest("localhost", connector.getLocalPort())
@ -437,4 +445,9 @@ public class HttpClientContinueTest extends AbstractHttpClientServerTest
Assert.assertTrue(latch.await(5, TimeUnit.SECONDS)); Assert.assertTrue(latch.await(5, TimeUnit.SECONDS));
} }
finally
{
((StdErrLog)Log.getLogger(HttpChannel.class)).setHideStacks(false);
}
}
} }

View File

@ -36,6 +36,7 @@ import org.eclipse.jetty.client.util.ByteBufferContentProvider;
import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.toolchain.test.annotation.Slow; import org.eclipse.jetty.toolchain.test.annotation.Slow;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.StdErrLog; import org.eclipse.jetty.util.log.StdErrLog;
import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.junit.Assert; import org.junit.Assert;
@ -403,6 +404,8 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
final BlockingQueue<Connection> activeConnections = destination.getActiveConnections(); final BlockingQueue<Connection> activeConnections = destination.getActiveConnections();
Assert.assertEquals(0, activeConnections.size()); Assert.assertEquals(0, activeConnections.size());
Log.getLogger(HttpConnection.class).info("Expecting java.lang.IllegalStateException: HttpParser{s=CLOSED,...");
final CountDownLatch latch = new CountDownLatch(1); final CountDownLatch latch = new CountDownLatch(1);
client.newRequest(host, port) client.newRequest(host, port)
.scheme(scheme) .scheme(scheme)

View File

@ -32,8 +32,11 @@ import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.client.api.ContentResponse; import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.client.api.Request; import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.client.util.ByteBufferContentProvider; import org.eclipse.jetty.client.util.ByteBufferContentProvider;
import org.eclipse.jetty.server.HttpChannel;
import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.StdErrLog;
import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@ -169,6 +172,8 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
// reads -1 with a pending exchange and fails the response with an EOFException // reads -1 with a pending exchange and fails the response with an EOFException
try try
{ {
Log.getLogger(HttpChannel.class).info("Excpecting java.nio.channels.ClosedChannelException...");
((StdErrLog)Log.getLogger(HttpChannel.class)).setHideStacks(true);
ContentResponse response = client.newRequest("localhost", connector.getLocalPort()) ContentResponse response = client.newRequest("localhost", connector.getLocalPort())
.scheme(scheme) .scheme(scheme)
.listener(new Request.Listener.Empty() .listener(new Request.Listener.Empty()
@ -210,5 +215,9 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
throw x; throw x;
} }
} }
finally
{
((StdErrLog)Log.getLogger(HttpChannel.class)).setHideStacks(false);
}
} }
} }