You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by to...@apache.org on 2007/10/09 12:29:49 UTC
svn commit: r583097 - in
/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server:
ExportExceptionTest.java SkeletonMismatchExceptionTest.java
SkeletonNotFoundExceptionTest.java SocketSecurityExceptionTest.java
Author: tonywu
Date: Tue Oct 9 03:29:48 2007
New Revision: 583097
URL: http://svn.apache.org/viewvc?rev=583097&view=rev
Log:
Apply patch Harmony-4827 ([classlib][rmi] add unit test for SocketSecurityException, SkeletonMismatchException and SkeletonNotFoundException)
Added:
harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/SkeletonMismatchExceptionTest.java (with props)
harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/SkeletonNotFoundExceptionTest.java (with props)
harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/SocketSecurityExceptionTest.java (with props)
Modified:
harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ExportExceptionTest.java
Modified: 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=583097&r1=583096&r2=583097&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ExportExceptionTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ExportExceptionTest.java Tue Oct 9 03:29:48 2007
@@ -15,23 +15,6 @@
* 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;
Added: harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/SkeletonMismatchExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/SkeletonMismatchExceptionTest.java?rev=583097&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/SkeletonMismatchExceptionTest.java (added)
+++ harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/SkeletonMismatchExceptionTest.java Tue Oct 9 03:29:48 2007
@@ -0,0 +1,73 @@
+/*
+ * 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.RemoteException;
+import java.rmi.server.SkeletonMismatchException;
+
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
+
+public class SkeletonMismatchExceptionTest extends junit.framework.TestCase {
+
+ private String errorMessage = "SkeletonMismatch Exception!";
+ private SkeletonMismatchException cause = new SkeletonMismatchException("cause");
+
+ /**
+ * @tests java.rmi.server.SkeletonMismatchException#SkeletonMismatchException(String)
+ */
+ public void test_Constructor_String() {
+ SkeletonMismatchException e = new SkeletonMismatchException(errorMessage);
+ assertTrue(e instanceof java.rmi.RemoteException);
+ assertTrue(e instanceof RemoteException);
+ assertEquals(errorMessage, e.getMessage());
+ assertNull(e.detail);
+ }
+
+ // comparator for SkeletonMismatchException objects
+ private static final SerializableAssert comparator = new SerializableAssert() {
+ public void assertDeserialized(Serializable initial,
+ Serializable deserialized) {
+
+ SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial, deserialized);
+
+ SkeletonMismatchException initEx = (SkeletonMismatchException) initial;
+ SkeletonMismatchException desrEx = (SkeletonMismatchException) deserialized;
+ assertEquals(initEx.getMessage(), desrEx.getMessage());
+ assertEquals(initEx.detail, desrEx.detail);
+ }
+ };
+
+ /**
+ * @tests serialization/deserialization.
+ */
+ public void testSerializationSelf() throws Exception {
+
+ SerializationTest.verifySelf(new SkeletonMismatchException(errorMessage), comparator);
+ }
+
+ /**
+ * @tests serialization/deserialization compatibility with RI.
+ */
+ public void testSerializationCompatibility() throws Exception {
+
+ SerializationTest.verifyGolden(this, new SkeletonMismatchException(errorMessage), comparator);
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/SkeletonMismatchExceptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/SkeletonNotFoundExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/SkeletonNotFoundExceptionTest.java?rev=583097&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/SkeletonNotFoundExceptionTest.java (added)
+++ harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/SkeletonNotFoundExceptionTest.java Tue Oct 9 03:29:48 2007
@@ -0,0 +1,93 @@
+/*
+ * 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.SkeletonNotFoundException;
+
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
+
+public class SkeletonNotFoundExceptionTest 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 = "Skeleton Not Found";
+ causeMessage = "Caused Exception";
+ cause = new SkeletonNotFoundException(causeMessage);
+ }
+
+ /**
+ * @tests java.rmi.server.SkeletonNotFoundException#SkeletonNotFoundException(String)
+ */
+ public void test_Constructor_String() {
+ SkeletonNotFoundException e = new SkeletonNotFoundException(errorMessage);
+ assertTrue(e instanceof java.rmi.RemoteException);
+ assertEquals(errorMessage, e.getMessage());
+ }
+
+ /**
+ * @tests java.rmi.server.SkeletonNotFoundException#SkeletonNotFoundException(String,Exception)
+ */
+ public void test_Constructor_String_Exception() {
+ SkeletonNotFoundException e = new SkeletonNotFoundException(errorMessage, cause);
+ assertEquals(cause.getMessage(), e.getCause().getMessage());
+ }
+
+ // comparator for SkeletonNotFoundException objects
+ private static final SerializableAssert comparator = new SerializableAssert() {
+ public void assertDeserialized(Serializable initial,
+ Serializable deserialized) {
+
+ SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial, deserialized);
+
+ SkeletonNotFoundException initEx = (SkeletonNotFoundException) initial;
+ SkeletonNotFoundException desrEx = (SkeletonNotFoundException) deserialized;
+
+ assertEquals(initEx.getMessage(), desrEx.getMessage());
+ assertEquals(initEx.getCause().getMessage(), desrEx.getCause().getMessage());
+ }
+ };
+
+ /**
+ * @tests serialization/deserialization.
+ */
+ public void testSerializationSelf() throws Exception {
+
+ SerializationTest.verifySelf(new SkeletonNotFoundException(errorMessage, cause), comparator);
+ }
+
+ /**
+ * @tests serialization/deserialization compatibility with RI.
+ */
+ public void testSerializationCompatibility() throws Exception {
+
+ SerializationTest.verifyGolden(this, new SkeletonNotFoundException(errorMessage, cause), comparator);
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/SkeletonNotFoundExceptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/SocketSecurityExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/SocketSecurityExceptionTest.java?rev=583097&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/SocketSecurityExceptionTest.java (added)
+++ harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/SocketSecurityExceptionTest.java Tue Oct 9 03:29:48 2007
@@ -0,0 +1,93 @@
+/*
+ * 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.SocketSecurityException;
+
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
+
+public class SocketSecurityExceptionTest 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 SocketSecurityException(causeMessage);
+ }
+
+ /**
+ * @tests java.rmi.server.SocketSecurityException#SocketSecurityException(String)
+ */
+ public void test_Constructor_String() {
+ SocketSecurityException e = new SocketSecurityException(errorMessage);
+ assertTrue(e instanceof java.rmi.server.ExportException);
+ assertEquals(errorMessage, e.getMessage());
+ }
+
+ /**
+ * @tests java.rmi.server.SocketSecurityException#SocketSecurityException(String,Exception)
+ */
+ public void test_Constructor_String_Exception() {
+ SocketSecurityException e = new SocketSecurityException(errorMessage, cause);
+ assertEquals(cause.getMessage(), e.getCause().getMessage());
+ }
+
+ // comparator for SocketSecurityException objects
+ private static final SerializableAssert comparator = new SerializableAssert() {
+ public void assertDeserialized(Serializable initial,
+ Serializable deserialized) {
+
+ SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial, deserialized);
+
+ SocketSecurityException initEx = (SocketSecurityException) initial;
+ SocketSecurityException desrEx = (SocketSecurityException) deserialized;
+
+ assertEquals(initEx.getMessage(), desrEx.getMessage());
+ assertEquals(initEx.getCause().getMessage(), desrEx.getCause().getMessage());
+ }
+ };
+
+ /**
+ * @tests serialization/deserialization.
+ */
+ public void testSerializationSelf() throws Exception {
+
+ SerializationTest.verifySelf(new SocketSecurityException(errorMessage, cause), comparator);
+ }
+
+ /**
+ * @tests serialization/deserialization compatibility with RI.
+ */
+ public void testSerializationCompatibility() throws Exception {
+
+ SerializationTest.verifyGolden(this, new SocketSecurityException(errorMessage, cause), comparator);
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/SocketSecurityExceptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native