harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r582739 - in /harmony/enhanced/classlib/trunk/modules/rmi/src/test: api/java/org/apache/harmony/rmi/server/ resources/serialization/org/apache/harmony/rmi/server/
Date Mon, 08 Oct 2007 07:56:07 GMT
Author: tonywu
Date: Mon Oct  8 00:55:59 2007
New Revision: 582739

URL: http://svn.apache.org/viewvc?rev=582739&view=rev
Log:
Apply patch Harmony-4819 ([classlib][rmi] add unit test for ServerCloneException and ServerNotActiveException)

Added:
    harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerCloneExceptionTest.java
  (with props)
    harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerNotActiveExceptionTest.java
  (with props)
    harmony/enhanced/classlib/trunk/modules/rmi/src/test/resources/serialization/org/apache/harmony/rmi/server/ServerCloneExceptionTest.golden.ser
  (with props)
    harmony/enhanced/classlib/trunk/modules/rmi/src/test/resources/serialization/org/apache/harmony/rmi/server/ServerNotActiveExceptionTest.golden.ser
  (with props)

Added: harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerCloneExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerCloneExceptionTest.java?rev=582739&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerCloneExceptionTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerCloneExceptionTest.java
Mon Oct  8 00:55:59 2007
@@ -0,0 +1,116 @@
+/*
+ *  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.ServerCloneException;
+
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
+
+public class ServerCloneExceptionTest 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 = "Clone Error";
+        causeMessage = "Caused Exception";
+        cause = new ServerCloneException(causeMessage);
+    }
+
+    /**
+     * @tests java.rmi.server.ServerCloneException#ServerCloneException(String)
+     */
+    public void test_Constructor_String() {
+        ServerCloneException e = new ServerCloneException(errorMessage);
+        assertEquals(errorMessage, e.getMessage());
+        assertNull(e.detail);
+        try {
+            e.initCause(e);
+        } catch (IllegalStateException exception) {
+            // expected
+        }
+    }
+
+    /**
+     * @tests java.rmi.server.ServerCloneException#ServerCloneException(String,Exception)
+     */
+    public void test_Constructor_String_Exception() {
+        ServerCloneException e = new ServerCloneException(errorMessage, cause);
+        assertEquals(cause.getMessage(), e.getCause().getMessage());
+        assertEquals(cause.getMessage(), e.detail.getMessage());
+    }
+
+    // comparator for ServerCloneException objects
+    private static final SerializableAssert comparator = new SerializableAssert() {
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial, deserialized);
+
+            ServerCloneException initEx = (ServerCloneException) initial;
+            ServerCloneException desrEx = (ServerCloneException) deserialized;
+
+            assertEquals(initEx.getMessage(), desrEx.getMessage());
+            assertEquals(initEx.getCause().getMessage(), desrEx.getCause().getMessage());
+        }
+    };
+
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(new ServerCloneException(errorMessage, cause), comparator);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this, new ServerCloneException(errorMessage, cause),
comparator);
+    }
+    
+}

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

Added: harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerNotActiveExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerNotActiveExceptionTest.java?rev=582739&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerNotActiveExceptionTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerNotActiveExceptionTest.java
Mon Oct  8 00:55:59 2007
@@ -0,0 +1,100 @@
+/*
+ *  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.ServerNotActiveException;
+
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
+
+public class ServerNotActiveExceptionTest 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 ServerNotActiveException(causeMessage);
+    }
+
+    /**
+     * @tests java.rmi.server.ServerNotActiveException#ServerNotActiveException(String)
+     */
+    public void test_Constructor_String() {
+        ServerNotActiveException e = new ServerNotActiveException(errorMessage);
+        assertEquals(errorMessage, e.getMessage());
+    }
+
+    // comparator for ServerNotActiveException objects
+    private static final SerializableAssert comparator = new SerializableAssert() {
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial, deserialized);
+
+            ServerNotActiveException initEx = (ServerNotActiveException) initial;
+            ServerNotActiveException desrEx = (ServerNotActiveException) deserialized;
+
+            assertEquals(initEx.getMessage(), desrEx.getMessage());
+        }
+    };
+
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(new ServerNotActiveException(errorMessage), comparator);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this, new ServerNotActiveException(errorMessage),
comparator);
+    }
+
+}

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

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

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

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

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



Mime
View raw message