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 ka...@apache.org on 2011/03/17 09:51:40 UTC
svn commit: r1082428 -
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TruncateTableTest.java
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)");