Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 41771 invoked from network); 6 Jul 2010 10:28:20 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 6 Jul 2010 10:28:20 -0000 Received: (qmail 96911 invoked by uid 500); 6 Jul 2010 10:28:20 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 96814 invoked by uid 500); 6 Jul 2010 10:28:18 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 96807 invoked by uid 99); 6 Jul 2010 10:28:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Jul 2010 10:28:16 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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, 06 Jul 2010 10:28:14 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E181623889E0; Tue, 6 Jul 2010 10:26:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r960862 - /harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java Date: Tue, 06 Jul 2010 10:26:50 -0000 To: commits@harmony.apache.org From: tellison@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100706102650.E181623889E0@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tellison Date: Tue Jul 6 10:26:50 2010 New Revision: 960862 URL: http://svn.apache.org/viewvc?rev=960862&view=rev Log: Make the NIO socket channel tests a bit more robust by ensuring the reader drains the channel before asserting the content. Modified: harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java Modified: harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java?rev=960862&r1=960861&r2=960862&view=diff ============================================================================== --- harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java (original) +++ harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java Tue Jul 6 10:26:50 2010 @@ -2782,15 +2782,15 @@ public class SocketChannelTest extends T // Write them out, read what we wrote and check it client.write(buffers); + client.close(); ByteBuffer readBuffer = ByteBuffer.allocate(1024); - worker.read(readBuffer); + while (EOF != worker.read(readBuffer)) {}; readBuffer.flip(); Buffer expected = ByteBuffer.allocate(1024).put(data).put(data).flip(); assertEquals(expected, readBuffer); // Tidy-up worker.close(); - client.close(); server.close(); } @@ -2824,14 +2824,14 @@ public class SocketChannelTest extends T // Write them out, read what we wrote and check it client.write(buffers); + client.close(); ByteBuffer readBuffer = ByteBuffer.allocate(1024); - worker.read(readBuffer); + while (EOF != worker.read(readBuffer)) {}; readBuffer.flip(); assertEquals(ByteBuffer.wrap(data), readBuffer); // Tidy-up worker.close(); - client.close(); server.close(); } @@ -2864,16 +2864,16 @@ public class SocketChannelTest extends T client.write(buffers, 0, 2); // writes "world!" assertEquals("Failed to drain buffer 1", 0, buffers[1].remaining()); client.write(buffers, 0, 3); // write nothing + client.close(); // Read what we wrote and check it ByteBuffer readBuffer = ByteBuffer.allocate(1024); - worker.read(readBuffer); + while (EOF != worker.read(readBuffer)) {}; readBuffer.flip(); assertEquals(ByteBuffer.wrap(data), readBuffer); // Tidy-up worker.close(); - client.close(); server.close(); }