db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1136600 - in /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting: functionTests/tests/memory/TriggerTests.java junit/BaseJDBCTestCase.java
Date Thu, 16 Jun 2011 18:57:45 GMT
Author: mamta
Date: Thu Jun 16 18:57:45 2011
New Revision: 1136600

URL: http://svn.apache.org/viewvc?rev=1136600&view=rev
Log:
DERBY-5279 test5DeleteBeforeTriggerNoReferencingClause fails in nightly testing

In order to investigate the failure when it happens next time, I am changing the drop table
to ignore table does not exist error
but report all the other errors so we can see what the problem might be. Added a helper method
to BaseJDBCTestCase.java for drop
table.


Modified:
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java?rev=1136600&r1=1136599&r2=1136600&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java
(original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java
Thu Jun 16 18:57:45 2011
@@ -241,19 +241,11 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void basicSetup() throws SQLException{
-        Statement s = createStatement();
-		try {
-			s.execute("drop table table1");
-		} catch (SQLException sqle) {}
-
-		try {
-			s.execute("drop table table2");
-		} catch (SQLException sqle) {}
-
-		try {
-			s.execute("drop table table3");
-		} catch (SQLException sqle) {}
+        dropTable("TABLE1");
+        dropTable("TABLE2");
+        dropTable("TABLE3");
 
+        Statement s = createStatement();
 		try {
 			s.execute("drop trigger trigger1");
 		} catch (SQLException sqle) {}

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java?rev=1136600&r1=1136599&r2=1136600&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java
(original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java
Thu Jun 16 18:57:45 2011
@@ -779,7 +779,43 @@ public abstract class BaseJDBCTestCase
         rs.close();
         s.close();
     }
+    
+    /**
+     * Execute a DROP TABLE command using the passed in tableName as-is
+     * and the default connection.
+     * If the DROP TABLE fails because the table does not exist then
+     * the exception is ignored.
+     * @param tableName Table to be dropped.
+     * @throws SQLException
+     */
+    public final void dropTable(String tableName) throws SQLException
+    {
+       dropTable(getConnection(), tableName);
+    }
+
+    /**
+     * Execute a DROP TABLE command using the passed in tableName as-is.
+     * If the DROP TABLE fails because the table does not exist then
+     * the exception is ignored.
+     * @param conn Connection to execute the DROP TABLE
+     * @param tableName Table to be dropped.
+     * @throws SQLException
+     */
+    public static void dropTable(Connection conn, String tableName) throws SQLException
+    {
+        Statement statement = conn.createStatement();
+        String dropSQL = "DROP TABLE "  + tableName;
+        try {
 
+            statement.executeUpdate(dropSQL);
+        } catch (SQLException e) {
+            assertSQLState("42Y55", e);
+        }
+        finally {
+            statement.close();
+        }
+    }
+    
     /**
      * Assert that the query fails (either in compilation,
      * execution, or retrieval of results--doesn't matter)



Mime
View raw message