harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r433529 - in /incubator/harmony/enhanced/classlib/trunk/modules/beans: META-INF/ src/test/java/org/apache/harmony/beans/tests/java/beans/ src/test/resources/serialization/java/beans/ src/test/resources/serialization/org/ src/test/resources/...
Date Tue, 22 Aug 2006 05:47:13 GMT
Author: smishura
Date: Mon Aug 21 22:47:12 2006
New Revision: 433529

URL: http://svn.apache.org/viewvc?rev=433529&view=rev
Log:
Refactoring serialization tests to use new framework

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/serialization/org/
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/serialization/org/apache/
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/serialization/org/apache/harmony/
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/serialization/org/apache/harmony/beans/
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/serialization/org/apache/harmony/beans/tests/
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/serialization/org/apache/harmony/beans/tests/java/
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/serialization/org/apache/harmony/beans/tests/java/beans/
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/serialization/org/apache/harmony/beans/tests/java/beans/IntrospectionExceptionTest.golden.ser
      - copied unchanged from r433493, incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/serialization/java/beans/IntrospectionException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/serialization/org/apache/harmony/beans/tests/java/beans/PropertyChangeEventTest.golden.ser
      - copied unchanged from r433493, incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/serialization/java/beans/PropertyChangeEvent.ser
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/serialization/org/apache/harmony/beans/tests/java/beans/PropertyVetoExceptionTest.golden.ser
      - copied unchanged from r433493, incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/serialization/java/beans/PropertyVetoException.ser
Removed:
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/serialization/java/beans/IntrospectionException.ser
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/serialization/java/beans/PropertyChangeEvent.ser
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/resources/serialization/java/beans/PropertyVetoException.ser
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/beans/META-INF/MANIFEST.MF
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectionExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyChangeEventTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyVetoExceptionTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/META-INF/MANIFEST.MF?rev=433529&r1=433528&r2=433529&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/META-INF/MANIFEST.MF (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/META-INF/MANIFEST.MF Mon Aug 21
22:47:12 2006
@@ -19,6 +19,7 @@
  javax.accessibility;resolution:=optional,
  org.xml.sax,
  org.xml.sax.helpers,
+ org.apache.harmony.testframework.serialization;hy_usage=test;resolution:=optional,
  tests.util;hy_usage=test;resolution:=optional
 Export-Package: java.beans,
  java.beans.beancontext

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectionExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectionExceptionTest.java?rev=433529&r1=433528&r2=433529&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectionExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectionExceptionTest.java
Mon Aug 21 22:47:12 2006
@@ -16,12 +16,11 @@
 package org.apache.harmony.beans.tests.java.beans;
 
 import java.beans.IntrospectionException;
-import java.io.IOException;
-
-import tests.util.SerializationTester;
 
 import junit.framework.TestCase;
 
+import org.apache.harmony.testframework.serialization.SerializationTest;
+
 /**
  * Unit test of IntrospectionException.
  */
@@ -39,25 +38,22 @@
         assertNull(e.getMessage());
     }
 
-    public void testSerialization() throws IOException, ClassNotFoundException {
-        String message = "IntrospectionExceptionTest";
-        IntrospectionException e = new IntrospectionException(message);
-        assertSame(message, e.getMessage());
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
 
-        IntrospectionException de = (IntrospectionException) SerializationTester
-                .getDeserilizedObject(e);
-        assertEquals(message, de.getMessage());
+        SerializationTest.verifySelf(new IntrospectionException(
+                "IntrospectionExceptionTest"));
     }
 
-    public void testSerialization_Compatibility() throws Exception {
-        String message = "IntrospectionExceptionTest";
-        IntrospectionException e = new IntrospectionException(message);
-        assertSame(message, e.getMessage());
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
 
-        IntrospectionException de = (IntrospectionException) SerializationTester
-                .readObject(e,
-                        "serialization/java/beans/IntrospectionException.ser");
-        assertEquals(message, de.getMessage());
+        SerializationTest.verifyGolden(this, new IntrospectionException(
+                "IntrospectionExceptionTest"));
     }
     
     public void testIntrospectionExceptionMessage() {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyChangeEventTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyChangeEventTest.java?rev=433529&r1=433528&r2=433529&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyChangeEventTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyChangeEventTest.java
Mon Aug 21 22:47:12 2006
@@ -16,11 +16,13 @@
 package org.apache.harmony.beans.tests.java.beans;
 
 import java.beans.PropertyChangeEvent;
-
-import tests.util.SerializationTester;
+import java.io.Serializable;
 
 import junit.framework.TestCase;
 
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
+
 /**
  * Test class java.beans.PropertyChangeEvent.
  */
@@ -137,40 +139,39 @@
 		assertNull(event.getPropagationId());
 	}
 
-	/*
-	 * Test serialization/deserialization.
-	 */
-	public void testSerialization() throws Exception {
-		Object src = new Object();
-		Object oldValue = "oldValue";
-		Object newValue = "newValue";
-
-		PropertyChangeEvent event = new PropertyChangeEvent(src, "myPropName",
-				oldValue, newValue);
-		PropertyChangeEvent deEvent = (PropertyChangeEvent) SerializationTester
-				.getDeserilizedObject(event);
-		assertEquals(event.getNewValue(), deEvent.getNewValue());
-		assertEquals(event.getOldValue(), deEvent.getOldValue());
-		assertEquals(event.getPropagationId(), deEvent.getPropagationId());
-		assertEquals(event.getPropertyName(), deEvent.getPropertyName());
-	}
-
-	/*
-	 * Test serialization compatibility.
-	 */
-	public void testSerializationCompatibility() throws Exception {
-		Object src = new Object();
-		Object oldValue = "oldValue";
-		Object newValue = "newValue";
-
-		PropertyChangeEvent event = new PropertyChangeEvent(src, "myPropName",
-				oldValue, newValue);
-		PropertyChangeEvent deEvent = (PropertyChangeEvent) SerializationTester
-				.readObject(event,
-						"serialization/java/beans/PropertyChangeEvent.ser");
-		assertEquals(event.getNewValue(), deEvent.getNewValue());
-		assertEquals(event.getOldValue(), deEvent.getOldValue());
-		assertEquals(event.getPropagationId(), deEvent.getPropagationId());
-		assertEquals(event.getPropertyName(), deEvent.getPropertyName());
-	}
+    // comparator for PropertyChangeEvent objects
+    public static final SerializableAssert comparator = new SerializableAssert() {
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            PropertyChangeEvent initEv = (PropertyChangeEvent) initial;
+            PropertyChangeEvent desrEv = (PropertyChangeEvent) deserialized;
+
+            assertEquals("NewValue", initEv.getNewValue(), desrEv.getNewValue());
+            assertEquals("OldValue", initEv.getOldValue(), desrEv.getOldValue());
+            assertEquals("PropagationId", initEv.getPropagationId(), desrEv
+                    .getPropagationId());
+            assertEquals("PropertyName", initEv.getPropertyName(), desrEv
+                    .getPropertyName());
+        }
+    };
+
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(new PropertyChangeEvent(new Object(),
+                "myPropName", "oldValue", "newValue"), comparator);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest
+                .verifyGolden(this, new PropertyChangeEvent(new Object(),
+                        "myPropName", "oldValue", "newValue"), comparator);
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyVetoExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyVetoExceptionTest.java?rev=433529&r1=433528&r2=433529&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyVetoExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyVetoExceptionTest.java
Mon Aug 21 22:47:12 2006
@@ -18,12 +18,13 @@
 import java.beans.Beans;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyVetoException;
-import java.io.IOException;
-
-import org.apache.harmony.beans.tests.support.mock.MockJavaBean;
+import java.io.Serializable;
 
 import junit.framework.TestCase;
-import tests.util.SerializationTester;
+
+import org.apache.harmony.beans.tests.support.mock.MockJavaBean;
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
 
 /**
  * Unit test for class PropertyVetoException
@@ -64,49 +65,43 @@
 		assertNull(e.getPropertyChangeEvent());
 	}
 
-	public void testSerializablization() throws IOException,
-			ClassNotFoundException {
-		String message = "testPropertyVetoException";
-		PropertyVetoException e = new PropertyVetoException(message, event);
-		assertSame(message, e.getMessage());
-		assertSame(event, e.getPropertyChangeEvent());
-
-		PropertyVetoException deserializedException = (PropertyVetoException) SerializationTester
-				.getDeserilizedObject(e);
-
-		assertEquals(message, deserializedException.getMessage());
-		assertEquals(event.getNewValue(), deserializedException
-				.getPropertyChangeEvent().getNewValue());
-		assertEquals(event.getOldValue(), deserializedException
-				.getPropertyChangeEvent().getOldValue());
-		assertEquals(event.getPropertyName(), deserializedException
-				.getPropertyChangeEvent().getPropertyName());
-		assertEquals(event.getPropagationId(), deserializedException
-				.getPropertyChangeEvent().getPropagationId());
-		assertNull(deserializedException.getPropertyChangeEvent().getSource());
-	}
-
-	public void testSerializablization_Compatibility() throws Exception {
-		String message = "testPropertyVetoException";
-		PropertyVetoException e = new PropertyVetoException(message, event);
-		assertSame(message, e.getMessage());
-		assertSame(event, e.getPropertyChangeEvent());
+    // comparator for PropertyVetoException objects
+    private static final SerializableAssert comparator = new SerializableAssert() {
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
+                    deserialized);
+
+            PropertyVetoException initEx = (PropertyVetoException) initial;
+            PropertyVetoException desrEx = (PropertyVetoException) deserialized;
+
+            assertNull(desrEx.getPropertyChangeEvent().getSource());
+
+            // compare event objects
+            PropertyChangeEventTest.comparator.assertDeserialized(initEx
+                    .getPropertyChangeEvent(), desrEx.getPropertyChangeEvent());
+        }
+    };
+
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(new PropertyVetoException(
+                "testPropertyVetoException", event), comparator);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this, new PropertyVetoException(
+                "testPropertyVetoException", event), comparator);
+    }
 
-		PropertyVetoException deserializedException = (PropertyVetoException) SerializationTester
-				.readObject(e, "serialization/java/beans/PropertyVetoException.ser");
-
-		assertEquals(message, deserializedException.getMessage());
-		assertEquals(event.getNewValue(), deserializedException
-				.getPropertyChangeEvent().getNewValue());
-		assertEquals(event.getOldValue(), deserializedException
-				.getPropertyChangeEvent().getOldValue());
-		assertEquals(event.getPropertyName(), deserializedException
-				.getPropertyChangeEvent().getPropertyName());
-		assertEquals(event.getPropagationId(), deserializedException
-				.getPropertyChangeEvent().getPropagationId());
-		assertNull(deserializedException.getPropertyChangeEvent().getSource());
-	}
-    
     public void testPropertyVetoExceptionMessage() {
         // Regression for HARMONY-235 (tracking the similar bug)
         PropertyChangeEvent event = new PropertyChangeEvent(new Beans(),



Mime
View raw message