harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From regi...@apache.org
Subject svn commit: r1002488 - in /harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi: server/ tests/java/rmi/activation/ tests/java/rmi/dgc/ tests/javax/activity/
Date Wed, 29 Sep 2010 06:33:53 GMT
Author: regisxu
Date: Wed Sep 29 06:33:52 2010
New Revision: 1002488

URL: http://svn.apache.org/viewvc?rev=1002488&view=rev
Log:
Apply patches for HARMONY-6657: A batch of testcases to increase rmi module test coverage

Added:
    harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMISocketFactoryTest.java   (with props)
    harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteObjectTest.java   (with props)
    harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteServerTest.java   (with props)
    harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteStubTest.java   (with props)
    harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/activation/ActivationGroupIDTest.java   (with props)
    harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/dgc/
    harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/dgc/LeaseTest.java   (with props)
    harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/dgc/VMIDTest.java   (with props)
    harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/
    harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/ActivityCompletedExceptionTest.java   (with props)
    harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/ActivityRequiredExceptionTest.java   (with props)
    harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/InvalidActivityExceptionTest.java   (with props)
Modified:
    harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/LogStreamTest.java
    harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMIClassLoaderTest.java
    harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerNotActiveExceptionTest.java

Modified: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/LogStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/LogStreamTest.java?rev=1002488&r1=1002487&r2=1002488&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/LogStreamTest.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/LogStreamTest.java Wed Sep 29 06:33:52 2010
@@ -18,8 +18,10 @@
 package org.apache.harmony.rmi.server;
 
 import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
 import java.io.PrintStream;
 import java.rmi.server.LogStream;
+
 import junit.framework.TestCase;
 
 public class LogStreamTest extends TestCase {
@@ -27,13 +29,13 @@ public class LogStreamTest extends TestC
      * Test for java.rmi.server.LogStream.write(int b)
      */
     public void testWriteI() throws Exception {
-        //regression test for HARMONY-1271
-        LogStream.log("tst").write((int)'\n');
+        // regression test for HARMONY-1271
+        LogStream.log("tst").write((int) '\n');
 
-        //regression test for HARMONY-994
+        // regression test for HARMONY-994
         LogStream.log("tst").write(0);
     }
-    
+
     public void testSetOutputStreamBad() throws Exception {
         // Regression test HARMONY-1198
         try {
@@ -46,41 +48,54 @@ public class LogStreamTest extends TestC
     }
 
     /**
-     * Test for java.rmi.server.LogStream.write(byte[], int, int)
-     * testing invalid offsets/lengths. 
+     * Test for java.rmi.server.LogStream.write(byte[], int, int) testing
+     * invalid offsets/lengths.
      */
     public void testWriteArrInvalidOffLen() throws Exception {
         // Regression test for HARMONY-1691
         // list of invalid offsets/lengths pairs
-        int[][] invalidPairs = new int[][] {
-            { -2, 1 },
-            { 0, -6 },
-            { 6, 1 },
-            { 0, 6 } };
+        int[][] invalidPairs = new int[][] { { -2, 1 }, { 0, -6 }, { 6, 1 },
+                { 0, 6 } };
 
         // store original default stream for LogStream
         PrintStream prevOut = LogStream.getDefaultStream();
 
         try {
             // set empty default stream to not print garbage to System.out/err
-            LogStream.setDefaultStream(
-                    new PrintStream(new ByteArrayOutputStream()));
+            LogStream.setDefaultStream(new PrintStream(
+                    new ByteArrayOutputStream()));
             LogStream ls = LogStream.log("test");
 
             for (int i = 0; i < invalidPairs.length; ++i) {
                 try {
-                    ls.write(new byte[] { 1, 1 },
-                            invalidPairs[i][0], invalidPairs[i][1]);
+                    ls.write(new byte[] { 1, 1 }, invalidPairs[i][0],
+                            invalidPairs[i][1]);
                     fail("IndexOutOfBoundsException "
                             + "is not thrown when off = " + invalidPairs[i][0]
                             + ", len = " + invalidPairs[i][1]);
                 } catch (IndexOutOfBoundsException e) {
-                    //expected
+                    // expected
                 }
             }
         } finally {
             // restore original stream
             LogStream.setDefaultStream(prevOut);
         }
+
+    }
+
+    public void testParseLevel() {
+        assertEquals(LogStream.parseLevel("BRIEF"), LogStream.BRIEF);
+        assertEquals(LogStream.parseLevel("SILENT"), LogStream.SILENT);
+        assertEquals(LogStream.parseLevel("VERBOSE"), LogStream.VERBOSE);
     }
+
+    public void testGetOutputStream() {
+        LogStream log = LogStream.log("abc");
+        OutputStream output = log.getOutputStream();
+        PrintStream defaultPrintStream = LogStream.getDefaultStream();
+
+        assertEquals(output.toString(), defaultPrintStream.toString());
+    }
+
 }

Modified: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMIClassLoaderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMIClassLoaderTest.java?rev=1002488&r1=1002487&r2=1002488&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMIClassLoaderTest.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMIClassLoaderTest.java Wed Sep 29 06:33:52 2010
@@ -19,10 +19,13 @@
 package org.apache.harmony.rmi.server;
 
 import java.net.MalformedURLException;
+import java.net.URI;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.rmi.server.RMIClassLoader;
+import java.rmi.server.RMIClassLoaderSpi;
 import java.security.Permission;
+
 import junit.framework.TestCase;
 
 public class RMIClassLoaderTest extends TestCase {
@@ -52,8 +55,8 @@ public class RMIClassLoaderTest extends 
              * to be sure this path will be the first after sorting
              */
             "/_fake.jar" };
-            Class<?> c = RMIClassLoader.loadClass("file://" + paths[0] + " file://" + paths[1],
-                    "TestClass", null);
+            Class<?> c = RMIClassLoader.loadClass("file://" + paths[0]
+                    + " file://" + paths[1], "TestClass", null);
             ClassLoader cl = c.getClassLoader();
             if (cl instanceof URLClassLoader) {
                 URL[] urls = ((URLClassLoader) cl).getURLs();
@@ -63,8 +66,8 @@ public class RMIClassLoaderTest extends 
                 String failStr = "";
                 for (int i = 0; i < urls.length; ++i) {
                     if (!urls[i].getPath().equals(paths[i])) {
-                        failStr += "\nURL[" + i + "].getPath() = " + urls[i].getPath()
-                                + ", expected: " + paths[i];
+                        failStr += "\nURL[" + i + "].getPath() = "
+                                + urls[i].getPath() + ", expected: " + paths[i];
                     }
                 }
                 if (!failStr.equals("")) {
@@ -80,59 +83,266 @@ public class RMIClassLoaderTest extends 
     }
 
     /**
-      * Test for java.rmi.server.RMIClassLoader.loadProxyClass(String, String[], ClassLoader)
-      * testing invalid url as a codebase.
-      */
+     * Test for java.rmi.server.RMIClassLoader.loadProxyClass(String, String[],
+     * ClassLoader) testing invalid url as a codebase.
+     */
     public void testLoadProxyClassInvalidCodebase() throws Exception {
-        //Regression for HARMONY-1133
+        // Regression for HARMONY-1133
         SecurityManager previous = System.getSecurityManager();
         System.setSecurityManager(null);
-        
+
         try {
             RMIClassLoader.loadProxyClass("zzz", new String[] {}, null);
             fail("MalformedURLException expected");
-        } catch (MalformedURLException e) { 
-            //expected 
+        } catch (MalformedURLException e) {
+            // expected
         } finally {
-            System.setSecurityManager(previous);            
+            System.setSecurityManager(previous);
         }
     }
 
     /**
-     * Test for java.rmi.server.RMIClassLoader.loadClass(String, String)
-     * testing invalid url as a codebase.
+     * Test for java.rmi.server.RMIClassLoader.loadClass(String, String) testing
+     * invalid url as a codebase.
      */
     public void testLoadClassInvalidCodebase() throws Exception {
-        //Regression for HARMONY-1133
+        // Regression for HARMONY-1133
         SecurityManager previous = System.getSecurityManager();
         System.setSecurityManager(null);
-        
-        try { 
+
+        try {
             RMIClassLoader.loadClass("zzz", "a123");
             fail("MalformedURLException expected");
-        } catch (MalformedURLException e) { 
-            //expected 
+        } catch (MalformedURLException e) {
+            // expected
         } finally {
-            System.setSecurityManager(previous);            
-        } 
+            System.setSecurityManager(previous);
+        }
     }
 
     /**
-     * Test for java.rmi.server.RMIClassLoader.getClassLoader(String)
-     * testing invalid url as a codebase.
+     * Test for java.rmi.server.RMIClassLoader.getClassLoader(String) testing
+     * invalid url as a codebase.
      */
     public void testGetClassLoaderInvalidCodebase() throws Exception {
-        //Regression for HARMONY-1134
+        // Regression for HARMONY-1134
         SecurityManager previous = System.getSecurityManager();
         System.setSecurityManager(null);
 
-        try { 
+        try {
             RMIClassLoader.getClassLoader("zzz");
             fail("MalformedURLException expected");
-        } catch (MalformedURLException e) { 
-            //expected 
+        } catch (MalformedURLException e) {
+            // expected
+        } finally {
+            System.setSecurityManager(previous);
+        }
+    }
+
+    /**
+     * Modify the above method to test loadClass, loadClass(String, String) for
+     * coverage.
+     */
+    public void testLoadClassCodebaseOrder2() throws Exception {
+        SecurityManager previous = System.getSecurityManager();
+        System.setSecurityManager(new SecurityManager() {
+            @Override
+            public void checkPermission(Permission perm) {
+                /*
+                 * Override checkPermission to allow everything. Specifically,
+                 * we want to allow the SecurityManager to be set to null at the
+                 * end of the test and we want to allow the 'testClass.jar' file
+                 * to be allowed to load.
+                 */
+                return;
+            }
+        });
+        try {
+            URL testJarURL = getClass().getResource("testClass.jar");
+            String[] paths = new String[] { testJarURL.getPath(),
+            /*
+             * to be sure this path will be the first after sorting
+             */
+            "/_fake.jar" };
+            Class<?> c = RMIClassLoader.loadClass("file://" + paths[0]
+                    + " file://" + paths[1], "TestClass");
+            ClassLoader cl = c.getClassLoader();
+            if (cl instanceof URLClassLoader) {
+                URL[] urls = ((URLClassLoader) cl).getURLs();
+                if (urls.length != 2) {
+                    fail("Unexpected number of URLs: " + urls.length);
+                }
+                String failStr = "";
+                for (int i = 0; i < urls.length; ++i) {
+                    if (!urls[i].getPath().equals(paths[i])) {
+                        failStr += "\nURL[" + i + "].getPath() = "
+                                + urls[i].getPath() + ", expected: " + paths[i];
+                    }
+                }
+                if (!failStr.equals("")) {
+                    fail(failStr);
+                }
+            } else {
+                fail("Class is loaded by non-URLClassLoader");
+            }
+        } finally {
+            // reset the security manager back to null state
+            System.setSecurityManager(previous);
+        }
+    }
+
+    /**
+     * Modify the above method to test loadClass, loadClass(String, String) for
+     * coverage.
+     */
+    public void testLoadClassCodebaseOrder3() throws Exception {
+        SecurityManager previous = System.getSecurityManager();
+        System.setSecurityManager(new SecurityManager() {
+            @Override
+            public void checkPermission(Permission perm) {
+                /*
+                 * Override checkPermission to allow everything. Specifically,
+                 * we want to allow the SecurityManager to be set to null at the
+                 * end of the test and we want to allow the 'testClass.jar' file
+                 * to be allowed to load.
+                 */
+                return;
+            }
+        });
+        try {
+            URL testJarURL = getClass().getResource("testClass.jar");
+            String[] paths = new String[] { testJarURL.getPath(),
+            /*
+             * to be sure this path will be the first after sorting
+             */
+            "/_fake.jar" };
+
+            Class<?> c = RMIClassLoader.loadClass(new URI("file://" + paths[0])
+                    .toURL(), "TestClass");
+
+            assertNotNull(c);
+
+        } catch (Exception e) {
+            fail("class should be loaded");
         } finally {
-            System.setSecurityManager(previous);            
-        } 
+            // reset the security manager back to null state
+            System.setSecurityManager(previous);
+        }
+    }
+
+    /**
+     * Modify the above method to test testGetSecurityContext for coverage.
+     */
+    public void testGetSecurityContext() throws Exception {
+        SecurityManager previous = System.getSecurityManager();
+        SecurityManager sm = new SecurityManager() {
+            @Override
+            public void checkPermission(Permission perm) {
+                /*
+                 * Override checkPermission to allow everything. Specifically,
+                 * we want to allow the SecurityManager to be set to null at the
+                 * end of the test and we want to allow the 'testClass.jar' file
+                 * to be allowed to load.
+                 */
+                return;
+            }
+
+        };
+        System.setSecurityManager(sm);
+        try {
+            URL testJarURL = getClass().getResource("testClass.jar");
+            String[] paths = new String[] { testJarURL.getPath(),
+            /*
+             * to be sure this path will be the first after sorting
+             */
+            "/_fake.jar" };
+
+            Class<?> c = RMIClassLoader.loadClass(new URI("file://" + paths[0])
+                    .toURL(), "TestClass");
+
+            assertNotNull(c);
+
+            Object sc = RMIClassLoader.getSecurityContext(c.getClassLoader());
+            if (true) {
+                return;
+            }
+
+            // This is the ri behavior, spec for what to return is not found
+            assertEquals(((URL) sc).toString(), testJarURL.toString());
+        } finally {
+            // reset the security manager back to null state
+            System.setSecurityManager(previous);
+        }
+    }
+
+    public void testGetDefaultProvideInstance() {
+        assertTrue(RMIClassLoader.getDefaultProviderInstance() instanceof RMIClassLoaderSpi);
+    }
+
+    /**
+     * Modify the above method to test loadClass, loadClass(String, String) for
+     * coverage.
+     */
+    public void testLoadClassCodebaseOrder4() throws Exception {
+        SecurityManager previous = System.getSecurityManager();
+        System.setSecurityManager(new SecurityManager() {
+            @Override
+            public void checkPermission(Permission perm) {
+                /*
+                 * Override checkPermission to allow everything. Specifically,
+                 * we want to allow the SecurityManager to be set to null at the
+                 * end of the test and we want to allow the 'testClass.jar' file
+                 * to be allowed to load.
+                 */
+                return;
+            }
+        });
+        try {
+            URL testJarURL = getClass().getResource("testClass.jar");
+            String[] paths = new String[] { testJarURL.getPath(),
+            /*
+             * to be sure this path will be the first after sorting
+             */
+            "/_fake.jar" };
+
+            ClassLoader cl = RMIClassLoader.getClassLoader(new URI("file://"
+                    + paths[0]).toURL().toString());
+            Class<?> c = cl.loadClass("TestClass");
+
+            assertNotNull(c);
+
+        } finally {
+            // reset the security manager back to null state
+            System.setSecurityManager(previous);
+        }
+    }
+
+    /**
+     * Modify the above method to test loadClass, loadClass(String, String) for
+     * coverage.
+     */
+    public void testLoadClassCodebaseOrder5() throws Exception {
+        SecurityManager previous = System.getSecurityManager();
+        System.setSecurityManager(new SecurityManager() {
+            @Override
+            public void checkPermission(Permission perm) {
+                /*
+                 * Override checkPermission to allow everything. Specifically,
+                 * we want to allow the SecurityManager to be set to null at the
+                 * end of the test and we want to allow the 'testClass.jar' file
+                 * to be allowed to load.
+                 */
+                return;
+            }
+        });
+        try {
+            Class<?> c = RMIClassLoader.loadClass("TestClass");
+            fail();
+        } catch (ClassNotFoundException e) {
+        	// expected
+        } finally {
+            // reset the security manager back to null state
+            System.setSecurityManager(previous);
+        }
     }
 }

Added: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMISocketFactoryTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMISocketFactoryTest.java?rev=1002488&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMISocketFactoryTest.java (added)
+++ harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMISocketFactoryTest.java Wed Sep 29 06:33:52 2010
@@ -0,0 +1,88 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.rmi.server;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.rmi.server.RMIFailureHandler;
+import java.rmi.server.RMISocketFactory;
+import java.security.Permission;
+
+import junit.framework.TestCase;
+
+public class RMISocketFactoryTest extends TestCase {
+
+    public void testGetSetFailureHandler() {
+        RMIFailureHandler fh = new RMIFailureHandler() {
+            public boolean failure(Exception ex) {
+                return false;
+            }
+        };
+
+        RMISocketFactory.setFailureHandler(fh);
+        assertSame(fh, RMISocketFactory.getFailureHandler());
+    }
+
+    public void testSetSocketFactory() throws IOException {
+        SecurityManager previous = System.getSecurityManager();
+        SecurityManager sm = new SecurityManager() {
+            @Override
+            public void checkPermission(Permission perm) {
+                /*
+                 * Override checkPermission to allow everything. Specifically,
+                 * we want to allow the SecurityManager to be set to null at the
+                 * end of the test and we want to allow the 'testClass.jar' file
+                 * to be allowed to load.
+                 */
+                return;
+            }
+
+            @Override
+            public void checkSetFactory() {
+                throw new SecurityException();
+            }
+
+        };
+        System.setSecurityManager(sm);
+
+        RMISocketFactory sf = new RMISocketFactory() {
+
+            @Override
+            public ServerSocket createServerSocket(int port) throws IOException {
+                return null;
+            }
+
+            @Override
+            public Socket createSocket(String host, int port)
+                    throws IOException {
+                return null;
+            }
+        };
+
+        try {
+            RMISocketFactory.setSocketFactory(sf);
+            fail();
+        } catch (SecurityException e) {
+            return;
+        } finally {
+            System.setSecurityManager(previous);
+        }
+
+    }
+
+}

Propchange: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMISocketFactoryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteObjectTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteObjectTest.java?rev=1002488&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteObjectTest.java (added)
+++ harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteObjectTest.java Wed Sep 29 06:33:52 2010
@@ -0,0 +1,146 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.rmi.server;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.reflect.Method;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.server.Operation;
+import java.rmi.server.RemoteCall;
+import java.rmi.server.RemoteObject;
+import java.rmi.server.RemoteRef;
+
+import junit.framework.TestCase;
+
+public class RemoteObjectTest extends TestCase {
+
+    class MyRef implements RemoteRef {
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.rmi.server.RemoteRef#done(java.rmi.server.RemoteCall)
+         */
+        public void done(RemoteCall call) throws RemoteException {
+
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.rmi.server.RemoteRef#getRefClass(java.io.ObjectOutput)
+         */
+        public String getRefClass(ObjectOutput out) {
+            return null;
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.rmi.server.RemoteRef#invoke(java.rmi.Remote,
+         * java.lang.reflect.Method, java.lang.Object[], long)
+         */
+        public Object invoke(Remote obj, Method m, Object[] params, long h)
+                throws Exception {
+            return null;
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.rmi.server.RemoteRef#invoke(java.rmi.server.RemoteCall)
+         */
+        public void invoke(RemoteCall call) throws Exception {
+
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.rmi.server.RemoteRef#newCall(java.rmi.server.RemoteObject,
+         * java.rmi.server.Operation[], int, long)
+         */
+        public RemoteCall newCall(RemoteObject obj, Operation[] op, int a1,
+                long a2) throws RemoteException {
+            return null;
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see
+         * java.rmi.server.RemoteRef#remoteEquals(java.rmi.server.RemoteRef)
+         */
+        public boolean remoteEquals(RemoteRef ref) {
+            return false;
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.rmi.server.RemoteRef#remoteHashCode()
+         */
+        public int remoteHashCode() {
+            return 0;
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.rmi.server.RemoteRef#remoteToString()
+         */
+        public String remoteToString() {
+            return null;
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
+         */
+        public void readExternal(ObjectInput in) throws IOException,
+                ClassNotFoundException {
+
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
+         */
+        public void writeExternal(ObjectOutput out) throws IOException {
+
+        }
+
+    }
+
+    class MyRemoteObject extends RemoteObject {
+        public MyRemoteObject(RemoteRef ref) {
+            this.ref = ref;
+        }
+    }
+
+    public void testGetRef() {
+        MyRef ref = new MyRef();
+        MyRemoteObject obj = new MyRemoteObject(ref);
+
+        assertSame(ref, obj.getRef());
+    }
+}

Propchange: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteObjectTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteServerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteServerTest.java?rev=1002488&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteServerTest.java (added)
+++ harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteServerTest.java Wed Sep 29 06:33:52 2010
@@ -0,0 +1,53 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.rmi.server;
+
+import java.rmi.server.RemoteServer;
+import java.rmi.server.ServerNotActiveException;
+import java.security.Permission;
+
+import junit.framework.TestCase;
+
+public class RemoteServerTest extends TestCase {
+
+    public void testLog() {
+        SecurityManager sm = new SecurityManager() {
+            @Override
+            public void checkPermission(Permission perm) {
+                return;
+            }
+        };
+        SecurityManager previous = System.getSecurityManager();
+        System.setSecurityManager(sm);
+        try {
+            RemoteServer.setLog(null);
+            assertNull(RemoteServer.getLog());
+        } finally {
+            System.setSecurityManager(previous);
+        }
+    }
+
+    public void testGetClientHost() {
+        try {
+            RemoteServer.getClientHost();
+            fail();
+        } catch (ServerNotActiveException e) {
+        	// expected
+        }
+    }
+
+}

Propchange: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteServerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteStubTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteStubTest.java?rev=1002488&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteStubTest.java (added)
+++ harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteStubTest.java Wed Sep 29 06:33:52 2010
@@ -0,0 +1,162 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.rmi.server;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.reflect.Method;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.server.Operation;
+import java.rmi.server.RemoteCall;
+import java.rmi.server.RemoteObject;
+import java.rmi.server.RemoteRef;
+import java.rmi.server.RemoteStub;
+
+import junit.framework.TestCase;
+
+public class RemoteStubTest extends TestCase {
+
+    class MyRemoteRef implements RemoteRef {
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.rmi.server.RemoteRef#done(java.rmi.server.RemoteCall)
+         */
+        public void done(RemoteCall call) throws RemoteException {
+
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.rmi.server.RemoteRef#getRefClass(java.io.ObjectOutput)
+         */
+        public String getRefClass(ObjectOutput out) {
+            return null;
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.rmi.server.RemoteRef#invoke(java.rmi.Remote,
+         * java.lang.reflect.Method, java.lang.Object[], long)
+         */
+        public Object invoke(Remote obj, Method m, Object[] params, long h)
+                throws Exception {
+            return null;
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.rmi.server.RemoteRef#invoke(java.rmi.server.RemoteCall)
+         */
+        public void invoke(RemoteCall call) throws Exception {
+
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.rmi.server.RemoteRef#newCall(java.rmi.server.RemoteObject,
+         * java.rmi.server.Operation[], int, long)
+         */
+        public RemoteCall newCall(RemoteObject obj, Operation[] op, int a1,
+                long a2) throws RemoteException {
+            return null;
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see
+         * java.rmi.server.RemoteRef#remoteEquals(java.rmi.server.RemoteRef)
+         */
+        public boolean remoteEquals(RemoteRef ref) {
+            return false;
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.rmi.server.RemoteRef#remoteHashCode()
+         */
+        public int remoteHashCode() {
+            return 0;
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.rmi.server.RemoteRef#remoteToString()
+         */
+        public String remoteToString() {
+            return null;
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
+         */
+        public void readExternal(ObjectInput in) throws IOException,
+                ClassNotFoundException {
+
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
+         */
+        public void writeExternal(ObjectOutput out) throws IOException {
+
+        }
+
+    }
+
+    public void testSetRef() {
+        MyRemoteStub stub = new MyRemoteStub();
+        RemoteRef ref = new MyRemoteRef();
+
+        MyRemoteStub.setRef(stub, ref);
+
+        assertEquals(ref, stub.getRef());
+    }
+
+}
+
+class MyRemoteStub extends RemoteStub {
+    public RemoteRef getRef() {
+        return ref;
+    }
+
+    public MyRemoteStub() {
+        super();
+    }
+
+    public MyRemoteStub(RemoteRef ref) {
+        super(ref);
+    }
+
+    public static void setRef(RemoteStub stub, RemoteRef ref) {
+        RemoteStub.setRef(stub, ref);
+    }
+}

Propchange: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteStubTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerNotActiveExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerNotActiveExceptionTest.java?rev=1002488&r1=1002487&r2=1002488&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerNotActiveExceptionTest.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerNotActiveExceptionTest.java Wed Sep 29 06:33:52 2010
@@ -66,6 +66,12 @@ public class ServerNotActiveExceptionTes
         ServerNotActiveException e = new ServerNotActiveException(errorMessage);
         assertEquals(errorMessage, e.getMessage());
     }
+    
+    
+    public void test_Constructor(){
+        ServerNotActiveException e = new ServerNotActiveException();
+        assertNull(e.getMessage());
+    }
 
     // comparator for ServerNotActiveException objects
     private static final SerializableAssert comparator = new SerializableAssert() {

Added: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/activation/ActivationGroupIDTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/activation/ActivationGroupIDTest.java?rev=1002488&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/activation/ActivationGroupIDTest.java (added)
+++ harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/activation/ActivationGroupIDTest.java Wed Sep 29 06:33:52 2010
@@ -0,0 +1,206 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.rmi.tests.java.rmi.activation;
+
+import java.rmi.RemoteException;
+import java.rmi.activation.ActivationDesc;
+import java.rmi.activation.ActivationException;
+import java.rmi.activation.ActivationGroup;
+import java.rmi.activation.ActivationGroupDesc;
+import java.rmi.activation.ActivationGroupID;
+import java.rmi.activation.ActivationID;
+import java.rmi.activation.ActivationInstantiator;
+import java.rmi.activation.ActivationMonitor;
+import java.rmi.activation.ActivationSystem;
+import java.rmi.activation.UnknownGroupException;
+import java.rmi.activation.UnknownObjectException;
+
+import junit.framework.TestCase;
+
+public class ActivationGroupIDTest extends TestCase {
+
+	class MyActivationSystem implements ActivationSystem {
+
+		public MyActivationSystem() throws ActivationException {
+
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see
+		 * java.rmi.activation.ActivationSystem#activeGroup(java.rmi.activation
+		 * .ActivationGroupID, java.rmi.activation.ActivationInstantiator, long)
+		 */
+		public ActivationMonitor activeGroup(ActivationGroupID gID,
+				ActivationInstantiator aInst, long incarnation)
+				throws UnknownGroupException, ActivationException,
+				RemoteException {
+			return null;
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @seejava.rmi.activation.ActivationSystem#getActivationDesc(java.rmi.
+		 * activation.ActivationID)
+		 */
+		public ActivationDesc getActivationDesc(ActivationID aID)
+				throws ActivationException, UnknownObjectException,
+				RemoteException {
+			return null;
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see
+		 * java.rmi.activation.ActivationSystem#getActivationGroupDesc(java.
+		 * rmi.activation.ActivationGroupID)
+		 */
+		public ActivationGroupDesc getActivationGroupDesc(ActivationGroupID gID)
+				throws ActivationException, UnknownGroupException,
+				RemoteException {
+			return null;
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see
+		 * java.rmi.activation.ActivationSystem#registerGroup(java.rmi.activation
+		 * .ActivationGroupDesc)
+		 */
+		public ActivationGroupID registerGroup(ActivationGroupDesc gDesc)
+				throws ActivationException, RemoteException {
+			return null;
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see
+		 * java.rmi.activation.ActivationSystem#registerObject(java.rmi.activation
+		 * .ActivationDesc)
+		 */
+		public ActivationID registerObject(ActivationDesc aDesc)
+				throws ActivationException, UnknownGroupException,
+				RemoteException {
+			return null;
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @seejava.rmi.activation.ActivationSystem#setActivationDesc(java.rmi.
+		 * activation.ActivationID, java.rmi.activation.ActivationDesc)
+		 */
+		public ActivationDesc setActivationDesc(ActivationID aID,
+				ActivationDesc aDesc) throws ActivationException,
+				UnknownObjectException, UnknownGroupException, RemoteException {
+			return null;
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see
+		 * java.rmi.activation.ActivationSystem#setActivationGroupDesc(java.
+		 * rmi.activation.ActivationGroupID,
+		 * java.rmi.activation.ActivationGroupDesc)
+		 */
+		public ActivationGroupDesc setActivationGroupDesc(
+				ActivationGroupID gID, ActivationGroupDesc gDesc)
+				throws ActivationException, UnknownGroupException,
+				RemoteException {
+			return null;
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.rmi.activation.ActivationSystem#shutdown()
+		 */
+		public void shutdown() throws RemoteException {
+
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see
+		 * java.rmi.activation.ActivationSystem#unregisterGroup(java.rmi.activation
+		 * .ActivationGroupID)
+		 */
+		public void unregisterGroup(ActivationGroupID gID)
+				throws ActivationException, UnknownGroupException,
+				RemoteException {
+
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see
+		 * java.rmi.activation.ActivationSystem#unregisterObject(java.rmi.activation
+		 * .ActivationID)
+		 */
+		public void unregisterObject(ActivationID aID)
+				throws ActivationException, UnknownObjectException,
+				RemoteException {
+
+		}
+
+	}
+
+	public void testEquals() throws ActivationException {
+		ActivationSystem as = new MyActivationSystem();
+
+		ActivationGroupID agid = new ActivationGroupID(as);
+		ActivationGroupID agid2 = agid;
+		ActivationGroupID agid3 = new ActivationGroupID(as);
+
+		assertSame(agid2, agid);
+		assertFalse(agid.equals(agid3));
+	}
+
+	public void testGetSystem() throws ActivationException {
+		ActivationSystem as = new MyActivationSystem();
+		ActivationGroupID agid = new ActivationGroupID(as);
+
+		assertSame(as, agid.getSystem());
+	}
+
+	public void testHashcode() throws ActivationException {
+		ActivationSystem as = new MyActivationSystem();
+
+		ActivationGroupID agid = new ActivationGroupID(as);
+		ActivationGroupID agid3 = new ActivationGroupID(as);
+
+		assertTrue(agid.hashCode() != agid3.hashCode());
+	}
+
+	public void testToString() throws ActivationException {
+		ActivationSystem as = new MyActivationSystem();
+
+		ActivationGroupID agid = new ActivationGroupID(as);
+		ActivationGroupID agid3 = new ActivationGroupID(as);
+
+		assertTrue(!agid.toString().equals(agid3.toString()));
+	}
+
+}

Propchange: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/activation/ActivationGroupIDTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/dgc/LeaseTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/dgc/LeaseTest.java?rev=1002488&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/dgc/LeaseTest.java (added)
+++ harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/dgc/LeaseTest.java Wed Sep 29 06:33:52 2010
@@ -0,0 +1,36 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.rmi.tests.java.rmi.dgc;
+
+import java.rmi.dgc.Lease;
+import java.rmi.dgc.VMID;
+
+import junit.framework.TestCase;
+
+public class LeaseTest extends TestCase {
+
+	public void testGetValueAndGetVMID() {
+		VMID vmid = new VMID();
+		long duration = (long) Math.random() * Long.MAX_VALUE;
+
+		Lease lease = new Lease(vmid, duration);
+
+		assertEquals(duration, lease.getValue());
+		assertEquals(vmid, lease.getVMID());
+	}
+
+}

Propchange: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/dgc/LeaseTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/dgc/VMIDTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/dgc/VMIDTest.java?rev=1002488&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/dgc/VMIDTest.java (added)
+++ harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/dgc/VMIDTest.java Wed Sep 29 06:33:52 2010
@@ -0,0 +1,89 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.rmi.tests.java.rmi.dgc;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.InetAddress;
+import java.rmi.dgc.VMID;
+
+import junit.framework.TestCase;
+
+public class VMIDTest extends TestCase {
+
+	public void testEquals() {
+		VMID vmid = new VMID();
+		VMID vmid2 = new VMID();
+
+		assertTrue(vmid.equals(vmid));
+		assertFalse(vmid.equals(vmid2));
+	}
+
+	public void testHashCode() {
+		VMID vmid = new VMID();
+		VMID vmid2 = new VMID();
+
+		assertTrue(vmid.hashCode() != vmid2.hashCode());
+		assertTrue(vmid.hashCode() == vmid.hashCode());
+	}
+
+	public void testToString() {
+		VMID vmid = new VMID();
+		VMID vmid2 = new VMID();
+		assertEquals(vmid.toString(), vmid.toString());
+
+		assertFalse(vmid.toString().equals(vmid2.toString()));
+	}
+
+	public void testIsUnique() {
+		VMID vmid = new VMID();
+		boolean unique = true;
+		try {
+			InetAddress.getLocalHost();
+		} catch (Exception ex) {
+			// This exception is related to the behavior of vmid.isUnique
+			unique = false;
+		}
+
+		assertTrue(unique == vmid.isUnique());
+	}
+
+	public void testReadWriteObject() throws IOException, ClassNotFoundException {
+		VMID vmid = new VMID();
+
+		File tmpFile = File.createTempFile("VMIDTest", "tmp");
+		ObjectOutputStream output = new ObjectOutputStream(
+				new FileOutputStream(tmpFile));
+		output.writeObject(vmid);
+		output.flush();
+		output.close();
+
+		VMID vmid2 = null;
+		ObjectInputStream input = new ObjectInputStream(new FileInputStream(
+				tmpFile));
+		vmid2 = (VMID) input.readObject();
+		input.close();
+		tmpFile.delete();
+
+		assertTrue(vmid.equals(vmid2));
+	}
+
+}

Propchange: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/dgc/VMIDTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/ActivityCompletedExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/ActivityCompletedExceptionTest.java?rev=1002488&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/ActivityCompletedExceptionTest.java (added)
+++ harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/ActivityCompletedExceptionTest.java Wed Sep 29 06:33:52 2010
@@ -0,0 +1,50 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.rmi.tests.javax.activity;
+
+import javax.activity.ActivityCompletedException;
+
+import junit.framework.TestCase;
+
+public class ActivityCompletedExceptionTest extends TestCase {
+
+    public void test_Constructor() {
+        ActivityCompletedException ace = new ActivityCompletedException();
+        assertNull(ace.getMessage());
+    }
+
+    public void test_Constructor_String() {
+        ActivityCompletedException ace = new ActivityCompletedException("Hello");
+        assertEquals("Hello", ace.getMessage());
+    }
+
+    public void test_Constructor_String_Throwable() {
+        Throwable cause = new Throwable();
+        ActivityCompletedException ace = new ActivityCompletedException(
+                "Hello", cause);
+
+        assertSame(cause, ace.getCause());
+    }
+
+    public void test_Constructor_Throwable() {
+        Throwable cause = new Throwable();
+        ActivityCompletedException ace = new ActivityCompletedException(cause);
+        
+        assertSame(cause, ace.getCause());
+    }
+
+}

Propchange: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/ActivityCompletedExceptionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/ActivityRequiredExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/ActivityRequiredExceptionTest.java?rev=1002488&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/ActivityRequiredExceptionTest.java (added)
+++ harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/ActivityRequiredExceptionTest.java Wed Sep 29 06:33:52 2010
@@ -0,0 +1,50 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.rmi.tests.javax.activity;
+
+import javax.activity.ActivityCompletedException;
+import javax.activity.ActivityRequiredException;
+
+import junit.framework.TestCase;
+
+public class ActivityRequiredExceptionTest extends TestCase {
+
+    public void test_Constructor(){
+        ActivityRequiredException are = new ActivityRequiredException();
+        assertNull(null, are.getMessage());
+    }
+    
+    public void test_Constructor_String(){
+        ActivityRequiredException are = new ActivityRequiredException("Hello");
+        assertEquals("Hello", are.getMessage());
+    }
+    
+    public void test_Constructor_String_Throwable() {
+        Throwable cause = new Throwable();
+        ActivityRequiredException ace = new ActivityRequiredException(
+                "Hello", cause);
+
+        assertSame(cause, ace.getCause());
+    }
+
+    public void test_Constructor_Throwable() {
+        Throwable cause = new Throwable();
+        ActivityRequiredException ace = new ActivityRequiredException(cause);
+        
+        assertSame(cause, ace.getCause());
+    }
+}

Propchange: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/ActivityRequiredExceptionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/InvalidActivityExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/InvalidActivityExceptionTest.java?rev=1002488&view=auto
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/InvalidActivityExceptionTest.java (added)
+++ harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/InvalidActivityExceptionTest.java Wed Sep 29 06:33:52 2010
@@ -0,0 +1,49 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.rmi.tests.javax.activity;
+
+import javax.activity.InvalidActivityException;
+
+import junit.framework.TestCase;
+
+public class InvalidActivityExceptionTest extends TestCase {
+
+    public void test_Constructor(){
+        InvalidActivityException are = new InvalidActivityException();
+        assertNull(null, are.getMessage());
+    }
+    
+    public void test_Constructor_String(){
+        InvalidActivityException are = new InvalidActivityException("Hello");
+        assertEquals("Hello", are.getMessage());
+    }
+    
+    public void test_Constructor_String_Throwable() {
+        Throwable cause = new Throwable();
+        InvalidActivityException ace = new InvalidActivityException(
+                "Hello", cause);
+
+        assertSame(cause, ace.getCause());
+    }
+
+    public void test_Constructor_Throwable() {
+        Throwable cause = new Throwable();
+        InvalidActivityException ace = new InvalidActivityException(cause);
+        
+        assertSame(cause, ace.getCause());
+    }
+}

Propchange: harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/InvalidActivityExceptionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message