harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r985568 - in /harmony/enhanced/java/branches/java6: ./ classlib/ classlib/depends/libs/ classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/ServerSocketChannelTest.java drlvm/ jdktools/
Date Sat, 14 Aug 2010 19:15:44 GMT
Author: hindessm
Date: Sat Aug 14 19:15:43 2010
New Revision: 985568

URL: http://svn.apache.org/viewvc?rev=985568&view=rev
Log:
Merge change from /harmony/enhanced/java/trunk@985141:

  r985141 | odeakin | 2010-08-13 10:22:49 +0100 (Fri, 13 Aug 2010) | 1 line
  
  Commit partial patch for HARMONY-6621 ([classlib][nio] Minor testcase improvements to ServerSocketChannelTest
and SocketChannelTest)


Modified:
    harmony/enhanced/java/branches/java6/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/depends/libs/   (props changed)
    harmony/enhanced/java/branches/java6/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/ServerSocketChannelTest.java
    harmony/enhanced/java/branches/java6/drlvm/   (props changed)
    harmony/enhanced/java/branches/java6/jdktools/   (props changed)

Propchange: harmony/enhanced/java/branches/java6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Aug 14 19:15:43 2010
@@ -1,4 +1,4 @@
 /harmony/enhanced/java/branches/mrh:935751-941490
-/harmony/enhanced/java/trunk:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763,981811,981820,982146,982148,982183,982250,982377,982498,982614,982650,982777,982887,983879,983902,984367,984577,984597-984598,984613,984682,984708,984731,984779,984784,984798,985098
+/harmony/enhanced/java/trunk:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763,981811,981820,982146,982148,982183,982250,982377,982498,982614,982650,982777,982887,983879,983902,984367,984577,984597-984598,984613,984682,984708,984731,984779,984784,984798,985098,985141
 /harmony/enhanced/trunk:476395-929252
 /incubator/harmony/enhanced/trunk:292550-476394

Propchange: harmony/enhanced/java/branches/java6/classlib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Aug 14 19:15:43 2010
@@ -1,7 +1,7 @@
 /harmony/enhanced/classlib/trunk:713674-735919,765923-926091,926318-926838
 /harmony/enhanced/classlib/trunk/working_classlib:884014-884286
 /harmony/enhanced/java/branches/mrh/classlib:935751-941490
-/harmony/enhanced/java/trunk/classlib:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763,981811,981820,982146,982148,982183,982250,982377,982498,982614,982650,982777,982887,983879,983902,984367,984577,984597-984598,984613,984682,984708,984731,984779,984784,984798,985098
+/harmony/enhanced/java/trunk/classlib:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763,981811,981820,982146,982148,982183,982250,982377,982498,982614,982650,982777,982887,983879,983902,984367,984577,984597-984598,984613,984682,984708,984731,984779,984784,984798,985098,985141
 /harmony/enhanced/trunk/classlib:476395-929252
 /harmony/enhanced/trunk/working_classlib:476396-920147
 /incubator/harmony/enhanced/trunk/classlib:292550-476394

Propchange: harmony/enhanced/java/branches/java6/classlib/depends/libs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Aug 14 19:15:43 2010
@@ -1,4 +1,4 @@
 /harmony/enhanced/classlib/trunk/depends/libs:544451-926091
-/harmony/enhanced/java/trunk/classlib/depends/libs:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763,981811,981820,982146,982148,982183,982250,982377,982498,982614,982650,982777,982887,983879,983902,984367,984577,984597-984598,984613,984682,984708,984731,984779,984784,984798,985098
+/harmony/enhanced/java/trunk/classlib/depends/libs:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763,981811,981820,982146,982148,982183,982250,982377,982498,982614,982650,982777,982887,983879,983902,984367,984577,984597-984598,984613,984682,984708,984731,984779,984784,984798,985098,985141
 /harmony/enhanced/trunk/classlib/depends/libs:476395-929252
 /incubator/harmony/enhanced/trunk/classlib/depends/libs:292550-476394

Modified: harmony/enhanced/java/branches/java6/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/ServerSocketChannelTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/ServerSocketChannelTest.java?rev=985568&r1=985567&r2=985568&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/ServerSocketChannelTest.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/ServerSocketChannelTest.java
Sat Aug 14 19:15:43 2010
@@ -369,10 +369,11 @@ public class ServerSocketChannelTest ext
     }
     
     /**
+     * @throws InterruptedException 
      * @tests ServerSocketChannel#accept().socket()
      */
     public void test_read_LByteBuffer_Blocking_ReadWriteRealLargeData()
-            throws IOException {
+            throws IOException, InterruptedException {
         serverChannel.socket().bind(localAddr1);
         ByteBuffer buf = ByteBuffer.allocate(CAPACITY_64KB);
         for (int i = 0; i < CAPACITY_64KB; i++) {
@@ -380,13 +381,38 @@ public class ServerSocketChannelTest ext
         }
         buf.flip();
         clientChannel.connect(localAddr1);
-        clientChannel.write(buf);
-        clientChannel.close();
+        WriteChannelThread writeThread = new WriteChannelThread(clientChannel, buf);
+        writeThread.start();
         Socket socket = serverChannel.accept().socket();
         InputStream in = socket.getInputStream();
         assertReadResult(in,CAPACITY_64KB);
+        writeThread.join();
+        // check if the thread threw any exceptions
+        if (writeThread.exception != null) {
+            throw writeThread.exception;
+        }
     }
 
+    class WriteChannelThread extends Thread {
+        SocketChannel channel;
+        ByteBuffer buffer;
+        IOException exception;
+        
+        public WriteChannelThread(SocketChannel channel, ByteBuffer buffer) {
+            this.channel = channel;
+            this.buffer = buffer;
+        }
+        
+        public void run() {
+            try {
+                channel.write(buffer);
+                channel.close();
+            } catch (IOException e) {
+                exception = e;
+            }
+        }
+    }
+    
     /**
      * @tests ServerSocketChannel#accept().socket()
      */
@@ -400,11 +426,16 @@ public class ServerSocketChannelTest ext
         }
         buf.flip();
         clientChannel.connect(localAddr1);
-        clientChannel.write(buf);
-        clientChannel.close();
+        WriteChannelThread writeThread = new WriteChannelThread(clientChannel, buf);
+        writeThread.start();
         Socket socket = serverChannel.accept().socket();
         InputStream in = socket.getInputStream();
         assertReadResult(in,CAPACITY_64KB);
+        writeThread.join();
+        // check if the thread threw any exceptions
+        if (writeThread.exception != null) {
+            throw writeThread.exception;
+        }
     }
     
     /**
@@ -420,10 +451,35 @@ public class ServerSocketChannelTest ext
         }
         clientChannel.connect(localAddr1); 
         Socket socket = serverChannel.accept().socket();
-        OutputStream out = socket.getOutputStream();
-        out.write(writeContent);
-        socket.close();
+        WriteSocketThread writeThread = new WriteSocketThread(socket, writeContent);
+        writeThread.start();
         assertWriteResult(CAPACITY_64KB);
+        writeThread.join();
+        // check if the thread threw any exceptions
+        if (writeThread.exception != null) {
+            throw writeThread.exception;
+        }
+    }
+    
+    class WriteSocketThread extends Thread {
+        Socket socket;
+        byte[] buffer;
+        IOException exception;
+        
+        public WriteSocketThread(Socket socket, byte[] buffer) {
+            this.socket = socket;
+            this.buffer = buffer;
+        }
+        
+        public void run() {
+            try {
+                OutputStream out = socket.getOutputStream();
+                out.write(buffer);
+                socket.close();
+            } catch (IOException e) {
+                exception = e;
+            }
+        }
     }
     
     /**
@@ -438,10 +494,14 @@ public class ServerSocketChannelTest ext
         }
         clientChannel.connect(localAddr1); 
         Socket socket = serverChannel.accept().socket();
-        OutputStream out = socket.getOutputStream();
-        out.write(writeContent);
-        socket.close();
+        WriteSocketThread writeThread = new WriteSocketThread(socket, writeContent);
+        writeThread.start();
         assertWriteResult(CAPACITY_64KB);
+        writeThread.join();
+        // check if the thread threw any exceptions
+        if (writeThread.exception != null) {
+            throw writeThread.exception;
+        }
     }
     
     /**

Propchange: harmony/enhanced/java/branches/java6/drlvm/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Aug 14 19:15:43 2010
@@ -1,5 +1,5 @@
 /harmony/enhanced/java/branches/mrh/drlvm:935751-941490
-/harmony/enhanced/java/trunk/drlvm:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763,981811,981820,982146,982148,982183,982250,982377,982498,982614,982650,982777,982887,983879,983902,984367,984577,984597-984598,984613,984682,984708,984731,984779,984784,984798,985098
+/harmony/enhanced/java/trunk/drlvm:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763,981811,981820,982146,982148,982183,982250,982377,982498,982614,982650,982777,982887,983879,983902,984367,984577,984597-984598,984613,984682,984708,984731,984779,984784,984798,985098,985141
 /harmony/enhanced/trunk/drlvm:476395-929252
 /harmony/enhanced/trunk/working_vm:476396-920147
 /incubator/harmony/enhanced/trunk/drlvm:292550-476394

Propchange: harmony/enhanced/java/branches/java6/jdktools/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Aug 14 19:15:43 2010
@@ -1,4 +1,4 @@
-/harmony/enhanced/java/trunk/jdktools:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763,981811,981820,982146,982148,982183,982250,982377,982498,982614,982650,982777,982887,983879,983902,984367,984577,984597-984598,984613,984682,984708,984731,984779,984784,984798,985098
+/harmony/enhanced/java/trunk/jdktools:929253-979569,979593,979613,979615,979647,979659,979682,979897,980326,980632,981356,981763,981811,981820,982146,982148,982183,982250,982377,982498,982614,982650,982777,982887,983879,983902,984367,984577,984597-984598,984613,984682,984708,984731,984779,984784,984798,985098,985141
 /harmony/enhanced/jdktools/trunk:630107-925933
 /harmony/enhanced/trunk/jdktools:476395-929252
 /harmony/enhanced/trunk/working_jdktools:476396-920147



Mime
View raw message