Assuming your directory structure is based on the standard tapestry-maven project, as created using this method:
http://tapestryjava.blogspot.com/2009/01/using-maven-to-create-new-tapestry-51.html
here is how to tell junit to use a separate database (so it does not interfere with your development database)
1. Make a copy of the hibernate.cfg.xml to your src/test/resources
2. Point it to a different (test) database:
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/nesteggtest</property>
*** IF you just stop here, your development will use the hibernate.cfg.xml from your test, simply because of the default classpath! ***
** To make your development use the correct hibernate.cfg.xml, do this:
3. Assuming you are using Eclipse and run-jetty-run: go to Run->OPen Run Dialog
4. Select your run-jetty-run configuration
5. Go to classpath and add your target/WEB-INF directory (this will contain the hibernate.cfg.xml for the development)
6. Move this directory (target/WEB-INF) to the top (so that it is the first one to be looked in during development)
No comments:
Post a Comment