more test refinements

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2528 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2010-11-17 02:59:48 +00:00
parent 9c098e899a
commit e24075a294
3 changed files with 16 additions and 9 deletions

View File

@ -21,6 +21,8 @@ import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.Socket; import java.net.Socket;
import javax.net.ssl.SSLException;
import junit.framework.Assert; import junit.framework.Assert;
import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.IO;
@ -82,6 +84,10 @@ public abstract class ConnectorTimeoutTest extends HttpServerTestFixture
{ {
IO.toString(is); IO.toString(is);
assertEquals(-1, is.read()); assertEquals(-1, is.read());
}
catch(SSLException e)
{
} }
catch(Exception e) catch(Exception e)
{ {

View File

@ -30,14 +30,15 @@ public class QueuedThreadPoolTest
class RunningJob implements Runnable class RunningJob implements Runnable
{ {
private final CountDownLatch _latch = new CountDownLatch(3); private final CountDownLatch _run = new CountDownLatch(1);
private final CountDownLatch _stopping = new CountDownLatch(1);
private final CountDownLatch _stopped = new CountDownLatch(1);
public void run() public void run()
{ {
try try
{ {
_latch.countDown(); _run.countDown();
while(_latch.getCount()>=2) _stopping.await();
Thread.sleep(10);
} }
catch(Exception e) catch(Exception e)
{ {
@ -46,16 +47,15 @@ public class QueuedThreadPoolTest
finally finally
{ {
_jobs.incrementAndGet(); _jobs.incrementAndGet();
_latch.countDown(); _stopped.countDown();
} }
} }
public void stop() throws InterruptedException public void stop() throws InterruptedException
{ {
if (_latch.getCount()<=1) _run.await(10,TimeUnit.SECONDS);
throw new IllegalStateException(); _stopping.countDown();
_latch.countDown(); if (!_stopped.await(10,TimeUnit.SECONDS))
if (!_latch.await(10,TimeUnit.SECONDS))
throw new IllegalStateException(); throw new IllegalStateException();
} }
}; };

View File

@ -249,6 +249,7 @@ public abstract class ContinuationBase extends TestCase
catch(Exception e) catch(Exception e)
{ {
System.err.println("failed on port "+port); System.err.println("failed on port "+port);
e.printStackTrace();
throw e; throw e;
} }
return response; return response;