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 ol...@apache.org on 2009/10/07 12:17:40 UTC
svn commit: r822641 -
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceTest.java
Author: ole
Date: Wed Oct 7 10:17:40 2009
New Revision: 822641
URL: http://svn.apache.org/viewvc?rev=822641&view=rev
Log:
DERBY-4393 - lang.SequenceTest fails w/ "Sequence 'ALPHA_SEQ' already exists." on phoneME/cvm.
Do cleanup in testcases to make the testcases independent of running order.
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceTest.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceTest.java?rev=822641&r1=822640&r2=822641&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceTest.java Wed Oct 7 10:17:40 2009
@@ -79,13 +79,16 @@
s.executeUpdate("DROP SEQUENCE mySeq1");
}
- public void testDuplicateCreationFailure() {
+ public void testDuplicateCreationFailure() throws SQLException {
+ Statement s = null;
try {
- Statement s = createStatement();
+ s = createStatement();
s.executeUpdate("CREATE SEQUENCE mySeq1");
s.executeUpdate("CREATE SEQUENCE mySeq1");
} catch (SQLException sqle) {
assertSQLState("X0Y68", sqle);
+ }finally{
+ s.executeUpdate("DROP SEQUENCE mySeq1"); // Drop the one created.
}
}
@@ -154,6 +157,9 @@
// should implicitly create schema ALPHA
assertStatementError("42507", stmtBeta, "DROP SEQUENCE alpha.alpha_seq");
+ // Cleanup:
+ stmtAlpha.executeUpdate("DROP SEQUENCE alpha_seq");
+
stmtAlpha.close();
stmtBeta.close();
alphaCon.close();
@@ -170,6 +176,7 @@
Connection alphaCon = openUserConnection(ALPHA);
Statement stmtAlpha = alphaCon.createStatement();
+ stmtAlpha.executeUpdate("CREATE SEQUENCE alpha_seq");
Connection betaCon = openUserConnection(BETA);
Statement stmtBeta = betaCon.createStatement();
@@ -177,6 +184,9 @@
// should implicitly create schema ALPHA
assertStatementError("42507", stmtBeta, "CREATE SEQUENCE alpha.alpha_seq3");
+ // Cleanup:
+ stmtAlpha.executeUpdate("DROP SEQUENCE alpha_seq");
+
stmtAlpha.close();
stmtBeta.close();
alphaCon.close();
Re: svn commit: r822641 -
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SequenceTest.java
Posted by "Dag H. Wanvik" <Da...@Sun.COM>.
ole@apache.org writes:
> - public void testDuplicateCreationFailure() {
> + public void testDuplicateCreationFailure() throws SQLException {
> + Statement s = null;
> try {
> - Statement s = createStatement();
> + s = createStatement();
> s.executeUpdate("CREATE SEQUENCE mySeq1");
> s.executeUpdate("CREATE SEQUENCE mySeq1");
Shouldn't there be a call to fail() here? If duplicate creation
succeeds, the test will silently pass. Not your patch, though, just
noticed reading it.
> } catch (SQLException sqle) {
> assertSQLState("X0Y68", sqle);
> + }finally{
> + s.executeUpdate("DROP SEQUENCE mySeq1"); // Drop the one created.
> }
> }