Highlight test failure with DEBUG

This commit is contained in:
Joakim Erdfelt 2011-11-08 14:51:00 -07:00
parent 4e89277210
commit 4e79ea0dca
1 changed files with 13 additions and 9 deletions

View File

@ -14,9 +14,8 @@
package org.eclipse.jetty.client; package org.eclipse.jetty.client;
import static org.junit.Assert.assertEquals; import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.*;
import static org.junit.Assert.assertTrue;
import java.io.IOException; import java.io.IOException;
import java.net.SocketTimeoutException; import java.net.SocketTimeoutException;
@ -27,23 +26,25 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.io.Buffer; import org.eclipse.jetty.io.Buffer;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.AbstractHttpConnection; import org.eclipse.jetty.server.AbstractHttpConnection;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.server.nio.SelectChannelConnector; import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.log.StdErrLog; import org.eclipse.jetty.util.log.StdErrLog;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
/** /**
* @version $Revision$ $Date$
*/ */
public abstract class AbstractHttpExchangeCancelTest public abstract class AbstractHttpExchangeCancelTest
{ {
private static final Logger LOG = Log.getLogger(AbstractHttpExchangeCancelTest.TestHttpExchange.class);
private Server server; private Server server;
private Connector connector; private Connector connector;
@ -168,6 +169,8 @@ public abstract class AbstractHttpExchangeCancelTest
@Test @Test
public void testHttpExchangeCancelOnRequestComplete() throws Exception public void testHttpExchangeCancelOnRequestComplete() throws Exception
{ {
LOG.setDebugEnabled(true);
TestHttpExchange exchange = new TestHttpExchange() TestHttpExchange exchange = new TestHttpExchange()
{ {
@Override @Override
@ -183,10 +186,10 @@ public abstract class AbstractHttpExchangeCancelTest
getHttpClient().send(exchange); getHttpClient().send(exchange);
int status = exchange.waitForDone(); int status = exchange.waitForDone();
assertEquals(HttpExchange.STATUS_CANCELLED, status); assertThat("Exchange Status", status, is(HttpExchange.STATUS_CANCELLED));
assertFalse(exchange.isResponseCompleted()); assertThat("Exchange.isResponseCompleted", exchange.isResponseCompleted(), is(false));
assertFalse(exchange.isFailed()); assertThat("Exchange.isFailed", exchange.isFailed(), is(false));
assertFalse(exchange.isAssociated()); assertThat("Exchange.isAssociated", exchange.isAssociated(), is(false));
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
@ -444,6 +447,7 @@ public abstract class AbstractHttpExchangeCancelTest
@Override @Override
protected synchronized void onException(Throwable ex) protected synchronized void onException(Throwable ex)
{ {
LOG.debug(ex);
if (ex instanceof SocketTimeoutException || if (ex instanceof SocketTimeoutException ||
ex.getCause() instanceof SocketTimeoutException) ex.getCause() instanceof SocketTimeoutException)
expired=true; expired=true;