On Mon, Aug 17, 2009 at 1:59 PM, David Blevins <[email protected]>wrote:
> I had a look in the "destroy" code and we do unbind all configured
> resources from JNDI so they will be garbage collected, as well we call
> stop() on all ResourceAdapter impls. The DataSource pool doesn't implement
> the ResourceAdapter interface so therefore isn't getting explicitly closed.
> We use a variation of commons-dbcp, looking around to see if there's some
> way to close the pool -- don't see anything just yet.
OK, that might give me something to go on.
> One clever way to work around the issue with the existing code might be to
> specify a different in memory db name for each test. Maybe something like:
>
> properties.setProperty("test.JdbcUrl", testDatabaseConnectionURL +
> (count++));
>
Yeah, I thought of that too; haven't tried it. I am suspicious, because my
persistence.xml JTA DataSource name would remain the same, and I just have
this funny feeling that something in OpenJPA-land will cache the DDL or
something for a persistence unit whose name and DataSource don't change.
Admittedly, this part is all supposition. I'll give it a shot.
> Would be cool if Junit could inject the test name so you could use that as
> the in-memory db name.
Agreed, although these days JUnit 4.x doesn't have test names any more.
:-( Unless I'm missing something in their immaculately documented {cough
cough} API.
Best,
Laird