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 dj...@apache.org on 2006/11/06 19:39:18 UTC
svn commit: r471808 - in
/db/derby/code/trunk/java/testing/org/apache/derbyTesting:
functionTests/tests/derbynet/ShutDownDBWhenNSShutsDownTest.java
junit/BaseJDBCTestCase.java junit/TestConfiguration.java
Author: djd
Date: Mon Nov 6 10:39:16 2006
New Revision: 471808
URL: http://svn.apache.org/viewvc?view=rev&rev=471808
Log:
DERBY-2043 DERBY-2047 (partial) More connection utility method cleanup to provide a single consistent
shutdownEngine() method.
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/ShutDownDBWhenNSShutsDownTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/ShutDownDBWhenNSShutsDownTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/ShutDownDBWhenNSShutsDownTest.java?view=diff&rev=471808&r1=471807&r2=471808
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/ShutDownDBWhenNSShutsDownTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/ShutDownDBWhenNSShutsDownTest.java Mon Nov 6 10:39:16 2006
@@ -24,6 +24,7 @@
import org.apache.derbyTesting.functionTests.util.TestUtil;
import org.apache.derbyTesting.junit.BaseJDBCTestCase;
import org.apache.derbyTesting.junit.BaseTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
import org.apache.derby.drda.NetworkServerControl;
import junit.framework.*;
@@ -79,12 +80,7 @@
Thread.sleep(500);
// shut down the engine
- try {
- getConnection("", "shutdown=true");
- fail("shutdown didn't raise exception");
- } catch (SQLException sqle) {
- assertSQLState("XJ015", sqle);
- }
+ TestConfiguration.getCurrent().shutdownEngine();
// see if it is still possible to connect to the server (before
// DERBY-1326, this would hang)
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java?view=diff&rev=471808&r1=471807&r2=471808
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java Mon Nov 6 10:39:16 2006
@@ -200,24 +200,6 @@
initializeConnection(conn);
return conn;
}
-
- /**
- * Get a connection to a database using the specified connection
- * attributes.
- *
- * @param databaseName database to connect to
- * @param connAttrs connection attributes
- * @return connection to database
- * @throws SQLException
- */
- public Connection getConnection(String databaseName, String connAttrs)
- throws SQLException
- {
- Connection conn = getTestConfiguration().getConnection(databaseName,
- connAttrs);
- initializeConnection(conn);
- return conn;
- }
/**
* Run a SQL script through ij discarding the output
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java?view=diff&rev=471808&r1=471807&r2=471808
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java Mon Nov 6 10:39:16 2006
@@ -588,7 +588,7 @@
* @return connection to database.
* @throws SQLException
*/
- public Connection getDefaultConnection(String connAttrs)
+ private Connection getDefaultConnection(String connAttrs)
throws SQLException {
return getConnection(getDatabaseName(), connAttrs);
}
@@ -602,7 +602,7 @@
* @return connection to database.
* @throws SQLException
*/
- public Connection getConnection (String databaseName, String connAttrs)
+ private Connection getConnection (String databaseName, String connAttrs)
throws SQLException {
Connection con = null;
JDBCClient client =getJDBCClient();
@@ -644,6 +644,20 @@
}
}
+ /**
+ * Shutdown the engine for this configuration
+ * assuming it is booted.
+ *
+ */
+ public void shutdownEngine()
+ {
+ try {
+ getConnection("", "shutdown=true");
+ Assert.fail("Engine failed to shut down");
+ } catch (SQLException e) {
+ BaseJDBCTestCase.assertSQLState("Engine shutdown", "XJ015", e);
+ }
+ }
/**
* Set the verbosity, i.e., whether debug statements print.
*/