harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ghar...@apache.org
Subject svn commit: r413727 - /incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/org/apache/harmony/tests/java/nio/channels/SinkChannelTest.java
Date Mon, 12 Jun 2006 19:17:12 GMT
Author: gharley
Date: Mon Jun 12 12:17:12 2006
New Revision: 413727

URL: http://svn.apache.org/viewvc?rev=413727&view=rev
Log:
Another attempt at fixing the unstable (on Linux) unit test. Ensure we have read off all of
the expected
bytes before testing with JUnit assert. 

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/org/apache/harmony/tests/java/nio/channels/SinkChannelTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/org/apache/harmony/tests/java/nio/channels/SinkChannelTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/org/apache/harmony/tests/java/nio/channels/SinkChannelTest.java?rev=413727&r1=413726&r2=413727&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/org/apache/harmony/tests/java/nio/channels/SinkChannelTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/org/apache/harmony/tests/java/nio/channels/SinkChannelTest.java
Mon Jun 12 12:17:12 2006
@@ -125,13 +125,21 @@
             thread[i].join();
         }
         ByteBuffer readBuf = ByteBuffer.allocate(THREAD_NUM * BUFFER_SIZE);
-        long readVal = source.read(readBuf);
+        
+        long totalCount = 0;
+        do {
+            long count = source.read(readBuf);
+            if (count < 0) {
+                break;
+            }
+            totalCount += count;
+        } while (totalCount != (THREAD_NUM * BUFFER_SIZE));
+        
         StringBuffer buf = new StringBuffer();
         for (int i = 0; i < THREAD_NUM; i++) {
             buf.append("bytes");
         }
         String readString = buf.toString();
-        assertEquals(readString.length(), readVal);
         assertEquals(readString, new String(readBuf.array(), ISO8859_1));
 	}
 



Mime
View raw message