harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r438806 - in /incubator/harmony/enhanced/classlib/trunk/modules/sql/src: main/java/java/sql/ test/java/org/apache/harmony/sql/tests/java/sql/ test/resources/serialization/org/apache/harmony/sql/tests/java/sql/
Date Thu, 31 Aug 2006 05:34:21 GMT
Author: pyang
Date: Wed Aug 30 22:34:20 2006
New Revision: 438806

URL: http://svn.apache.org/viewvc?rev=438806&view=rev
Log:
Patch applied for HARMONY-1347 ([classlib][sql] Fix the field name of java.sql.DataTruncation
according to serialization form)

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/resources/serialization/org/apache/harmony/sql/tests/java/sql/DataTruncationTest.golden.ser
  (with props)
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/DataTruncation.java
    incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DataTruncationTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/DataTruncation.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/DataTruncation.java?rev=438806&r1=438805&r2=438806&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/DataTruncation.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/DataTruncation.java
Wed Aug 30 22:34:20 2006
@@ -1,4 +1,4 @@
-/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+/* Copyright 2004, 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.
@@ -27,11 +27,11 @@
 
     private static final long serialVersionUID = 6464298989504059473L;
 
-    private int theIndex = 0;
+    private int index = 0;
 
-    private boolean parameterFlag = false;
+    private boolean parameter = false;
 
-    private boolean readFlag = false;
+    private boolean read = false;
 
     private int dataSize = 0;
 
@@ -65,9 +65,9 @@
     public DataTruncation(int index, boolean parameter, boolean read,
             int dataSize, int transferSize) {
         super(THE_REASON, THE_SQLSTATE, THE_ERROR_CODE);
-        this.theIndex = index;
-        this.parameterFlag = parameter;
-        this.readFlag = read;
+        this.index = index;
+        this.parameter = parameter;
+        this.read = read;
         this.dataSize = dataSize;
         this.transferSize = transferSize;
     }
@@ -88,7 +88,7 @@
      * @return the index number of the column or of the parameter.
      */
     public int getIndex() {
-        return theIndex;
+        return index;
     }
 
     /**
@@ -98,7 +98,7 @@
      *         was a column value
      */
     public boolean getParameter() {
-        return parameterFlag;
+        return parameter;
     }
 
     /**
@@ -109,7 +109,7 @@
      *         otherwise.
      */
     public boolean getRead() {
-        return readFlag;
+        return read;
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DataTruncationTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DataTruncationTest.java?rev=438806&r1=438805&r2=438806&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DataTruncationTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DataTruncationTest.java
Wed Aug 30 22:34:20 2006
@@ -1,4 +1,4 @@
-/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+/* Copyright 2004, 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,7 +15,10 @@
 
 package org.apache.harmony.sql.tests.java.sql;
 
+import java.io.Serializable;
 import java.sql.DataTruncation;
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
 
 import junit.framework.TestCase;
 
@@ -435,5 +438,50 @@
 		} // end for
 
 	} // end method testGetTransferSize
+    
+    /**
+     * @tests serialization/deserialization compatibility.
+     */
+    public void testSerializationSelf() throws Exception {
+        DataTruncation object = new DataTruncation(10, true, true, 10, 10);
+        SerializationTest.verifySelf(object, DATATRUNCATION_COMPARATOR);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+        DataTruncation object = new DataTruncation(10, true, true, 10, 10);
+        SerializationTest.verifyGolden(this, object, DATATRUNCATION_COMPARATOR);
+    }
+
+    // comparator for DataTruncation objects
+    private static final SerializableAssert DATATRUNCATION_COMPARATOR = new SerializableAssert()
{
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            // do common checks for all throwable objects
+            SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
+                    deserialized);
+
+            DataTruncation initThr = (DataTruncation) initial;
+            DataTruncation dserThr = (DataTruncation) deserialized;
+
+            // verify index
+            assertEquals(initThr.getIndex(), dserThr.getIndex());
+
+            // verify parameter
+            assertEquals(initThr.getParameter(), dserThr.getParameter());
+
+            // verify read
+            assertEquals(initThr.getRead(), dserThr.getRead());
+
+            // verify dataSize
+            assertEquals(initThr.getDataSize(), dserThr.getDataSize());
+
+            // verify transferSize
+            assertEquals(initThr.getTransferSize(), dserThr.getTransferSize());
+        }
+    };
 
 } // end class DataTruncationTest

Added: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/resources/serialization/org/apache/harmony/sql/tests/java/sql/DataTruncationTest.golden.ser
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/resources/serialization/org/apache/harmony/sql/tests/java/sql/DataTruncationTest.golden.ser?rev=438806&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/resources/serialization/org/apache/harmony/sql/tests/java/sql/DataTruncationTest.golden.ser
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message