You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by re...@apache.org on 2009/04/21 06:18:40 UTC

svn commit: r766969 - in /harmony/enhanced/classlib/trunk/modules/luni/src/test/api: common/org/apache/harmony/luni/tests/java/net/ unix/org/apache/harmony/luni/tests/java/io/ windows/org/apache/harmony/luni/tests/java/io/

Author: regisxu
Date: Tue Apr 21 04:18:39 2009
New Revision: 766969

URL: http://svn.apache.org/viewvc?rev=766969&view=rev
Log:
Move  platform specific tests in SocketTest to platform test folders

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/java/io/UnixSocketTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/io/WinSocketTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketTest.java?rev=766969&r1=766968&r2=766969&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketTest.java Tue Apr 21 04:18:39 2009
@@ -499,19 +499,6 @@
         }
         theSocket.close();
 
-        // Now validate that we get a interrupted exception if we try to connect
-        // to an address on which nobody is accepting connections and the
-        // timeout expired
-        theSocket = new Socket();
-        try {
-            theSocket.connect(new InetSocketAddress(InetAddress.getLocalHost(),
-                    1), 200);
-            fail("No interrupted exception when connecting to address nobody listening on with short timeout 200");
-        } catch (SocketTimeoutException e) {
-            // Expected
-        }
-        theSocket.close();
-
         // Now validate that we get the right exception if we connect when we
         // are already connected
         server = new ServerSocket(0);
@@ -1092,12 +1079,6 @@
         pingClient.close();
         sinkServer.close();
 
-        // Regression test for HARMONY-2934
-        Socket socket = new Socket("127.0.0.1", 0, false);
-        OutputStream o = socket.getOutputStream();
-        o.write(1);
-        socket.close();
-
         // Regression test for HARMONY-873
         ServerSocket ss2 = new ServerSocket(0);
         Socket s = new Socket("127.0.0.1", ss2.getLocalPort());

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/java/io/UnixSocketTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/java/io/UnixSocketTest.java?rev=766969&r1=766968&r2=766969&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/java/io/UnixSocketTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/java/io/UnixSocketTest.java Tue Apr 21 04:18:39 2009
@@ -20,7 +20,9 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.net.ConnectException;
 import java.net.InetAddress;
+import java.net.InetSocketAddress;
 import java.net.ServerSocket;
 import java.net.Socket;
 import java.net.SocketException;
@@ -100,4 +102,31 @@
         pingServer.close();
     }
 
+    public void test_connectLjava_net_SocketAddressI() throws Exception {
+        // Now validate that we get a interrupted exception if we try to connect
+        // to an address on which nobody is accepting connections and the
+        // timeout expired
+        Socket theSocket = new Socket();
+        try {
+            theSocket.connect(new InetSocketAddress(InetAddress.getLocalHost(),
+                    1), 200);
+            fail("No interrupted exception when connecting to address nobody listening on with short timeout 200");
+        } catch (ConnectException e) {
+            // Expected
+        }
+        theSocket.close();
+    }
+
+    public void test_getOutputStream() throws Exception {
+        // Regression test for HARMONY-2934
+        Socket socket = new Socket("127.0.0.1", 0, false);
+        OutputStream o = socket.getOutputStream();
+        try {
+            o.write(1);
+        } catch (SocketException e) {
+            // expected
+        } finally {
+            socket.close();
+        }
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/io/WinSocketTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/io/WinSocketTest.java?rev=766969&r1=766968&r2=766969&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/io/WinSocketTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/io/WinSocketTest.java Tue Apr 21 04:18:39 2009
@@ -21,8 +21,10 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.InetAddress;
+import java.net.InetSocketAddress;
 import java.net.ServerSocket;
 import java.net.Socket;
+import java.net.SocketTimeoutException;
 
 import junit.framework.TestCase;
 
@@ -87,4 +89,27 @@
         pingClient.close();
         pingServer.close();
     }
+
+    public void test_connectLjava_net_SocketAddressI() throws Exception {
+        // Now validate that we get a interrupted exception if we try to connect
+        // to an address on which nobody is accepting connections and the
+        // timeout expired
+        Socket theSocket = new Socket();
+        try {
+            theSocket.connect(new InetSocketAddress(InetAddress.getLocalHost(),
+                    1), 200);
+            fail("No interrupted exception when connecting to address nobody listening on with short timeout 200");
+        } catch (SocketTimeoutException e) {
+            // Expected
+        }
+        theSocket.close();
+    }
+
+    public void test_getOutputStream() throws Exception {
+        // Regression test for HARMONY-2934
+        Socket socket = new Socket("127.0.0.1", 0, false);
+        OutputStream o = socket.getOutputStream();
+        o.write(1);
+        socket.close();
+    }
 }