db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1081072 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests: BasicSetup.java UpgradeChange.java
Date Sun, 13 Mar 2011 10:42:53 GMT
Author: kahatlen
Date: Sun Mar 13 10:42:53 2011
New Revision: 1081072

URL: http://svn.apache.org/viewvc?rev=1081072&view=rev
Log:
DERBY-5105: NoSuchMethodError in upgrade tests (testTriggerBasic)

Disable the post soft upgrade phase for the versions that suffer from
DERBY-4835.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeChange.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java?rev=1081072&r1=1081071&r2=1081072&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java
Sun Mar 13 10:42:53 2011
@@ -79,8 +79,14 @@ public class BasicSetup extends UpgradeC
     		"VALUES(20)");
             break;
         case PH_POST_SOFT_UPGRADE:
-            s.executeUpdate("INSERT INTO Trigger_t1(max_size) "+
-    		"VALUES(20)");
+            // DERBY-5105: The post soft upgrade phase may fail with
+            // NoSuchMethodError if the old version suffers from DERBY-4835.
+            // Only execute this part of the test for versions that don't
+            // have this problem.
+            if (!oldSuffersFromDerby4835()) {
+                s.executeUpdate("INSERT INTO Trigger_t1(max_size) " +
+                                "VALUES(20)");
+            }
             break;
         case PH_HARD_UPGRADE:
             s.executeUpdate("INSERT INTO Trigger_t1(max_size) "+
@@ -91,6 +97,15 @@ public class BasicSetup extends UpgradeC
     }
 
     /**
+     * Check if the old version from which we upgrade suffers from DERBY-4835.
+     */
+    private boolean oldSuffersFromDerby4835() {
+        // DERBY-4835 exists on 10.5 and 10.6 prior to 10.5.3.2 and 10.6.2.3.
+        return (oldAtLeast(10, 5) && oldLessThan(10, 5, 3, 2)) ||
+                (oldAtLeast(10, 6) && oldLessThan(10, 6, 2, 3));
+    }
+
+    /**
      * Simple test of the old version from the meta data.
      */
     public void testOldVersion() throws SQLException

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeChange.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeChange.java?rev=1081072&r1=1081071&r2=1081072&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeChange.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeChange.java
Sun Mar 13 10:42:53 2011
@@ -123,6 +123,24 @@ abstract class UpgradeChange extends Bas
             return true;
         return false;
     } 
+
+    /**
+     * Return true if and only if the old version is less than the
+     * specified version.
+     */
+    boolean oldLessThan(int major, int minor, int fixpack, int point) {
+        int[] old = (int[]) oldVersion.get();
+        int[] version = new int[]{major, minor, fixpack, point};
+
+        for (int i = 0; i < old.length; i++) {
+            if (old[i] < version[i]) return true;
+            if (old[i] > version[i]) return false;
+        }
+
+        // Old version matches exactly. That is, not less than.
+        return false;
+    }
+
     /**
      * Return true if the old version is equal
      *  the passed in major and minor version.



Mime
View raw message