INTEGRATION TEST WITH REMOTE JBOSS 4.2
Prepare JBoss 4.2.3 for JumpStart
- We assume you have a normal working JBoss 4.2.3 installation...
- To get it, go to JBoss Application Server Downloads, locate 4.2.3 GA and choose the Download link. Choose to download the jboss-4.2.3.GA.zip.
- Once downloaded, unzip it. Move it to a suitable location (eg. /devel/jboss-4.2.3.GA).
- Create a jumpstart server:
- Duplicate JBoss's server/default/ directory and name it jumpstart.
- Tell Hibernate to drop and create the database tables at restart:
Caution: DO NOT DO THIS STEP IN A PRODUCTION ENVIRONMENT as all existing data will be lost.
Include the following system property in the JAVA_OPTS environment variable. The property is explained here: hibernate:-Dhibernate.hbm2ddl.auto=create-drop
- set JAVA_OPTS=-Dhibernate.hbm2ddl.auto=create-drop
- setenv JAVA_OPTS '-Dhibernate.hbm2ddl.auto=create-drop'
- Start JBoss, eg.
...in Windows:- cd /devel/jboss-4.2.3.GA/bin
- run.bat -c jumpstart
- cd /devel/jboss-4.2.3.GA/bin
- ./run.sh -c jumpstart
Prepare the build
- In the project's build.properties file, edit the value of these properties:
- deployment.server.type
- deployment.persistence.descriptor
- deployment.web.descriptor
- integration.test.server.dir.
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.
- Run the Ant target clean-compile-test-package-integrationtest in the project's build.xml file.
- If you get an error about JAVA_HOME, read this. Use a JDK 1.5 tools.jar.
...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:
- Run the Ant target clean-compile-test-package-preintegrationtest in the project's build.xml file.
- If you get an error about JAVA_HOME, read this. Use a JDK 1.5 tools.jar.
- In Eclipse, choose Window > Preferences > Java > Build Path > User Libraries (or in OS X, choose Eclipse > Preferences > Java > Build Path > User Libraries), and
- create a new user library called jboss4-client-lib, then
- add JBoss's client/jbossall-client.jar file to the new user library.
- Choose Run > Open Run Dialog.... The Run window will appear.
- Right-click on JUnit and choose New.
|
- Click on the Classpath tab.
- Click Run.
- Watch the results in the JUnit View panel. In the Console View you might see lots of exceptions but that's normal. The JUnit View will tell you quickly whether the tests succeeded or not.
Problems? Eclipse might not be ready for junit - see Could not create task or type of type: junit.