Derby
  1. Derby
  2. DERBY-4393

lang.SequenceTest fails w/ "Sequence 'ALPHA_SEQ' already exists." on phoneME/cvm

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.6.1.0
    • Fix Version/s: 10.6.1.0
    • Component/s: Test
    • Labels:
      None
    • Environment:
    • Bug behavior facts:
      Regression Test Failure

      Description

      Seen since 2009-09-03. Possibly related to DERBY-4284 / svn 811009?

      See e.g. http://dbtg.foundry.sun.com/derby/test/Daily/javaME/testing/testlog/ubuntu/820325-suitesAll_diff.txt

      20) testCreateWithSchemaDropWithNoSchema(org.apache.derbyTesting.functionTests.tests.lang.SequenceTest)java.sql.SQLException: Sequence 'ALPHA_SEQ' already exists.
      at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
      at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown Source)
      at org.apache.derbyTesting.functionTests.tests.lang.SequenceTest.testCreateWithSchemaDropWithNoSchema(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestCase.runBare(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at sun.misc.CVM.runMain(Unknown Source)
      Caused by: ERROR X0Y68: Sequence 'ALPHA_SEQ' already exists.
      at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
      at org.apache.derby.impl.sql.execute.CreateSequenceConstantAction.executeConstantAction(Unknown Source)
      at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
      at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
      at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
      ... 55 more
      21) testCreateWithSchemaSpecifiedCreateTrue(org.apache.derbyTesting.functionTests.tests.lang.SequenceTest)java.sql.SQLException: Sequence 'ALPHA_SEQ' already exists.
      at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
      at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown Source)
      at org.apache.derbyTesting.functionTests.tests.lang.SequenceTest.testCreateWithSchemaSpecifiedCreateTrue(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestCase.runBare(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at sun.misc.CVM.runMain(Unknown Source)
      Caused by: ERROR X0Y68: Sequence 'ALPHA_SEQ' already exists.
      at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
      at org.apache.derby.impl.sql.execute.CreateSequenceConstantAction.executeConstantAction(Unknown Source)
      at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
      at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
      at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
      ... 55 more
      22) testCreateWithSchemaSpecified(org.apache.derbyTesting.functionTests.tests.lang.SequenceTest)java.sql.SQLException: Sequence 'ALPHA_SEQ' already exists.
      at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
      at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown Source)
      at org.apache.derbyTesting.functionTests.tests.lang.SequenceTest.testCreateWithSchemaSpecified(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestCase.runBare(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at sun.misc.CVM.runMain(Unknown Source)
      Caused by: ERROR X0Y68: Sequence 'ALPHA_SEQ' already exists.
      at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
      at org.apache.derby.impl.sql.execute.CreateSequenceConstantAction.executeConstantAction(Unknown Source)
      at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
      at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
      at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
      ... 55 more
      23) testImplicitSchemaCreation(org.apache.derbyTesting.functionTests.tests.lang.SequenceTest)java.sql.SQLException: Sequence 'ALPHA_SEQ' already exists.
      at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
      at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown Source)
      at org.apache.derbyTesting.functionTests.tests.lang.SequenceTest.testImplicitSchemaCreation(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestCase.runBare(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at sun.misc.CVM.runMain(Unknown Source)
      Caused by: ERROR X0Y68: Sequence 'ALPHA_SEQ' already exists.
      at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
      at org.apache.derby.impl.sql.execute.CreateSequenceConstantAction.executeConstantAction(Unknown Source)
      at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
      at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
      at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
      ... 55 more
      24) testDropSequence(org.apache.derbyTesting.functionTests.tests.lang.SequenceTest)java.sql.SQLException: Sequence 'MYSEQ1' already exists.
      at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
      at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown Source)
      at org.apache.derbyTesting.functionTests.tests.lang.SequenceTest.testDropSequence(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestCase.runBare(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at junit.extensions.TestDecorator.basicRun(Unknown Source)
      at junit.extensions.TestSetup$1.protect(Unknown Source)
      at junit.extensions.TestSetup.run(Unknown Source)
      at sun.misc.CVM.runMain(Unknown Source)
      Caused by: ERROR X0Y68: Sequence 'MYSEQ1' already exists.
      at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
      at org.apache.derby.impl.sql.execute.CreateSequenceConstantAction.executeConstantAction(Unknown Source)
      at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
      at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
      at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
      ... 55 more

      1. DERBY-4393_4.diff.txt
        2 kB
        Ole Solberg
      2. DERBY-4393_3.diff.txt
        2 kB
        Ole Solberg
      3. DERBY-4393_2.diff.txt
        1 kB
        Ole Solberg
      4. DERBY-4393_1.diff.txt
        0.7 kB
        Ole Solberg

        Issue Links

          Activity

          Hide
          Dag H. Wanvik added a comment -

          It seems the success of this test is dependent on the order of the fixtures:

          testDropOtherSchemaSequence faisl to drop alpha.alpha_seq, so if that fixture is run before
          testCreateWithSchemaDropWithNoSchema, the latter would fail as seen.

          Show
          Dag H. Wanvik added a comment - It seems the success of this test is dependent on the order of the fixtures: testDropOtherSchemaSequence faisl to drop alpha.alpha_seq, so if that fixture is run before testCreateWithSchemaDropWithNoSchema, the latter would fail as seen.
          Hide
          Ole Solberg added a comment -

          Partial patch. Cleanup (drop) for "CREATE SEQUENCE alpha_seq".
          Does NOT fix the failure in SequenceTest on phoneME/cvm:
          There was 1 failure:
          1) testCreateOtherSchemaSequence(org.apache.derbyTesting.functionTests.tests.lang.SequenceTest)junit.framework.ComparisonFailure: Unexpected SQL state. expected:<4250[7]> but was:<4250[8]>

          Show
          Ole Solberg added a comment - Partial patch. Cleanup (drop) for "CREATE SEQUENCE alpha_seq". Does NOT fix the failure in SequenceTest on phoneME/cvm: There was 1 failure: 1) testCreateOtherSchemaSequence(org.apache.derbyTesting.functionTests.tests.lang.SequenceTest)junit.framework.ComparisonFailure: Unexpected SQL state. expected:<4250 [7] > but was:<4250 [8] >
          Hide
          Ole Solberg added a comment -

          DERBY-4393_2.diff.txt replaces DERBY-4393_1.diff.txt:
          adding cleanup in 'testDuplicateCreationFailure()'.

          Show
          Ole Solberg added a comment - DERBY-4393 _2.diff.txt replaces DERBY-4393 _1.diff.txt: adding cleanup in 'testDuplicateCreationFailure()'.
          Hide
          Ole Solberg added a comment -

          DERBY-4393_3.diff.txt replaces DERBY-4393_2.diff.txt.

          This patch also fixes the
          '1) testCreateOtherSchemaSequence(org.apache.derbyTesting.functionTests.tests.lang.SequenceTest)junit.framework.ComparisonFailure: Unexpected SQL state. expected:<4250[7]> but was:<4250[8]> '
          problem by forcing the 'ALPHA' schema to be created/existing when testCreateOtherSchemaSequence is run.

          Show
          Ole Solberg added a comment - DERBY-4393 _3.diff.txt replaces DERBY-4393 _2.diff.txt. This patch also fixes the '1) testCreateOtherSchemaSequence(org.apache.derbyTesting.functionTests.tests.lang.SequenceTest)junit.framework.ComparisonFailure: Unexpected SQL state. expected:<4250 [7] > but was:<4250 [8] > ' problem by forcing the 'ALPHA' schema to be created/existing when testCreateOtherSchemaSequence is run.
          Hide
          Rick Hillegas added a comment -

          This is a familiar problem on the phoneME platform, where the tests run in the opposite order that they run on other VMs. When I write test cases, I tackle this problem by putting some unique identifier in the name of the test case and then incorporating that identifier into the names of all the schema objects referenced by the test case. This is a simple way to guarantee that the object names won't collide if the tests run in a different order.

          So for instance, the first test case would look like this:

          public void test_01_CreateSequence() throws SQLException

          { Statement s = createStatement(); s.executeUpdate("CREATE SEQUENCE mySeq_01"); }

          An alternative solution would be to put some logic in the tearDown() method to destroy the schemas created by the test cases.

          I don't recommend putting cleanup logic in the test cases themselves. That approach is brittle because a test case can fail before it gets to its cleanup logic. The previous two approaches don't have this problem.

          Show
          Rick Hillegas added a comment - This is a familiar problem on the phoneME platform, where the tests run in the opposite order that they run on other VMs. When I write test cases, I tackle this problem by putting some unique identifier in the name of the test case and then incorporating that identifier into the names of all the schema objects referenced by the test case. This is a simple way to guarantee that the object names won't collide if the tests run in a different order. So for instance, the first test case would look like this: public void test_01_CreateSequence() throws SQLException { Statement s = createStatement(); s.executeUpdate("CREATE SEQUENCE mySeq_01"); } An alternative solution would be to put some logic in the tearDown() method to destroy the schemas created by the test cases. I don't recommend putting cleanup logic in the test cases themselves. That approach is brittle because a test case can fail before it gets to its cleanup logic. The previous two approaches don't have this problem.
          Hide
          Dag H. Wanvik added a comment - - edited

          I like the idiom of the

          new CleanDatabaseTestSetup(suite) {
          /**

          • Creates the tables used in the test cases.
          • @exception SQLException if a database error occurs
            */
            protected void decorateSQL(Statement s) throws SQLException { // DDL }

            }

          since, then the cleanup is automatic after each fixture and no convention is needed.

          • Edited 2009-10-06: Correction: The cleanup happens only after the entire test has been run, so it does not solve the problem of the test cases inside one test messing up for each other. Another option is to set autocommit off and then never commit inside a test case. The teardown method will roll back any changes made (Knut's suggestion, thx). *
          Show
          Dag H. Wanvik added a comment - - edited I like the idiom of the new CleanDatabaseTestSetup(suite) { /** Creates the tables used in the test cases. @exception SQLException if a database error occurs */ protected void decorateSQL(Statement s) throws SQLException { // DDL } } since, then the cleanup is automatic after each fixture and no convention is needed. Edited 2009-10-06: Correction: The cleanup happens only after the entire test has been run, so it does not solve the problem of the test cases inside one test messing up for each other. Another option is to set autocommit off and then never commit inside a test case. The teardown method will roll back any changes made (Knut's suggestion, thx). *
          Hide
          Ole Solberg added a comment -

          DERBY-4393_4.diff.txt replaces DERBY-4393_3.diff.txt.
          Still has the cleanup logic in the testcase, but uses a more "symmetric" approach.
          I found creating a tearDown difficult for this suite - but I may be missing something.

          The 'new CleanDatabaseTestSetup(suite)

          { ... }

          ' idiom is already used so after the suite is done everything should be clean, even if some testcase in the suite does not behave well.

          Show
          Ole Solberg added a comment - DERBY-4393 _4.diff.txt replaces DERBY-4393 _3.diff.txt. Still has the cleanup logic in the testcase, but uses a more "symmetric" approach. I found creating a tearDown difficult for this suite - but I may be missing something. The 'new CleanDatabaseTestSetup(suite) { ... } ' idiom is already used so after the suite is done everything should be clean, even if some testcase in the suite does not behave well.
          Hide
          Ole Solberg added a comment -

          DERBY-4393_4.diff.txt committed to trunk as revision 822641.

          Show
          Ole Solberg added a comment - DERBY-4393 _4.diff.txt committed to trunk as revision 822641.

            People

            • Assignee:
              Ole Solberg
              Reporter:
              Ole Solberg
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development