harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r463668 - in /incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi: ConnectionTest.java DGCTest.java RegistryTest.java activation/StartupShutdownTest.java
Date Fri, 13 Oct 2006 12:39:21 GMT
Author: hindessm
Date: Fri Oct 13 05:39:20 2006
New Revision: 463668

URL: http://svn.apache.org/viewvc?view=rev&rev=463668
Log:
Leave exception handling to junit.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/ConnectionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/DGCTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/RegistryTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/activation/StartupShutdownTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/ConnectionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/ConnectionTest.java?view=diff&rev=463668&r1=463667&r2=463668
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/ConnectionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/ConnectionTest.java
Fri Oct 13 05:39:20 2006
@@ -155,10 +155,6 @@
             System.out.println("Expecting READY from server");
             server.expect();
             server.pipeInput();
-        } catch (Exception e) {
-            System.err.print("Unexpected exception in main thread: ");
-            e.printStackTrace();
-            fail("Unexpected exception in main thread: " + e);
         } finally {
             if (server != null) {
                 System.out.println("Destroying server");
@@ -379,12 +375,7 @@
             SubProcess.tellOut();
         } finally {
             System.err.println("Test server closing.");
-            try {
-                unexportObjects();
-            } catch (Exception e) {
-                System.err.print("Unexpected exception while unexporting: ");
-                e.printStackTrace();
-            }
+            unexportObjects();
         }
         System.err.println("Test server exiting.");
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/DGCTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/DGCTest.java?view=diff&rev=463668&r1=463667&r2=463668
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/DGCTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/DGCTest.java
Fri Oct 13 05:39:20 2006
@@ -186,9 +186,6 @@
 
             System.out.println("test0: waiting for server to return");
             assertEquals("Test server return", 0, server.waitFor());
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail("Unexpected exception: " + e);
         } finally {
             if (registry != null) {
                 registry.destroy();
@@ -226,9 +223,6 @@
             server.pipeError();
             server.closeOutput();
             assertEquals("Test server return", 0, server.waitFor());
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail("Unexpected exception: " + e);
         } finally {
             if (server != null) {
                 server.destroy();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/RegistryTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/RegistryTest.java?view=diff&rev=463668&r1=463667&r2=463668
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/RegistryTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/RegistryTest.java
Fri Oct 13 05:39:20 2006
@@ -71,22 +71,17 @@
      *          If some error occurs.
      */
     public void testBasic() throws Exception {
-        try {
-            System.setSecurityManager(new RMISecurityManager());
-
-            // Create registry.
-            int port = CUSTOM_PORT_1;
-            Registry reg = LocateRegistry.createRegistry(port);
-            System.out.println("Registry on CUSTOM port ("
-                    + port + ") created.");
+        System.setSecurityManager(new RMISecurityManager());
 
-            // Destroy registry.
-            UnicastRemoteObject.unexportObject(reg, true);
-            System.out.println("Test complete.");
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail("Unexpected exception: " + e);
-        }
+        // Create registry.
+        int port = CUSTOM_PORT_1;
+        Registry reg = LocateRegistry.createRegistry(port);
+        System.out.println("Registry on CUSTOM port ("
+                           + port + ") created.");
+
+        // Destroy registry.
+        UnicastRemoteObject.unexportObject(reg, true);
+        System.out.println("Test complete.");
     }
 
     /**
@@ -97,159 +92,150 @@
      */
     public void testDetailed() throws Exception {
         try {
-            try {
-                System.setSecurityManager(new RMISecurityManager());
+            System.setSecurityManager(new RMISecurityManager());
 
-                String localHost = InetAddress.getLocalHost().getHostName();
+            String localHost = InetAddress.getLocalHost().getHostName();
 
-                // Create registry.
-                int port = REGISTRY_PORT;
-                Registry reg = LocateRegistry.createRegistry(port);
-                System.out.println("Registry on DEFAULT port ("
-                        + port + ") created.");
-
-                Remote obj1 = new MyRemoteObject1("RemoteObject1");
-                exportedObjects.add(obj1);
-                Remote obj2 = new MyRemoteObject1("RemoteObject2");
-                exportedObjects.add(obj2);
-                Remote obj3 = new MyRemoteObject1("RemoteObject3");
-                exportedObjects.add(obj3);
-                Remote obj4 = new MyRemoteObject1("RemoteObject4");
-                exportedObjects.add(obj4);
-                Remote obj5 = new MyRemoteObject1("RemoteObject5");
-                exportedObjects.add(obj5);
-                Remote obj6 = new MyRemoteObject1("RemoteObject6");
-                exportedObjects.add(obj6);
-                Remote obj7 = new MyRemoteObject1("RemoteObject7");
-                exportedObjects.add(obj7);
-                Remote obj8 = new MyRemoteObject1("RemoteObject8");
-                exportedObjects.add(obj8);
-                System.out.println("Test objects exported.");
-
-                // Check bind.
-                System.out.println("Testing valid Naming.bind names...");
-                Naming.bind("rmi://" + localHost + ":1099/RemoteObject1", obj1);
-                Naming.bind("rmi://127.0.0.1:1099/RemoteObject2", obj2);
-                Naming.bind("//" + localHost + ":1099/RemoteObject3", obj3);
-                Naming.bind("//localhost:1099/RemoteObject4", obj4);
-                Naming.bind("//:1099/RemoteObject5", obj5);
-                Naming.bind("//:/RemoteObject6", obj6);
-                Naming.bind("//" + localHost + "/RemoteObject7", obj7);
-                Naming.bind("RemoteObject8", obj8);
-                System.out.println("Done:");
-                printArray(Naming.list(""));
-                System.out.println("Checking bind complete.");
-
-                // Check rebind.
-                System.out.println("Testing valid Naming.rebind names...");
-                Naming.rebind("rmi://" + localHost + ":1099/RemoteObject1", obj1);
-                Naming.rebind("rmi://127.0.0.1:1099/RemoteObject2", obj2);
-                Naming.rebind("//" + localHost + ":1099/RemoteObject3", obj3);
-                Naming.rebind("//localhost:1099/RemoteObject4", obj4);
-                Naming.rebind("//:1099/RemoteObject5", obj5);
-                Naming.rebind("//:/RemoteObject6", obj6);
-                Naming.rebind("//" + localHost + "/RemoteObject7", obj7);
-                Naming.rebind("RemoteObject8", obj8);
-                System.out.println("Done:");
-                printArray(Naming.list("//127.0.0.1:/"));
-                System.out.println("Checking rebind complete.");
-
-                // Check lookup.
-                System.out.println("Testing valid Naming.lookup names...");
-                System.out.println(Naming.lookup("rmi://" + localHost + ":1099/RemoteObject1"));
-                System.out.println(Naming.lookup("rmi://127.0.0.1:/RemoteObject2"));
-                System.out.println(Naming.lookup("//" + localHost + ":1099/RemoteObject3"));
-                System.out.println(Naming.lookup("//localhost:1099/RemoteObject4"));
-                System.out.println(Naming.lookup("//:1099/RemoteObject5"));
-                System.out.println(Naming.lookup("//:/RemoteObject6"));
-                System.out.println(Naming.lookup("//" + localHost + "/RemoteObject7"));
-                System.out.println(Naming.lookup("RemoteObject8"));
-                System.out.println("Done:");
-                printArray(Naming.list("rmi://" + localHost + ""));
-                System.out.println("Checking lookup complete.");
-
-                // Check unbind.
-                System.out.println("Testing valid Naming.unbind names...");
-                Naming.unbind("rmi://" + localHost + ":1099/RemoteObject1");
-                Naming.unbind("rmi://127.0.0.1:1099/RemoteObject2");
-                Naming.unbind("//" + localHost + ":1099/RemoteObject3");
-                Naming.unbind("//localhost:1099/RemoteObject4");
-                Naming.unbind("//:1099/RemoteObject5");
-                Naming.unbind("//:/RemoteObject6");
-                Naming.unbind("//" + localHost + "/RemoteObject7");
-                Naming.unbind("RemoteObject8");
-                System.out.println("Done:");
-                printArray(Naming.list("//localhost"));
-                System.out.println("Checking unbind complete.");
-
-                // Destroy registry.
-                UnicastRemoteObject.unexportObject(reg, true);
-
-                // Create registry.
-                port = CUSTOM_PORT_2;
-                reg = LocateRegistry.createRegistry(port);
-                System.out.println("Registry on CUSTOM port ("
-                        + port + ") created.");
-
-                // Check bind.
-                System.out.println("Testing valid Naming.bind names...");
-                Naming.bind("rmi://" + localHost + ':' + port + "/RemoteObject1", obj1);
-                Naming.bind("rmi://127.0.0.1:" + port + "/RemoteObject2", obj2);
-                Naming.bind("//" + localHost + ':' + port + "/RemoteObject3", obj3);
-                Naming.bind("//localhost:" + port + "/RemoteObject4", obj4);
-                Naming.bind("//:" + port + "/RemoteObject5", obj5);
-                System.out.println("Done:");
-                printArray(Naming.list("//localhost:" + port));
-                System.out.println("Checking bind complete.");
-
-                // Check rebind.
-                System.out.println("Testing valid Naming.rebind names...");
-                Naming.rebind("rmi://" + localHost + ':' + port + "/RemoteObject1", obj1);
-                Naming.rebind("rmi://127.0.0.1:" + port + "/RemoteObject2", obj2);
-                Naming.rebind("//" + localHost + ':' + port + "/RemoteObject3", obj3);
-                Naming.rebind("//localhost:" + port + "/RemoteObject4", obj4);
-                Naming.rebind("//:" + port + "/RemoteObject5", obj5);
-                System.out.println("Done:");
-                printArray(Naming.list("//127.0.0.1:" + port + "/"));
-                System.out.println("Checking rebind complete.");
-
-                // Check lookup.
-                System.out.println("Testing valid Naming.lookup names...");
-                System.out.println(Naming.lookup("rmi://" + localHost + ':' + port + "/RemoteObject1"));
-                System.out.println(Naming.lookup("rmi://127.0.0.1:" + port + "/RemoteObject2"));
-                System.out.println(Naming.lookup("//" + localHost + ':' + port + "/RemoteObject3"));
-                System.out.println(Naming.lookup("//localhost:" + port + "/RemoteObject4"));
-                System.out.println(Naming.lookup("//:" + port + "/RemoteObject5"));
-                System.out.println("Done:");
-                printArray(Naming.list("rmi://:" + port));
-                System.out.println("Checking lookup complete.");
-
-                // Check unbind.
-                System.out.println("Testing valid Naming.unbind names...");
-                Naming.unbind("rmi://" + localHost + ':' + port + "/RemoteObject1");
-                Naming.unbind("rmi://127.0.0.1:" + port + "/RemoteObject2");
-                Naming.unbind("//" + localHost + ':' + port + "/RemoteObject3");
-                Naming.unbind("//localhost:" + port + "/RemoteObject4");
-                Naming.unbind("//:" + port + "/RemoteObject5");
-                System.out.println("Done:");
-                printArray(Naming.list("//localhost:" + port));
-                System.out.println("Checking unbind complete.");
-
-                // Destroy registry.
-                UnicastRemoteObject.unexportObject(reg, true);
-            } finally {
-                System.out.println("Unexporting objects");
-                try {
-                    unexportObjects();
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-            }
-            System.out.println("Test complete.");
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail("Unexpected exception: " + e);
+            // Create registry.
+            int port = REGISTRY_PORT;
+            Registry reg = LocateRegistry.createRegistry(port);
+            System.out.println("Registry on DEFAULT port ("
+                               + port + ") created.");
+
+            Remote obj1 = new MyRemoteObject1("RemoteObject1");
+            exportedObjects.add(obj1);
+            Remote obj2 = new MyRemoteObject1("RemoteObject2");
+            exportedObjects.add(obj2);
+            Remote obj3 = new MyRemoteObject1("RemoteObject3");
+            exportedObjects.add(obj3);
+            Remote obj4 = new MyRemoteObject1("RemoteObject4");
+            exportedObjects.add(obj4);
+            Remote obj5 = new MyRemoteObject1("RemoteObject5");
+            exportedObjects.add(obj5);
+            Remote obj6 = new MyRemoteObject1("RemoteObject6");
+            exportedObjects.add(obj6);
+            Remote obj7 = new MyRemoteObject1("RemoteObject7");
+            exportedObjects.add(obj7);
+            Remote obj8 = new MyRemoteObject1("RemoteObject8");
+            exportedObjects.add(obj8);
+            System.out.println("Test objects exported.");
+
+            // Check bind.
+            System.out.println("Testing valid Naming.bind names...");
+            Naming.bind("rmi://" + localHost + ":1099/RemoteObject1", obj1);
+            Naming.bind("rmi://127.0.0.1:1099/RemoteObject2", obj2);
+            Naming.bind("//" + localHost + ":1099/RemoteObject3", obj3);
+            Naming.bind("//localhost:1099/RemoteObject4", obj4);
+            Naming.bind("//:1099/RemoteObject5", obj5);
+            Naming.bind("//:/RemoteObject6", obj6);
+            Naming.bind("//" + localHost + "/RemoteObject7", obj7);
+            Naming.bind("RemoteObject8", obj8);
+            System.out.println("Done:");
+            printArray(Naming.list(""));
+            System.out.println("Checking bind complete.");
+
+            // Check rebind.
+            System.out.println("Testing valid Naming.rebind names...");
+            Naming.rebind("rmi://" + localHost + ":1099/RemoteObject1", obj1);
+            Naming.rebind("rmi://127.0.0.1:1099/RemoteObject2", obj2);
+            Naming.rebind("//" + localHost + ":1099/RemoteObject3", obj3);
+            Naming.rebind("//localhost:1099/RemoteObject4", obj4);
+            Naming.rebind("//:1099/RemoteObject5", obj5);
+            Naming.rebind("//:/RemoteObject6", obj6);
+            Naming.rebind("//" + localHost + "/RemoteObject7", obj7);
+            Naming.rebind("RemoteObject8", obj8);
+            System.out.println("Done:");
+            printArray(Naming.list("//127.0.0.1:/"));
+            System.out.println("Checking rebind complete.");
+
+            // Check lookup.
+            System.out.println("Testing valid Naming.lookup names...");
+            System.out.println(Naming.lookup("rmi://" + localHost + ":1099/RemoteObject1"));
+            System.out.println(Naming.lookup("rmi://127.0.0.1:/RemoteObject2"));
+            System.out.println(Naming.lookup("//" + localHost + ":1099/RemoteObject3"));
+            System.out.println(Naming.lookup("//localhost:1099/RemoteObject4"));
+            System.out.println(Naming.lookup("//:1099/RemoteObject5"));
+            System.out.println(Naming.lookup("//:/RemoteObject6"));
+            System.out.println(Naming.lookup("//" + localHost + "/RemoteObject7"));
+            System.out.println(Naming.lookup("RemoteObject8"));
+            System.out.println("Done:");
+            printArray(Naming.list("rmi://" + localHost + ""));
+            System.out.println("Checking lookup complete.");
+
+            // Check unbind.
+            System.out.println("Testing valid Naming.unbind names...");
+            Naming.unbind("rmi://" + localHost + ":1099/RemoteObject1");
+            Naming.unbind("rmi://127.0.0.1:1099/RemoteObject2");
+            Naming.unbind("//" + localHost + ":1099/RemoteObject3");
+            Naming.unbind("//localhost:1099/RemoteObject4");
+            Naming.unbind("//:1099/RemoteObject5");
+            Naming.unbind("//:/RemoteObject6");
+            Naming.unbind("//" + localHost + "/RemoteObject7");
+            Naming.unbind("RemoteObject8");
+            System.out.println("Done:");
+            printArray(Naming.list("//localhost"));
+            System.out.println("Checking unbind complete.");
+
+            // Destroy registry.
+            UnicastRemoteObject.unexportObject(reg, true);
+
+            // Create registry.
+            port = CUSTOM_PORT_2;
+            reg = LocateRegistry.createRegistry(port);
+            System.out.println("Registry on CUSTOM port ("
+                               + port + ") created.");
+
+            // Check bind.
+            System.out.println("Testing valid Naming.bind names...");
+            Naming.bind("rmi://" + localHost + ':' + port + "/RemoteObject1", obj1);
+            Naming.bind("rmi://127.0.0.1:" + port + "/RemoteObject2", obj2);
+            Naming.bind("//" + localHost + ':' + port + "/RemoteObject3", obj3);
+            Naming.bind("//localhost:" + port + "/RemoteObject4", obj4);
+            Naming.bind("//:" + port + "/RemoteObject5", obj5);
+            System.out.println("Done:");
+            printArray(Naming.list("//localhost:" + port));
+            System.out.println("Checking bind complete.");
+
+            // Check rebind.
+            System.out.println("Testing valid Naming.rebind names...");
+            Naming.rebind("rmi://" + localHost + ':' + port + "/RemoteObject1", obj1);
+            Naming.rebind("rmi://127.0.0.1:" + port + "/RemoteObject2", obj2);
+            Naming.rebind("//" + localHost + ':' + port + "/RemoteObject3", obj3);
+            Naming.rebind("//localhost:" + port + "/RemoteObject4", obj4);
+            Naming.rebind("//:" + port + "/RemoteObject5", obj5);
+            System.out.println("Done:");
+            printArray(Naming.list("//127.0.0.1:" + port + "/"));
+            System.out.println("Checking rebind complete.");
+
+            // Check lookup.
+            System.out.println("Testing valid Naming.lookup names...");
+            System.out.println(Naming.lookup("rmi://" + localHost + ':' + port + "/RemoteObject1"));
+            System.out.println(Naming.lookup("rmi://127.0.0.1:" + port + "/RemoteObject2"));
+            System.out.println(Naming.lookup("//" + localHost + ':' + port + "/RemoteObject3"));
+            System.out.println(Naming.lookup("//localhost:" + port + "/RemoteObject4"));
+            System.out.println(Naming.lookup("//:" + port + "/RemoteObject5"));
+            System.out.println("Done:");
+            printArray(Naming.list("rmi://:" + port));
+            System.out.println("Checking lookup complete.");
+
+            // Check unbind.
+            System.out.println("Testing valid Naming.unbind names...");
+            Naming.unbind("rmi://" + localHost + ':' + port + "/RemoteObject1");
+            Naming.unbind("rmi://127.0.0.1:" + port + "/RemoteObject2");
+            Naming.unbind("//" + localHost + ':' + port + "/RemoteObject3");
+            Naming.unbind("//localhost:" + port + "/RemoteObject4");
+            Naming.unbind("//:" + port + "/RemoteObject5");
+            System.out.println("Done:");
+            printArray(Naming.list("//localhost:" + port));
+            System.out.println("Checking unbind complete.");
+
+            // Destroy registry.
+            UnicastRemoteObject.unexportObject(reg, true);
+        } finally {
+            System.out.println("Unexporting objects");
+            unexportObjects();
         }
+        System.out.println("Test complete.");
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/activation/StartupShutdownTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/activation/StartupShutdownTest.java?view=diff&rev=463668&r1=463667&r2=463668
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/activation/StartupShutdownTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/activation/StartupShutdownTest.java
Fri Oct 13 05:39:20 2006
@@ -43,21 +43,15 @@
     SubProcess rmiregistry;
 
     public void testStartup() throws Exception {
-        try {
-            rmid = JavaInvoker.invokeSimilar((String[]) null,
-                    "org.apache.harmony.rmi.activation.Rmid",
-                    (String[]) null, true, true);
-            rmid.pipeError();
-            rmid.pipeInput();
-            rmid.closeOutput();
-            Thread.sleep(5000);
-            ActivationSystem as = ActivationGroup.getSystem();
+        rmid = JavaInvoker.invokeSimilar((String[]) null,
+                "org.apache.harmony.rmi.activation.Rmid",
+                (String[]) null, true, true);
+        rmid.pipeError();
+        rmid.pipeInput();
+        rmid.closeOutput();
+        Thread.sleep(5000);
+        ActivationSystem as = ActivationGroup.getSystem();
 
-            rmid.destroy();
-        } catch (Throwable t) {
-            System.out.println("Unexpected exception: " + t);
-            t.printStackTrace();
-            fail("Unexpected exception: " + t);
-        }
+        rmid.destroy();
     }
 }



Mime
View raw message