harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r438027 - 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 Tue, 29 Aug 2006 09:21:42 GMT
Author: smishura
Date: Tue Aug 29 02:21:41 2006
New Revision: 438027

URL: http://svn.apache.org/viewvc?rev=438027&view=rev
Log:
Apply patch for HARMONY-1301 ([classlib][sql] The field "int[] theUpdateCounts" of java.sql.BatchUpdateException
should be "int[] updateCounts" according to "serialization form")

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/BatchUpdateException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/BatchUpdateException.java?rev=438027&r1=438026&r2=438027&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/BatchUpdateException.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/BatchUpdateException.java
Tue Aug 29 02:21:41 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.
@@ -40,7 +40,7 @@
 
     private static final long serialVersionUID = 5977529877145521757L;
 
-    private int[] theUpdateCounts = null;
+    private int[] updateCounts = null;
 
     /**
      * Creates a BatchUpdateException with the Reason, SQLState, and Update
@@ -59,7 +59,7 @@
      */
     public BatchUpdateException(int[] updateCounts) {
         super();
-        this.theUpdateCounts = updateCounts;
+        this.updateCounts = updateCounts;
     }
 
     /**
@@ -74,7 +74,7 @@
      */
     public BatchUpdateException(String reason, int[] updateCounts) {
         super(reason);
-        this.theUpdateCounts = updateCounts;
+        this.updateCounts = updateCounts;
     }
 
     /**
@@ -92,7 +92,7 @@
     public BatchUpdateException(String reason, String SQLState,
             int[] updateCounts) {
         super(reason, SQLState);
-        this.theUpdateCounts = updateCounts;
+        this.updateCounts = updateCounts;
     }
 
     /**
@@ -112,7 +112,7 @@
     public BatchUpdateException(String reason, String SQLState, int vendorCode,
             int[] updateCounts) {
         super(reason, SQLState, vendorCode);
-        this.theUpdateCounts = updateCounts;
+        this.updateCounts = updateCounts;
     }
 
     /**
@@ -140,6 +140,6 @@
      *         </ol>
      */
     public int[] getUpdateCounts() {
-        return theUpdateCounts;
+        return updateCounts;
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/BatchUpdateExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/BatchUpdateExceptionTest.java?rev=438027&r1=438026&r2=438027&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/BatchUpdateExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/BatchUpdateExceptionTest.java
Tue Aug 29 02:21:41 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.BatchUpdateException;
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
 
 import junit.framework.TestCase;
 
@@ -321,6 +324,51 @@
 		} // end for
 
 	} // end method testGetUpdateCounts
+    
+    /**
+     * @tests serialization/deserialization compatibility.
+     */
+    public void testSerializationSelf() throws Exception {
+        BatchUpdateException object = new BatchUpdateException();
+        SerializationTest.verifySelf(object, BATCHUPDATEEXCEPTION_COMPARATOR);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+        int vendorCode = 10;
+        int[] updateCounts = { 1, 2, 3, 4 };
+        BatchUpdateException object = new BatchUpdateException("reason",
+                "SQLState", vendorCode, updateCounts);
+        SerializationTest.verifyGolden(this, object,
+                BATCHUPDATEEXCEPTION_COMPARATOR);
+    }
+
+    // comparator for BatchUpdateException field updateCounts
+    private static final SerializableAssert BATCHUPDATEEXCEPTION_COMPARATOR = new SerializableAssert()
{
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+
+            // do common checks for all throwable objects
+            SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
+                    deserialized);
+
+            BatchUpdateException initThr = (BatchUpdateException) initial;
+            BatchUpdateException dserThr = (BatchUpdateException) deserialized;
+
+            // verify updateCounts
+            int[] initUpdateCounts = initThr.getUpdateCounts();
+            int[] dserUpdateCounts = dserThr.getUpdateCounts();
+            if (initUpdateCounts == null) {
+                assertNull(dserUpdateCounts);
+            } else {
+                for (int i = 0; i < initUpdateCounts.length; i++) {
+                    assertEquals(initUpdateCounts[i], dserUpdateCounts[i]);
+                }
+            }
+        }
+    };
 
 } // end class BatchUpdateExceptionTest
 

Added: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/resources/serialization/org/apache/harmony/sql/tests/java/sql/BatchUpdateExceptionTest.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/BatchUpdateExceptionTest.golden.ser?rev=438027&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/BatchUpdateExceptionTest.golden.ser
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message