What does your Spring configuration for integration tests look like using an embedded h2 datasource and, optionally, JUnit?
My first try with a SingleConnectionDataSource basically worked, but failed on more complicated tests where you need several connections at the same time or suspended transactions. I think h2 in tcp based server mode might work as well, but this is probably not the fastest communication mode for a temporary embedded database in memory.
What are the possibilities and their advantages / disadvantages? Also, how do you create the tables / populate the database?
Update: Let's specify some concrete requirements that are important for such tests.
- The database should be temporary and in memory
- The connection should probably not use tcp, for speed requirements
- It would be nice if I could use a database tool to inspect the content of the database during debugging
- We have to define a datasource since we can't use the application servers datasource in unit tests