INTEGRATION TEST WITH REMOTE GLASSFISH 2.1

Prepare Glassfish 2.1 for JumpStart

Prepare the build

Either build and run the tests from Ant...

Ant will compile, package and deploy jumpstart.ear to the server, wait for it to load, then run the integration test suite which will test through the session beans running in the server.

...or build with Ant and run/debug the tests from Eclipse

First, use Ant to compile, package and deploy jumpstart.ear to the server and wait for it to load:

Second, create a User Library over Glassfish:

Run the integration test suite from Eclipse:

  • Set Test Runner to JUnit 4.
  • Set the other variables as shown in the diagram on the left.
  1. Remove the (default classpath) entry. It will be the project name followed by (default classpath). Remove it.
  2. Click on User Entries.
  3. Add conf-glassfish-remote from business tests. Choose Advanced... > Add Folders, then from your project choose business/src/test/conf-glassfish-remote/.
  4. Add jumpstart.jar from exploded. Choose Advanced... > Add Folders, then from your project choose exploded/jumpstart.ear/jumpstart.jar/.
  5. Add JARs from business libs. Choose Add JARs..., open your project, then choose these JARs:
  6. Add Glassfish from user libraries. Choose Advanced... > Add Library > User Library, then select your glassfish-client-lib library.
  7. Move conf and jumpstart.jar to the top to avoid any conflicts.
Of course, since JumpStart is now running in your server, you can visit it with your web browser at http://yourserver:8080/jumpstart.

Problems? Eclipse might not be ready for junit - see Could not create task or type of type: junit.

 

©2008 Geoff Callender, Sydney, Australia