db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r493247 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests: BasicSetup.java Changes10_1.java PhaseChanger.java UpgradeChange.java UpgradeRun.java _Suite.java
Date Fri, 05 Jan 2007 23:47:13 GMT
Author: djd
Date: Fri Jan  5 15:47:13 2007
New Revision: 493247

URL: http://svn.apache.org/viewvc?view=rev&rev=493247
Log:
DERBY-2217 (partial) Initial cut at the framework for running the upgrade
tests under Junit. Ues the same class loader approach as the existing test
but only uses a class loader for the old version. The new version is picked
up using  default class loading. Currently only has one real fixture copied
over from the old suite, is not yet intended as a replacement.
Handles multiple old versions.

Added:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java
  (with props)
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_1.java
  (with props)
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/PhaseChanger.java
  (with props)
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeChange.java
  (with props)
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeRun.java
  (with props)
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/_Suite.java
  (with props)

Added: 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?view=auto&rev=493247
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java
Fri Jan  5 15:47:13 2007
@@ -0,0 +1,64 @@
+/*
+
+Derby - Class org.apache.derbyTesting.functionTests.tests.upgradeTests.BasicSetup
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+*/
+package org.apache.derbyTesting.functionTests.tests.upgradeTests;
+
+import java.sql.DatabaseMetaData;
+import java.sql.SQLException;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Basic fixtures and setup for the upgrade test, not
+ * tied to any specific release.
+ */
+public class BasicSetup extends UpgradeChange {
+    
+    public static Test suite() {
+        TestSuite suite = new TestSuite("Upgrade basic setup");
+        
+        suite.addTestSuite(BasicSetup.class);
+        
+        return suite;
+    }
+
+    public BasicSetup(String name) {
+        super(name);
+    }
+      
+    /**
+     * Simple test of the old version from the meta data.
+     */
+    public void testOldVersion() throws SQLException
+    {              
+        switch (getPhase())
+        {
+        case PH_CREATE:
+        case PH_POST_SOFT_UPGRADE:
+            DatabaseMetaData dmd = getConnection().getMetaData();
+            assertEquals("Old major: ",
+                    getOldMajor(), dmd.getDriverMajorVersion());
+            assertEquals("Old minor: ",
+                    getOldMinor(), dmd.getDriverMinorVersion());
+            break;
+        }
+    }
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_1.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_1.java?view=auto&rev=493247
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_1.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_1.java
Fri Jan  5 15:47:13 2007
@@ -0,0 +1,113 @@
+/*
+
+Derby - Class org.apache.derbyTesting.functionTests.tests.upgradeTests.Changes10_1
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+*/
+package org.apache.derbyTesting.functionTests.tests.upgradeTests;
+
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Upgrade test cases for changes made in 10.1.
+ */
+public class Changes10_1 extends UpgradeChange {
+    
+    public static Test suite() {
+        TestSuite suite = new TestSuite("Upgrade changes for 10.1");
+        
+        suite.addTestSuite(Changes10_1.class);
+        
+        return suite;
+    }
+
+    public Changes10_1(String name) {
+        super(name);
+    }
+    
+    /**
+     * A CREATE PROCEDURE with a signature (of no arguments).
+     */
+    private static final String PROC_SIGNATURE =
+        "CREATE PROCEDURE GC() " +
+        "LANGUAGE JAVA PARAMETER STYLE JAVA EXTERNAL NAME" +
+        " 'java.lang.System.gc()'";
+    
+    /**
+     * Check that a procedure with a signature can not be added if the
+     * on-disk database version is 10.0.
+     * Test added by 10.1.
+     * @throws SQLException 
+     *
+     */
+    public void testProcedureSignature() throws SQLException
+    {      
+       boolean signaturesAllowedInOldRelease = oldAtLeast(10, 1);
+        
+        switch (getPhase())
+        {
+        case PH_CREATE:
+            break;
+        case PH_SOFT_UPGRADE:
+        {
+            Statement s = createStatement();
+            try {
+                s.execute(PROC_SIGNATURE);
+                if (!signaturesAllowedInOldRelease)
+                    fail("created procedure with signature");
+
+            } catch (SQLException sqle) {
+                if (signaturesAllowedInOldRelease)
+                    fail("failed to create valid procedure");
+                
+                assertSQLState("XCL47", sqle);
+            }
+            s.close();
+            break;
+        }
+        case PH_POST_SOFT_UPGRADE:
+        {
+            Statement s = createStatement();
+            try {
+                s.execute("CALL GC()");
+                if (!signaturesAllowedInOldRelease)
+                    fail("procedure was created in soft upgrade!");
+                    
+            } catch (SQLException sqle)
+            {
+                if (signaturesAllowedInOldRelease)
+                    fail("procedure was created not in soft upgrade!");
+            }
+            s.close();
+            break;
+        }
+        case PH_HARD_UPGRADE:
+        {
+            Statement s = createStatement();
+            if (!signaturesAllowedInOldRelease)
+                s.execute(PROC_SIGNATURE);
+            s.execute("CALL GC()");
+            s.close();
+            break;
+        }
+        }
+    }
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_1.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/PhaseChanger.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/PhaseChanger.java?view=auto&rev=493247
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/PhaseChanger.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/PhaseChanger.java
Fri Jan  5 15:47:13 2007
@@ -0,0 +1,139 @@
+/*
+
+Derby - Class org.apache.derbyTesting.functionTests.tests.upgradeTests.PhaseChanger
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+*/
+package org.apache.derbyTesting.functionTests.tests.upgradeTests;
+
+import java.security.AccessController;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import javax.sql.DataSource;
+
+import org.apache.derbyTesting.junit.JDBCDataSource;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+/**
+ * Decorator that sets the phase of the upgrade process
+ * for a suite of upgrade tests.
+ */
+final class PhaseChanger extends TestSetup {
+
+    private final int phase;
+    private final int[] version;
+    private ClassLoader loader;
+    private ClassLoader previousLoader;
+    
+    public PhaseChanger(Test test, int phase,
+            ClassLoader loader, int[] version) {
+        super(test);
+        this.phase = phase;
+        this.loader = loader;
+        this.version = version;
+    }
+    
+    /**
+     * Set the phase and boot the database, creating it
+     * or upgrading it as required. The thread context
+     * class loader is changed to point to the old
+     * jar files if required for the phase.
+     */
+    protected void setUp() throws SQLException
+    {
+        UpgradeChange.phase.set(new Integer(phase));
+        UpgradeChange.oldVersion.set(version);
+        
+        
+        if (loader != null) {
+            previousLoader = Thread.currentThread().getContextClassLoader();
+            setThreadLoader(loader);
+        }
+         
+        DataSource ds = JDBCDataSource.getDataSource();
+        switch (phase)
+        {
+        case UpgradeChange.PH_POST_HARD_UPGRADE:
+            // Post hard upgrade is expected to fail
+            // since the database cannot be accessed
+            // by the old version anymore. This will
+            // be explictly tested eslewhere rather than
+            // in a setup method.
+            return;
+            
+        case UpgradeChange.PH_CREATE:
+            JDBCDataSource.setBeanProperty(ds, "createDatabase", "create");
+            break;
+            
+        case UpgradeChange.PH_HARD_UPGRADE:
+            JDBCDataSource.setBeanProperty(ds, "connectionAttributes",
+                    "upgrade=true");
+            break;
+        default:
+            break;
+        }
+        
+        ds.getConnection().close();
+    }
+    
+    /**
+     * Shutdown the database and reset the class loader.
+     * @throws InterruptedException 
+     */
+    protected void tearDown() throws InterruptedException
+    {
+        if (phase != UpgradeChange.PH_POST_HARD_UPGRADE) {
+            DataSource ds = JDBCDataSource.getDataSource();
+            JDBCDataSource.shutdownDatabase(ds);
+        }
+        
+       
+        if (loader != null)
+            setThreadLoader(previousLoader);       
+        loader = null;
+        previousLoader = null;
+        
+        UpgradeChange.phase.set(null);
+        UpgradeChange.oldVersion.set(null);
+    }
+    
+    private void setThreadLoader(final ClassLoader which) {
+
+        AccessController.doPrivileged
+        (new java.security.PrivilegedAction(){
+            
+            public Object run()  { 
+                java.lang.Thread.currentThread().setContextClassLoader(which);
+              return null;
+            }
+        });
+    }
+    
+    private ClassLoader getThreadLoader() {
+
+        return (ClassLoader) AccessController.doPrivileged
+        (new java.security.PrivilegedAction(){
+            
+            public Object run()  { 
+                return Thread.currentThread().getContextClassLoader();
+            }
+        });
+    }
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/PhaseChanger.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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?view=auto&rev=493247
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeChange.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeChange.java
Fri Jan  5 15:47:13 2007
@@ -0,0 +1,117 @@
+/*
+
+Derby - Class org.apache.derbyTesting.functionTests.tests.upgradeTests.UpgradeChange
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+*/
+package org.apache.derbyTesting.functionTests.tests.upgradeTests;
+
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+
+/**
+ * Abstract class to provide support for test fixtures for
+ * upgrade change testing.
+ *
+ */
+abstract class UpgradeChange extends BaseJDBCTestCase {
+      
+    /**
+     * Thread local for the phase of the test set.
+     * Contains an Integer object.
+     */
+    static ThreadLocal phase = new ThreadLocal();
+    
+    /**
+     * Thread local for the old version of the engine.
+     * Contains a int array with four entries corresponding
+     * to the four part Derby number.
+     */
+    static ThreadLocal oldVersion = new ThreadLocal();
+    
+    /**
+     * Phases in upgrade test
+     */
+    static final String[] PHASES =
+    {"CREATE", "SOFT UPGRADE", "POST SOFT UPGRADE", "UPGRADE", "POST UPGRADE"};
+    
+    
+    /**
+     * Create a database with old version
+     */
+    static final int PH_CREATE = 0;
+    /**
+     * Perform soft upgrade with new version
+     */
+    static final int PH_SOFT_UPGRADE = 1;
+    /**
+     * Boot the database with old release after soft upgrade
+     */
+    static final int PH_POST_SOFT_UPGRADE = 2;
+    /**
+     * Perform hard upgrade with new version
+     */
+    
+    static final int PH_HARD_UPGRADE = 3;
+    /**
+     * Boot the database with old release after hard upgrade
+     */
+    static final int PH_POST_HARD_UPGRADE = 4;
+    
+    public UpgradeChange(String name) {
+        super(name);
+    }
+
+    /**
+     * Get the phase of the upgrade sequence we are running.
+     * One of PH_CREATE, PH_SOFT_UPGRADE, PH_POST_SOFT_UPGRADE,
+     * PH_HARD_UPGRADE, PH_POST_HARD_UPGRADE.
+     */
+    final int getPhase()
+    {
+        return ((Integer) phase.get()).intValue();
+    }
+    
+    /**
+     * Get the major number of the old version being upgraded
+     * from.
+     */
+    final int getOldMajor() {
+        return ((int[]) oldVersion.get())[0];
+    }
+    
+    /**
+     * Get the minor number of the old version being upgraded
+     * from.
+     */    
+    final int getOldMinor() {
+        return ((int[]) oldVersion.get())[1];
+    }
+    
+    /**
+     * Return true if the old version is equal to or more
+     * recent that the passed in major and minor version.
+     */
+    boolean oldAtLeast(int requiredMajor, int requiredMinor) 
+    {
+        if (getOldMajor() > requiredMajor)
+            return true;
+        if ((getOldMajor() == requiredMajor)
+            && (getOldMinor() >= requiredMinor))
+            return true;
+        return false;
+    } 
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeChange.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeRun.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeRun.java?view=auto&rev=493247
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeRun.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeRun.java
Fri Jan  5 15:47:13 2007
@@ -0,0 +1,168 @@
+/*
+
+Derby - Class org.apache.derbyTesting.functionTests.tests.upgradeTests.UpgradeRun
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+*/
+package org.apache.derbyTesting.functionTests.tests.upgradeTests;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.security.AccessController;
+import java.util.Properties;
+
+import junit.extensions.TestSetup;
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.derbyTesting.junit.BaseTestCase;
+import org.apache.derbyTesting.junit.SecurityManagerSetup;
+import org.apache.derbyTesting.junit.SystemPropertyTestSetup;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+/**
+ * Utility class for creating a set of tests that
+ * comprise a complete upgrade run through all
+ * five phases. This includes handling the
+ * class loading for the old jar files
+ * and setting up the configuration to
+ * use a single use database and DataSource for
+ * connections.
+ *
+ */
+class UpgradeRun {
+    private static final String[] jarFiles = {
+            "derby.jar", 
+            //"derbynet.jar",
+            //"derbyclient.jar",
+            //"derbytools.jar"
+            };
+    
+    private static String getTextVersion(int[] iv)
+    {
+        String version = iv[0] + "." + iv[1] +
+        "." + iv[2] + "." + iv[3];
+        return version;
+    }
+
+    public final static Test suite(final int[] version) {
+        
+        TestSuite suite = new TestSuite(
+                "Upgrade Tests from " + getTextVersion(version));
+        
+        ClassLoader oldLoader = (ClassLoader )AccessController.doPrivileged
+        (new java.security.PrivilegedAction(){
+
+            public Object run(){
+            return createClassLoader(version);
+
+            }
+
+        }
+         );
+        
+        for (int phase = 0;
+              phase < UpgradeChange.PHASES.length; phase++)
+        {
+            ClassLoader loader = null;
+            switch (phase)
+            {
+            case UpgradeChange.PH_CREATE:
+            case UpgradeChange.PH_POST_SOFT_UPGRADE:
+            case UpgradeChange.PH_POST_HARD_UPGRADE:
+                loader = oldLoader;
+                break;
+            case UpgradeChange.PH_SOFT_UPGRADE:
+            case UpgradeChange.PH_HARD_UPGRADE:
+                break;
+                
+            }
+            Test phaseTests = baseSuite(
+                    "Upgrade Phase: " + UpgradeChange.PHASES[phase]);
+            
+            suite.addTest(new PhaseChanger(phaseTests, phase, loader, version));
+        }
+          
+        TestSetup setup = TestConfiguration.singleUseDatabaseDecorator(suite);
+        
+        Properties preReleaseUpgrade = new Properties();
+        preReleaseUpgrade.setProperty(
+                "derby.database.allowPreReleaseUpgrade", "true");
+        
+        setup = new SystemPropertyTestSetup(setup, preReleaseUpgrade);
+   
+        return SecurityManagerSetup.noSecurityManager(setup);
+    }
+    
+    private static Test baseSuite(String name) {
+        TestSuite suite = new TestSuite(name);
+        
+        suite.addTest(BasicSetup.suite());
+        
+        suite.addTest(Changes10_1.suite());
+                
+        return TestConfiguration.connectionDSDecorator(suite);
+    }
+    
+    /**
+     * Get the location of jars of old release. The location is specified 
+     * in the property "derbyTesting.jar.path".
+     *  
+     * @return location of jars of old release
+     */
+    private static String getOldJarLocation(int[] oldVersion) {
+        String jarPath = System.getProperty("derbyTesting.jar.path");
+        
+        Assert.assertNotNull("derbyTesting.jar.path not set", jarPath);
+      
+        String version = getTextVersion(oldVersion);
+        String jarLocation = jarPath + File.separator + version
+            + File.separator + "lib";
+                
+        return jarLocation;
+    }
+    
+    /**
+     * Create a class loader using jars in the specified location. Add all jars 
+     * specified in jarFiles and the testing jar.
+     * 
+     * @param jarLoc Location of jar files
+     * @return class loader
+     */
+    private static ClassLoader createClassLoader(int[] version)
+    {
+        URL[] url = new URL[jarFiles.length];
+        
+        String jarLocation = getOldJarLocation(version);
+        
+        for (int i=0; i < jarFiles.length; i++) {
+            try {
+                url[i] = new File(jarLocation + File.separator + jarFiles[i]).toURL();
+                System.out.println("URL " + url[i].toString());
+            } catch (MalformedURLException e) {
+                Assert.fail(e.toString());
+            }
+        }
+        
+        // Specify null for parent class loader to avoid mixing up 
+        // jars specified in the system classpath
+        return new URLClassLoader(url, null);       
+    }
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/UpgradeRun.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/_Suite.java?view=auto&rev=493247
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/_Suite.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/_Suite.java
Fri Jan  5 15:47:13 2007
@@ -0,0 +1,65 @@
+/*
+
+Derby - Class org.apache.derbyTesting.functionTests.tests.upgradeTests._Suite
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+*/
+package org.apache.derbyTesting.functionTests.tests.upgradeTests;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.derbyTesting.junit.BaseTestCase;
+
+/**
+ * Run the full upgrade suite. This is the only
+ * way to run tests in this package.
+ *
+ */
+public class _Suite extends BaseTestCase {
+    
+    private static final int[][] OLD_VERSIONS =
+    {
+        // {10, 0, 2, 1}, // 10.0.2.1 (incubator release)
+        {10, 1, 1, 0}, // 10.1.1.0 (Aug 3, 2005 / SVN 208786)
+        {10, 1, 2, 1}, // 10.1.2.1 (Nov 18, 2005 / SVN 330608)
+        {10, 1, 3, 1}, // 10.1.3.1 (Jun 30, 2006 / SVN 417277)
+        // {10, 2, 1, 6}, // 10.2.1.6 (Oct 02, 2006 / SVN 452058)
+        // {10, 2, 1, 6}, // 10.2.2.0 (Dec 12, 2006 / SVN 485682)
+    };
+
+
+    /**
+     * Use suite method instead.
+     */
+    private _Suite(String name) {
+        super(name);
+    }
+    
+    public static Test suite() {
+        
+        TestSuite suite = new TestSuite("Upgrade Suite");       
+
+        for (int i = 0; i < OLD_VERSIONS.length; i++) {
+            suite.addTest(UpgradeRun.suite(OLD_VERSIONS[i]));
+        }
+        
+        return suite;
+    }
+    
+
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/_Suite.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message