harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r574170 - in /harmony/enhanced/classlib/trunk/modules/rmi: ./ META-INF/ src/test/api/java/org/apache/harmony/rmi/server/ src/test/resources/serialization/ src/test/resources/serialization/org/ src/test/resources/serialization/org/apache/ sr...
Date Mon, 10 Sep 2007 08:25:53 GMT
Author: tonywu
Date: Mon Sep 10 01:25:52 2007
New Revision: 574170

URL: http://svn.apache.org/viewvc?rev=574170&view=rev
Log:
Apply patch Harmony-4757 ([classlib][rmi] Add test for java.rmi.server.ExportException)

Added:
    harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ExportExceptionTest.java
  (with props)
    harmony/enhanced/classlib/trunk/modules/rmi/src/test/resources/serialization/
    harmony/enhanced/classlib/trunk/modules/rmi/src/test/resources/serialization/org/
    harmony/enhanced/classlib/trunk/modules/rmi/src/test/resources/serialization/org/apache/
    harmony/enhanced/classlib/trunk/modules/rmi/src/test/resources/serialization/org/apache/harmony/
    harmony/enhanced/classlib/trunk/modules/rmi/src/test/resources/serialization/org/apache/harmony/rmi/
    harmony/enhanced/classlib/trunk/modules/rmi/src/test/resources/serialization/org/apache/harmony/rmi/server/
    harmony/enhanced/classlib/trunk/modules/rmi/src/test/resources/serialization/org/apache/harmony/rmi/server/ExportExceptionTest.golden.ser
  (with props)
Modified:
    harmony/enhanced/classlib/trunk/modules/rmi/META-INF/MANIFEST.MF
    harmony/enhanced/classlib/trunk/modules/rmi/build.xml

Modified: harmony/enhanced/classlib/trunk/modules/rmi/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/rmi/META-INF/MANIFEST.MF?rev=574170&r1=574169&r2=574170&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/rmi/META-INF/MANIFEST.MF (original)
+++ harmony/enhanced/classlib/trunk/modules/rmi/META-INF/MANIFEST.MF Mon Sep 10 01:25:52 2007
@@ -23,7 +23,8 @@
  java.util.logging,
  javax.net,
  javax.net.ssl,
- org.apache.harmony.kernel.vm
+ org.apache.harmony.kernel.vm,
+ org.apache.harmony.testframework.serialization;hy_usage=test;resolution:=optional
 Export-Package: java.rmi,
  java.rmi.activation,
  java.rmi.dgc,

Modified: harmony/enhanced/classlib/trunk/modules/rmi/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/rmi/build.xml?rev=574170&r1=574169&r2=574170&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/rmi/build.xml (original)
+++ harmony/enhanced/classlib/trunk/modules/rmi/build.xml Mon Sep 10 01:25:52 2007
@@ -204,6 +204,7 @@
                     </fileset>
                 </bootclasspath>
                 <classpath location="../../build/tests" />
+                <classpath location="${hy.hdk}/build/test/support.jar" />
             </javac>
         </sequential>
     </macrodef>
@@ -236,6 +237,7 @@
 
                 <classpath>
                     <pathelement path="${hy.rmi.src.test.resources}"/>
+                    <pathelement location="${hy.hdk}/build/test/support.jar"/>
                 </classpath>
 
                 <formatter type="xml" />

Added: harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ExportExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ExportExceptionTest.java?rev=574170&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ExportExceptionTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ExportExceptionTest.java
Mon Sep 10 01:25:52 2007
@@ -0,0 +1,110 @@
+/*
+ *  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.
+ */
+
+/*
+ *  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.Serializable;
+import java.rmi.server.ExportException;
+
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
+
+public class ExportExceptionTest extends junit.framework.TestCase {
+
+    private String errorMessage;
+
+    private String causeMessage;
+
+    private Exception cause;
+
+    /**
+     * Sets up the fixture, for example, open a network connection. This method
+     * is called before a test is executed.
+     */
+    @Override
+    protected void setUp() {
+        errorMessage = "Connectin Error";
+        causeMessage = "Caused Exception";
+        cause = new ExportException(causeMessage);
+    }
+
+    /**
+     * @tests java.rmi.server.ExportException#ExportException(String)
+     */
+    public void test_Constructor_String() {
+        ExportException e = new ExportException(errorMessage);
+        assertTrue(e instanceof java.rmi.RemoteException);
+        assertEquals(errorMessage, e.getMessage());
+    }
+
+    /**
+     * @tests java.rmi.server.ExportException#ExportException(String,Exception)
+     */
+    public void test_Constructor_String_Exception() {
+        ExportException e = new ExportException(errorMessage, cause);
+        assertEquals(cause.getMessage(), e.getCause().getMessage());
+    }
+
+    // comparator for ExportException objects
+    private static final SerializableAssert comparator = new SerializableAssert() {
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial, deserialized);
+
+            ExportException initEx = (ExportException) initial;
+            ExportException desrEx = (ExportException) deserialized;
+
+            assertEquals(initEx.getMessage(), desrEx.getMessage());
+            assertEquals(initEx.getCause().getMessage(), desrEx.getCause().getMessage());
+        }
+    };
+
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(new ExportException(errorMessage, cause), comparator);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this, new ExportException(errorMessage, cause), comparator);
+    }
+
+}

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

Added: harmony/enhanced/classlib/trunk/modules/rmi/src/test/resources/serialization/org/apache/harmony/rmi/server/ExportExceptionTest.golden.ser
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/rmi/src/test/resources/serialization/org/apache/harmony/rmi/server/ExportExceptionTest.golden.ser?rev=574170&view=auto
==============================================================================
Binary file - no diff available.

Propchange: harmony/enhanced/classlib/trunk/modules/rmi/src/test/resources/serialization/org/apache/harmony/rmi/server/ExportExceptionTest.golden.ser
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message