Return-Path: X-Original-To: apmail-tomcat-dev-archive@www.apache.org Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B487B7CF5 for ; Tue, 20 Sep 2011 18:17:29 +0000 (UTC) Received: (qmail 1150 invoked by uid 500); 20 Sep 2011 18:17:29 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 1070 invoked by uid 500); 20 Sep 2011 18:17:28 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 1060 invoked by uid 99); 20 Sep 2011 18:17:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Sep 2011 18:17:28 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Sep 2011 18:17:27 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 58DDE2388847 for ; Tue, 20 Sep 2011 18:17:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1173288 - /tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java Date: Tue, 20 Sep 2011 18:17:07 -0000 To: dev@tomcat.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20110920181707.58DDE2388847@eris.apache.org> 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-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org