From: markt Date: Tue, 20 Sep 2011 18:17:06 +0000 (+0000) Subject: Modify test to account for behaviours of different platforms and different connectors. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=50f623bbda5242b41974080a11affc5356a6c798;p=tomcat7.0 Modify test to account for behaviours of different platforms and different connectors. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1173288 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/test/org/apache/catalina/comet/TestCometProcessor.java b/test/org/apache/catalina/comet/TestCometProcessor.java index b1916bba2..c6c6105ea 100644 --- a/test/org/apache/catalina/comet/TestCometProcessor.java +++ b/test/org/apache/catalina/comet/TestCometProcessor.java @@ -30,7 +30,6 @@ import javax.servlet.http.HttpSession; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import org.junit.Test; @@ -152,6 +151,8 @@ public class TestCometProcessor extends TomcatBaseTest { Thread.sleep(3000); tomcat.getConnector().stop(); + // Allow the executor a chance to send the end event + Thread.sleep(100); tomcat.getConnector().destroy(); // Wait for the write thread to stop @@ -171,9 +172,11 @@ public class TestCometProcessor extends TomcatBaseTest { // socket should be closed assertNotNull("No exception in writing thread", writeThread.getException()); - // Read should terminate gracefully with an EOF - assertNull("Read thread terminated with an exception", - readThread.getException()); + + // Termination of Read thread varies by platform and protocol + // In all cases, the END event should be sent. + assertTrue("Comet END event not received", + readThread.getResponse().contains("Client: END")); } private boolean isCometSupported() { @@ -261,7 +264,6 @@ public class TestCometProcessor extends TomcatBaseTest { private InputStream is; private StringBuilder response = new StringBuilder(); - private volatile Exception e = null; public ResponseReaderThread(InputStream is) { this.is = is; @@ -271,10 +273,6 @@ public class TestCometProcessor extends TomcatBaseTest { return response.toString(); } - public Exception getException() { - return e; - } - @Override public void run() { try { @@ -284,7 +282,7 @@ public class TestCometProcessor extends TomcatBaseTest { c = is.read(); } } catch (Exception e) { - this.e = e; + // Ignore } } }