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/04 03:47:30 UTC
svn commit: r471104 -
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/CleanDatabaseTestSetup.java
Author: djd
Date: Fri Nov 3 18:47:29 2006
New Revision: 471104
URL: http://svn.apache.org/viewvc?view=rev&rev=471104
Log:
DERBY-2033 (partial) Add login in CleanDatabaseTestSetup to unset database properties as
part of the cleanup. Specifcally unset derby.database.classpath for the DatabaseClassLoadingTest
but others can be added in the future.
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/CleanDatabaseTestSetup.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/CleanDatabaseTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/CleanDatabaseTestSetup.java?view=diff&rev=471104&r1=471103&r2=471104
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/CleanDatabaseTestSetup.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/CleanDatabaseTestSetup.java Fri Nov 3 18:47:29 2006
@@ -107,6 +107,43 @@
* @throws SQLException database error
*/
public static void cleanDatabase(Connection conn) throws SQLException {
+ clearProperties(conn);
+ removeObjects(conn);
+
+ }
+
+ /**
+ * Set of database properties that will be set to NULL (unset)
+ * as part of cleaning a database.
+ */
+ private static final String[] CLEAR_DB_PROPERTIES =
+ {
+ "derby.database.classpath",
+ };
+
+ /**
+ * Clear all database properties.
+ */
+ private static void clearProperties(Connection conn) throws SQLException {
+
+ PreparedStatement ps = conn.prepareCall(
+ "CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY(?, NULL)");
+
+ for (int i = 0; i < CLEAR_DB_PROPERTIES.length; i++)
+ {
+ ps.setString(1, CLEAR_DB_PROPERTIES[i]);
+ ps.executeUpdate();
+ }
+ ps.close();
+ conn.commit();
+ }
+
+
+ /**
+ * Remove all objects in all schemas from the database.
+ */
+ private static void removeObjects(Connection conn) throws SQLException {
+
DatabaseMetaData dmd = conn.getMetaData();
SQLException sqle = null;