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.net.Socket;
import javax.net.ssl.SSLException;
import junit.framework.Assert;
import org.eclipse.jetty.util.IO;
@ -82,6 +84,10 @@ public abstract class ConnectorTimeoutTest extends HttpServerTestFixture
{
IO.toString(is);
assertEquals(-1, is.read());
}
catch(SSLException e)
{
}
catch(Exception e)
{

View File

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

View File

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