Re: [Beankeeper-discussion] newbie using in memory hsql for unit tests and failing
Brought to you by:
demonsystem
From: Brautigam R. <de...@ne...> - 2009-06-11 11:11:22
|
Emily Green írta: > Hi, Hi, > I'm new to Beankeeper. It's looks absolutely perfect for the thing I'm > currently working on at the mo that's got enough database use to be too > annoying to program directly, but not enough to make something a bit > more bloated like Hibernate seem worthwhile (goodness I loathe those XML > files!). > > Anyhow, I have a quick question - I'm probably doing some sort of newbie > daft thing. When I write unit tests I normally use an in memory HSQL > database, but I'm finding that when I do this through Beankeeper the > database isn't shutdown and recreated properly between tests. I've > written a hopefully simple example to show what I mean. What happens is > that each of the two tests run fine on their own, but when ran together > the results of the first test are left in the database causing the > second test to fail as it finds two records rather than the expected one. The problem is, BeanKeeper does not issue a direct SHUTDOWN command to hsqldb, so the database in theory still lives on after all the connections to it are closed. You can try specifying the "shutdown=true" parameter to your hsqldb url to force hsqldb to shutdown after the connections are closed. Robert. |