You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ma...@apache.org on 2009/09/13 02:38:53 UTC

svn commit: r814256 - in /db/derby/code/branches/10.4: ./ java/testing/org/apache/derbyTesting/functionTests/tests/store/ClassLoaderBootTest.java java/testing/org/apache/derbyTesting/junit/JDBCDataSource.java

Author: mamta
Date: Sun Sep 13 00:38:52 2009
New Revision: 814256

URL: http://svn.apache.org/viewvc?rev=814256&view=rev
Log:
DERBY-4361

Backport to 10.4

Modified:
    db/derby/code/branches/10.4/   (props changed)
    db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/store/ClassLoaderBootTest.java
    db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/junit/JDBCDataSource.java

Propchange: db/derby/code/branches/10.4/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Sep 13 00:38:52 2009
@@ -1 +1,2 @@
-/db/derby/code/trunk:788436,793588,794303,796316,796372,797147,798347,798742,800523,803548,805696,809643
+/db/derby/code/branches/10.5:814216
+/db/derby/code/trunk:788436,793588,794303,796316,796372,797147,798347,798742,800523,803548,805696,809643,812669

Modified: db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/store/ClassLoaderBootTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/store/ClassLoaderBootTest.java?rev=814256&r1=814255&r2=814256&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/store/ClassLoaderBootTest.java (original)
+++ db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/store/ClassLoaderBootTest.java Sun Sep 13 00:38:52 2009
@@ -221,18 +221,19 @@
             Connection conn1 = ds_1.getConnection();
             // now attemp to boot using another class loader.
             setThreadLoader(loader_2);
+            DataSource ds_2 = JDBCDataSource.getDataSource();
             try {
-                DataSource ds_2 = JDBCDataSource.getDataSource();
                 ds_2.getConnection();
                 fail("booted database that was already booted by another CLR");
             } catch (SQLException e) {
                 SQLException ne = e.getNextException();
                 assertPreventDualBoot(ne);
+                JDBCDataSource.shutEngine(ds_2);
             }
             
-            // shutdown the database.
+            // shutdown the engine.
             setThreadLoader(loader_1);
-            JDBCDataSource.shutdownDatabase(ds_1);
+            JDBCDataSource.shutEngine(ds_1);
             
         } catch (SQLException se) {
             dumpSQLException(se);
@@ -262,9 +263,9 @@
             setThreadLoader(loader_2);
             DataSource ds_2 = JDBCDataSource.getDataSource();
             ds_2.getConnection();
-            // shutdown the database.
-            JDBCDataSource.shutdownDatabase(ds_2);
-            
+            // shutdown the engine for both the class loaders.
+            JDBCDataSource.shutEngine(ds_2);            
+            JDBCDataSource.shutEngine(ds_1);
         } catch (SQLException se) {
             dumpSQLException(se);
         }finally {

Modified: db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/junit/JDBCDataSource.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/junit/JDBCDataSource.java?rev=814256&r1=814255&r2=814256&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/junit/JDBCDataSource.java (original)
+++ db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/junit/JDBCDataSource.java Sun Sep 13 00:38:52 2009
@@ -25,6 +25,8 @@
 import java.util.HashMap;
 import java.util.Iterator;
 
+import javax.sql.DataSource;
+
 import junit.framework.Assert;
 
 /**
@@ -263,4 +265,22 @@
             clearStringBeanProperty(ds, "shutdownDatabase");
         }
     }
+
+    /**
+     * Shutdown the engine described by this data source.
+     * The shutdownDatabase property is cleared by this method.
+     */
+    public static void shutEngine(javax.sql.DataSource ds) throws SQLException {
+        setBeanProperty(ds, "shutdownDatabase", "shutdown");
+        JDBCDataSource.setBeanProperty(ds, "databaseName", "");
+        try {
+            ds.getConnection();
+            Assert.fail("Engine failed to shut down");
+        } catch (SQLException e) {
+             BaseJDBCTestCase.assertSQLState("Engine shutdown", "XJ015", e);
+        } finally {
+            clearStringBeanProperty(ds, "shutdownDatabase");
+        }
+    }
+
 }