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 km...@apache.org on 2008/05/25 19:24:27 UTC
svn commit: r660002 - in /db/derby/code/branches/10.3/java:
engine/org/apache/derby/impl/jdbc/
testing/org/apache/derbyTesting/functionTests/tests/derbynet/
testing/org/apache/derbyTesting/functionTests/tests/lang/
testing/org/apache/derbyTesting/junit/
Author: kmarsden
Date: Sun May 25 10:24:27 2008
New Revision: 660002
URL: http://svn.apache.org/viewvc?rev=660002&view=rev
Log:
DERBY-3546 Failed to get database schemas of a JAR database
port 657937 from trunk.
also ported 599897 to add removeDir to BaseTestCase
Added:
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DBInJarTest.java
- copied unchanged from r657937, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DBInJarTest.java
Modified:
db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/ClientSideSystemPropertiesTest.java
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/DropDatabaseSetup.java
Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java?rev=660002&r1=660001&r2=660002&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java (original)
+++ db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData.java Sun May 25 10:24:27 2008
@@ -3545,14 +3545,15 @@
PreparedStatement s;
//We can safely goto system table since we are not in soft upgrade
//mode and hence metadata sql in system tables are uptodate
- //with this Derby release.
- if (notInSoftUpgradeMode())
+ //with this Derby release. We also need to be writable so
+ // that we can update SPS statements (DERBY-3546)
+ if (notInSoftUpgradeMode() && !isReadOnly())
s = getPreparedQueryUsingSystemTables(queryName, net);
else {
try {
//Can't use stored prepared statements because we are in soft upgrade
- //mode and hence need to get metadata sql from metadata.properties file
- //or metadata_net.properties
+ //mode or are read only, and hence need to get metadata sql from
+ //metadata.properties file or metadata_net.properties
String queryText = getQueryFromDescription(queryName, net);
s = getEmbedConnection().prepareMetaDataStatement(queryText);
} catch (Throwable t) {
Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/ClientSideSystemPropertiesTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/ClientSideSystemPropertiesTest.java?rev=660002&r1=660001&r2=660002&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/ClientSideSystemPropertiesTest.java (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/ClientSideSystemPropertiesTest.java Sun May 25 10:24:27 2008
@@ -89,33 +89,8 @@
protected void tearDown() throws Exception
{
super.tearDown();
- //Making ClientSideSystemPropertiesTest class implement
- //java.security.PrivilegedExceptionAction didn't work because compiler
- //kept getting confused between the run method in
- //java.security.PrivilegedExceptionAction and the run method in
- //junit.framework.TestCase
- //To get around this, I have created an inline class which implements
- //java.security.PrivilegedAction and implements the run method
- //to delete the traceDirector and all the files under it.
- AccessController.doPrivileged
- (new java.security.PrivilegedAction(){
- public Object run(){
- File dir = new File(getSystemProperty("derby.client.traceDirectory"));
- int fileCounter = 0;
- File[] list = dir.listFiles();
- File tempFile;
- //delete all the files under trace Directory
- for (;fileCounter<list.length; fileCounter++)
- {
- tempFile = list[fileCounter];
- tempFile.delete();
- }
- //now delete the trace Directory
- dir.delete();
- return null;
- }
- }
- );
+
+ removeDirectory(getSystemProperty("derby.client.traceDirectory"));
}
/* ------------------- end helper methods -------------------------- */
Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java?rev=660002&r1=660001&r2=660002&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java Sun May 25 10:24:27 2008
@@ -142,6 +142,8 @@
// also, test calls procedures which use DriverManager
// to get the default connection.
suite.addTest(GrantRevokeDDLTest.suite());
+ // Test uses DriverManager to connect to database in jar.
+ suite.addTest(DBInJarTest.suite());
}
return suite;
Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java?rev=660002&r1=660001&r2=660002&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java Sun May 25 10:24:27 2008
@@ -377,4 +377,21 @@
}
});
}
+
+ /**
+ * Remove the directory and its contents.
+ * @param path Path of the directory
+ */
+ public static void removeDirectory(String path)
+ {
+ DropDatabaseSetup.removeDirectory(path);
+ }
+ /**
+ * Remove the directory and its contents.
+ * @param fir File of the directory
+ */
+ public static void removeDirectory(File dir)
+ {
+ DropDatabaseSetup.removeDirectory(dir);
+ }
} // End class BaseTestCase
Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/DropDatabaseSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/DropDatabaseSetup.java?rev=660002&r1=660001&r2=660002&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/DropDatabaseSetup.java (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/DropDatabaseSetup.java Sun May 25 10:24:27 2008
@@ -95,6 +95,10 @@
static void removeDirectory(String path)
{
final File dir = new File(path);
+ removeDirectory(dir);
+ }
+
+ static void removeDirectory(final File dir) {
AccessController.doPrivileged(new java.security.PrivilegedAction() {
public Object run() {