using spring's <jdbc:embedded-database> tag calls the init script twice
Description
For my tests to run, I need a database. Since I like the speed of H2 and the ability to start with a clean database of in-memory databases, I want to use Spring Frameworks jdbc:embedded-database construct. I have the following in my my-steps.xml
The file rx.sql contains SQL like "create table" and "insert into table" to get the database schema and sample data correct. When I run mvn integration-test or the MyStory runner, then I get an error that the first table in the list is already defined. I've traced it down to somehow the spring container is getting refresh() called and so it goes through and re-processes all the bean definitions, including running the sql script twice.
I can clearly see (when I turn org.springframework logging to debug) that the script is successfully run once, then later on it's called again.
Since this same technique is used in more traditional junit/spring based integration tests, I conclude that the issue is with jbehave.
For my tests to run, I need a database. Since I like the speed of H2 and the ability to start with a clean database of in-memory databases, I want to use Spring Frameworks jdbc:embedded-database construct.
I have the following in my my-steps.xml
The file rx.sql contains SQL like "create table" and "insert into table" to get the database schema and sample data correct.
When I run mvn integration-test or the MyStory runner, then I get an error that the first table in the list is already defined.
I've traced it down to somehow the spring container is getting refresh() called and so it goes through and re-processes all the bean definitions, including running the sql script twice.
I can clearly see (when I turn org.springframework logging to debug) that the script is successfully run once, then later on it's called again.
Since this same technique is used in more traditional junit/spring based integration tests, I conclude that the issue is with jbehave.