You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by gh...@apache.org on 2006/04/19 14:34:01 UTC

svn commit: r395232 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test: java/tests/api/java/lang/ resources/serialization/java/lang/

Author: gharley
Date: Wed Apr 19 05:33:52 2006
New Revision: 395232

URL: http://svn.apache.org/viewcvs?rev=395232&view=rev
Log:
HARMONY-338 : several exceptions in java.lang has different serialVersionUID with RI

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/IllegalStateException.ser   (with props)
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/SecurityException.ser   (with props)
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/UnsupportedOperationException.ser   (with props)
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalStateExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/SecurityExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/UnsupportedOperationExceptionTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalStateExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalStateExceptionTest.java?rev=395232&r1=395231&r2=395232&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalStateExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalStateExceptionTest.java Wed Apr 19 05:33:52 2006
@@ -1,4 +1,4 @@
-/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+/* Copyright 1998, 2006 The Apache Software Foundation or its licensors, as applicable
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -15,8 +15,13 @@
 
 package tests.api.java.lang;
 
+import tests.util.SerializationTester;
+
 public class IllegalStateExceptionTest extends junit.framework.TestCase {
 
+	private static final String SERIALIZATION_FILE_NAME =
+		"/serialization/java/lang/IllegalStateException.ser"; //$NON-NLS-1$
+	
 	/**
 	 * @tests java.lang.IllegalStateException#IllegalStateException()
 	 */
@@ -24,19 +29,7 @@
 		// Test for method java.lang.IllegalStateException()
 		IllegalStateException ill = new IllegalStateException();
 		assertTrue("failed to create an instance of illegalStateException", ill
-				.getMessage() == null);
-		try {
-			try {
-				java.util.zip.Inflater inflater = new java.util.zip.Inflater();
-				inflater.end();
-				inflater.getAdler();
-			} catch (IllegalStateException e) {
-				return;
-			}
-			fail("Failed to generate Exception");
-		} catch (Exception e) {
-			fail("Exception during test : " + e.getMessage());
-		}
+				.getMessage() == null);	
 	}
 
 	/**
@@ -51,6 +44,26 @@
 				ill.getMessage().equals("testing illState exception"));
 	}
 
+	/**
+	 * @tests serialization/deserilazation.
+	 */
+	public void test_serialization() throws Exception {
+		IllegalStateException srcIllegalStateException = new IllegalStateException();
+		IllegalStateException destIllegalStateException = (IllegalStateException) SerializationTester
+				.getDeserilizedObject(srcIllegalStateException);
+	}
+
+	/**
+	 * @tests serialization/deserilazation compatibility with RI.
+	 */
+	public void test_serializationCompatibility() throws Exception {
+		IllegalStateException srcIllegalStateException = new IllegalStateException();
+		IllegalStateException destIllegalStateException = (IllegalStateException) SerializationTester
+				.readObject(srcIllegalStateException,
+						SERIALIZATION_FILE_NAME);
+	}
+	
+	
 	/**
 	 * Sets up the fixture, for example, open a network connection. This method
 	 * is called before a test is executed.

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/SecurityExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/SecurityExceptionTest.java?rev=395232&r1=395231&r2=395232&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/SecurityExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/SecurityExceptionTest.java Wed Apr 19 05:33:52 2006
@@ -1,4 +1,4 @@
-/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+/* Copyright 1998, 2006 The Apache Software Foundation or its licensors, as applicable
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -15,8 +15,13 @@
 
 package tests.api.java.lang;
 
-public class SecurityExceptionTest extends junit.framework.TestCase {
+import tests.util.SerializationTester;
 
+public class SecurityExceptionTest extends junit.framework.TestCase {
+	
+	private static final String SERIALIZATION_FILE_NAME =
+		"/serialization/java/lang/SecurityException.ser"; //$NON-NLS-1$
+	
 	/**
 	 * @tests java.lang.SecurityException#SecurityException()
 	 */
@@ -45,6 +50,26 @@
 		assertTrue("Failed to generate exception", threwException);
 	}
 
+	/**
+	 * @tests serialization/deserilazation.
+	 */
+	public void test_serialization() throws Exception {
+		SecurityException srcSecurityException = new SecurityException();
+		SecurityException destSecurityException = (SecurityException) SerializationTester
+				.getDeserilizedObject(srcSecurityException);
+	}
+
+	/**
+	 * @tests serialization/deserilazation compatibility with RI.
+	 */
+	public void test_serializationCompatibility() throws Exception {
+		SecurityException srcSecurityException = new SecurityException();
+		SecurityException destSecurityException = (SecurityException) SerializationTester
+				.readObject(srcSecurityException,
+						SERIALIZATION_FILE_NAME);
+	}
+	
+	
 	/**
 	 * Sets up the fixture, for example, open a network connection. This method
 	 * is called before a test is executed.

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/UnsupportedOperationExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/UnsupportedOperationExceptionTest.java?rev=395232&r1=395231&r2=395232&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/UnsupportedOperationExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/UnsupportedOperationExceptionTest.java Wed Apr 19 05:33:52 2006
@@ -1,4 +1,4 @@
-/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+/* Copyright 1998, 2006 The Apache Software Foundation or its licensors, as applicable
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,8 +18,13 @@
 import java.util.AbstractCollection;
 import java.util.Iterator;
 
+import tests.util.SerializationTester;
+
 public class UnsupportedOperationExceptionTest extends junit.framework.TestCase {
 
+	private static final String SERIALIZATION_FILE_NAME =
+		"/serialization/java/lang/UnsupportedOperationException.ser"; //$NON-NLS-1$
+	
 	/**
 	 * @tests java.lang.UnsupportedOperationException#UnsupportedOperationException()
 	 */
@@ -61,6 +66,26 @@
 			fail("Exception during Constructor : " + e.getMessage());
 		}
 		fail("Constructor failed");
+	}
+	
+	
+	/**
+	 * @tests serialization/deserilazation.
+	 */
+	public void test_serialization() throws Exception {
+		UnsupportedOperationException srcUnsupportedOperationException = new UnsupportedOperationException();
+		UnsupportedOperationException destUnsupportedOperationException = (UnsupportedOperationException) SerializationTester
+				.getDeserilizedObject(srcUnsupportedOperationException);
+	}
+
+	/**
+	 * @tests serialization/deserilazation compatibility with RI.
+	 */
+	public void test_serializationCompatibility() throws Exception {
+		UnsupportedOperationException srcUnsupportedOperationException = new UnsupportedOperationException();
+		UnsupportedOperationException destUnsupportedOperationException = (UnsupportedOperationException) SerializationTester
+				.readObject(srcUnsupportedOperationException,
+						SERIALIZATION_FILE_NAME);
 	}
 
 	/**

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/IllegalStateException.ser
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/IllegalStateException.ser?rev=395232&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/IllegalStateException.ser
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/SecurityException.ser
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/SecurityException.ser?rev=395232&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/SecurityException.ser
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/UnsupportedOperationException.ser
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/UnsupportedOperationException.ser?rev=395232&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/lang/UnsupportedOperationException.ser
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream