made test timing less sensitive to Virtual machine quantums

This commit is contained in:
Greg Wilkins 2011-11-16 17:54:35 +11:00
parent ff656d4a17
commit e322a28753
3 changed files with 5 additions and 5 deletions

View File

@ -72,7 +72,7 @@ import org.eclipse.jetty.util.thread.Timeout;
*/
public class HttpExchange
{
private static final Logger LOG = Log.getLogger(HttpExchange.class);
static final Logger LOG = Log.getLogger(HttpExchange.class);
public static final int STATUS_START = 0;
public static final int STATUS_WAITING_FOR_CONNECTION = 1;

View File

@ -54,7 +54,7 @@ import org.junit.Test;
*/
public class HttpExchangeTest
{
final static boolean verbose=true;
final static boolean verbose=HttpExchange.LOG.isDebugEnabled();
protected static int _maxConnectionsPerAddress = 2;
protected static String _scheme = "http";
protected static Server _server;

View File

@ -289,7 +289,7 @@ public class SelectChannelEndPointTest
OutputStream clientOutputStream = client.getOutputStream();
InputStream clientInputStream = client.getInputStream();
int specifiedTimeout = 200;
int specifiedTimeout = 400;
client.setSoTimeout(specifiedTimeout);
// Write 8 and cause block for 10
@ -309,8 +309,8 @@ public class SelectChannelEndPointTest
catch(SocketTimeoutException e)
{
int elapsed = Long.valueOf(System.currentTimeMillis() - start).intValue();
// System.err.println("blocked " + elapsed);
Assert.assertThat("Expected timeout", elapsed, greaterThanOrEqualTo(specifiedTimeout));
System.err.println("blocked for " + elapsed+ "ms");
Assert.assertThat("Expected timeout", elapsed, greaterThanOrEqualTo(3*specifiedTimeout/4));
}
// write remaining characters