db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1082428 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TruncateTableTest.java
Date Thu, 17 Mar 2011 08:51:40 GMT
Author: kahatlen
Date: Thu Mar 17 08:51:40 2011
New Revision: 1082428

URL: http://svn.apache.org/viewvc?rev=1082428&view=rev
Log:
DERBY-5101: TruncateTableTest depends on implicit ordering of test cases

Added a workaround for DERBY-5139 so that the test doesn't fail when testSelfReferencing runs
first.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TruncateTableTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TruncateTableTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TruncateTableTest.java?rev=1082428&r1=1082427&r2=1082428&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TruncateTableTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TruncateTableTest.java
Thu Mar 17 08:51:40 2011
@@ -164,6 +164,20 @@ public class TruncateTableTest extends B
     public void testSelfReferencing() throws SQLException {
         Connection aliceConnection = openUserConnection( ALICE );
         Statement s = aliceConnection.createStatement();
+
+        // Workaround for DERBY-5139: If this test case happens to be running
+        // first, before the schema ALICE has been created, the CREATE TABLE
+        // statement below will fail. Normally, CREATE TABLE should create the
+        // ALICE schema automatically, but for some reason that doesn't happen
+        // when creating a self-referencing table. Create the schema manually
+        // for now, if it doesn't already exist.
+        try {
+            s.execute("CREATE SCHEMA ALICE");
+        } catch (SQLException sqle) {
+            // It's OK to fail if schema already exists.
+            assertSQLState("X0Y68", sqle);
+        }
+
         s.execute("create table self_referencing_t1(x int primary key, "
                 + "y int references self_referencing_t1)");
         s.execute("insert into self_referencing_t1 values (1, null), (2, 1)");



Mime
View raw message