Monday, January 7, 2008

Spring's Petclinic Sample, Impala style

I've spent a bit of time converting the Spring Petclinic sample so that it runs with Impala. Petclinic it is actually a showcase for the various Spring data access technologies. I've cut down the Impala Petclinic sample to work with following configuration:
  • data access using Hibernate
  • MySQL database
  • simple service and web tiers
To run the application, follow these steps:
  • svn co http://impala.googlecode.com/svn/trunk/petclinic petclinic
  • Open Eclipse, with the workspace set to the checkout directory (petclinic)
Now set up the database:
  • First, from petclinic/db, run createDB.txt (as root). This creates the petclinic user
    mysql -u root -p < createDB.txt
  • Then as the petclinic user, insert the tables
    mysql -u petclinic -ppetclinic petclinic < initDB.txt
  • To insert data, run
    mysql -u petclinic -ppetclinic petclinic < populateDB.txt
To run the tests from Eclipse, simply run the main class AllTests as a JUnit test, which is in the project petclinic-tests.

To run up the web application, simply run the main class StartServer, which is in the project petclinic-web. This time, run it as a (main) Java application.

To run up the interactive test runner, run HibernateClinicTest as a Java application. Type u for usage. You can run this class as a standard JUnit test - it's part of the AllTests suite.

Next on my list is to create a sample based on Spring's Petstore sample (originally Clinton Begin's JPetstore application, a sample with a rather long history). This is more interesting, as it is a larger application with a greater variety of components, so should be an interesting showcase for Impala.

No comments: