INTEGRATION TEST IN ECLIPSE WITH EMBEDDED OPENEJB

The embedded OpenEJB server will use an in-memory HSQLDB database. The significance of in-memory is that it will start empty and be discarded afterwards. We specify the database in business/src/test/conf-openejb-local/openejb.xml, and we will set system property openejb.configuration to that file.

  • Choose Run > Run Configurations.... The Run Configurations window will appear.
  • Right-click on JUnit and choose New.
  • Set Test Runner to JUnit 4.
  • Set the other variables to values similar to those in the screen shot on the right.
  • Click on the Arguments tab.
  • Set the VM arguments to the following, replacing the value of openejb.home with yours, eg.:
    -Dopenejb.home=../openejb-4.0.0
    -Dopenejb.configuration=business/src/test/conf/openejb.xml
    -Dhibernate.hbm2ddl.auto=update
  • The openejb.xml file configures openejb to use a different database: an in-memory database. These properties are explained here: openejb, hibernate.
  1. Click on the Classpath tab.
  2. Remove the (default classpath) entry.
  3. Click on User Entries.
  4. Add folder business/src/test/conf/ .
  5. Add folder collapsed/jumpstart.war/WEB-INF/classes/ .
  6. Add user library openejb-4.0.0-lib.
  7. Add all JARs from these folders:
    business/src/main/lib-compile/
    business/src/main/lib-runtime/ (actually, lib-runtime is empty)
    business/src/test/lib-test/
    business/src/test/lib-test-hibernate/
  8. Move the two folders to the top. It avoids conflicts.

 

©2008, 2018 Geoff Callender, Sydney, Australia