Author: markt Date: Tue Sep 20 18:17:06 2011 New Revision: 1173288 URL: http://svn.apache.org/viewvc?rev=1173288&view=rev Log: Modify test to account for behaviours of different platforms and different connectors.
Modified: tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java Modified: tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java?rev=1173288&r1=1173287&r2=1173288&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java (original) +++ tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java Tue Sep 20 18:17:06 2011 @@ -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 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 // 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 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 return response.toString(); } - public Exception getException() { - return e; - } - @Override public void run() { try { @@ -284,7 +282,7 @@ public class TestCometProcessor extends c = is.read(); } } catch (Exception e) { - this.e = e; + // Ignore } } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org