tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1212098 - /tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java
Date Thu, 08 Dec 2011 20:35:17 GMT
Author: markt
Date: Thu Dec  8 20:35:17 2011
New Revision: 1212098

URL: http://svn.apache.org/viewvc?rev=1212098&view=rev
Log:
Work around possible JVM bug (maybe Tomcat bug) that triggers regular
unit test failures.

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=1212098&r1=1212097&r2=1212098&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java (original)
+++ tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java Thu Dec  8 20:35:17
2011
@@ -166,6 +166,7 @@ public class TestCometProcessor extends 
         os.write(requestLine.getBytes());
         os.write("transfer-encoding: chunked\r\n".getBytes());
         os.write("\r\n".getBytes());
+        os.flush();
 
         PingWriterThread writeThread = new PingWriterThread(4, os);
         writeThread.start();
@@ -216,10 +217,11 @@ public class TestCometProcessor extends 
             // the 200 response code will already have been sent to the client
             if (SimpleCometServlet.FAIL_ON_BEGIN.equals(initParam)) {
                 assertEquals("HTTP/1.1 500 Internal Server Error", response[0]);
-                alv.validateAccessLog(1, 500, 0, 1000);
+                alv.validateAccessLog(1, 500, 0, 1100);
             } else {
                 assertEquals("HTTP/1.1 200 OK", response[0]);
-                alv.validateAccessLog(1, 200, 0, 5000);
+                // 0.1s pre-PINGS, 4s PINGS, 1s processing, 1s margin of error
+                alv.validateAccessLog(1, 200, 0, 6100);
             }
 
         }
@@ -390,6 +392,9 @@ public class TestCometProcessor extends 
         @Override
         public void run() {
             try {
+                // Sleep to overcome apparent JVM bug where Poller sometimes
+                // fails to report bytes available to read.
+                Thread.sleep(100);
                 for (int i = 0; i < pingCount; i++) {
                     os.write("4\r\n".getBytes());
                     os.write("PING\r\n".getBytes());



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message