db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-5107) BasicInMemoryDbTest depends on implicit ordering of test cases
Date Wed, 16 Mar 2011 19:54:29 GMT

     [ https://issues.apache.org/jira/browse/DERBY-5107?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Knut Anders Hatlen updated DERBY-5107:

    Attachment: derby-5107-1a.diff

Attaching a patch to address the problems seen in BasicInMemoryDbTest. It makes the following

1) Call super.tearDown() from tearDown(). This doesn't directly address any of the problems
reported here, but cleaning up the default connection (used only by some of the test cases)
sounds useful in any case.

2) Use the helper class MemoryDbManager to create the database in testEnginehutdown(). This
ensures that the created database is dropped in tearDown() and doesn't cause any problems
if testShutdown() is invoked later.

3) Make sure the JDBC driver is loaded in the tests that use DriverManager directly, so that
we don't get the "no suitable driver" error if they run before any of the test cases that
get the driver loaded implicitly via the framework.

> BasicInMemoryDbTest depends on implicit ordering of test cases
> --------------------------------------------------------------
>                 Key: DERBY-5107
>                 URL: https://issues.apache.org/jira/browse/DERBY-5107
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions:
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: derby-5107-1a.diff
> BasicInMemoryDbTest only works if the test cases run in one particular order. This should
either be made explicit in the test, or the test should be changed to work regardless of the
> For example, if testEnginehutdown (sic) runs before testShutdown, testShutdown will fail:
> http://dbtg.foundry.sun.com/derby/test/Daily/jvm1.7/testing/testlog/lin/1076682-suitesAll_diff.txt
> 11) testShutdown(org.apache.derbyTesting.functionTests.tests.memorydb.BasicInMemoryDbTest)junit.framework.AssertionFailedError:
Warning(s) when creating database: Database 'memory:/tmp/myDB' not created, connection made
to existing database instead.
> 	at org.apache.derbyTesting.functionTests.tests.memorydb.MemoryDbManager.createDatabase(MemoryDbManager.java:226)
> 	at org.apache.derbyTesting.functionTests.tests.memorydb.MemoryDbManager.createDatabase(MemoryDbManager.java:181)
> 	at org.apache.derbyTesting.functionTests.tests.memorydb.BasicInMemoryDbTest.testShutdown(BasicInMemoryDbTest.java:189)
> Also, when running from classes, some test cases (like testEnginehutdown and testDeleteWhenInUse)
will fail with no suitable driver if they run before some other test case has called MemoryDbManager.getConnection():
> 1) testEnginehutdown(org.apache.derbyTesting.functionTests.tests.memorydb.BasicInMemoryDbTest)java.sql.SQLException:
No suitable driver found for jdbc:derby:memory:/tmp/myDB;create=true
> 	at java.sql.DriverManager.getConnection(DriverManager.java:640)
> 	at java.sql.DriverManager.getConnection(DriverManager.java:222)
> 	at org.apache.derbyTesting.functionTests.tests.memorydb.BasicInMemoryDbTest.testEnginehutdown(BasicInMemoryDbTest.java:209)

This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message