# Jonas Stress Test Suite

## Aim of the Suite

The aim of this suite is to provide tests that stress JOnAS server.

Everybody is welcome for writing and adding new testcases in this suite.

Note that this test suite has been done to test JOnAS, and its use to test other application servers is not straightforward.

## Getting the Suite from CVS repository

Anyone can checkout source code from our anonymous CVS server. To do so, simply use the following commands (if you are using a GUI CVS client, configure it appropriatly):

      cvs -d :pserver:anonymous@cvs.objectweb.org:/cvs/Jonas login
      cvs -d :pserver:anonymous@cvs.objectweb.org:/cvs/Jonas co jonas_tests

When prompted for a password for anonymous, simply press the Enter key.

## Description of the source tree

Under `jonas_tests` you can find the stress suite test.

stress is made of the following directories:

doc | test documentation (this file)
scripts | scripts to build and run tests
src | source files

The set of sources is organized according to the package name. So, the sources are located in src/org/objectweb/jonas/jstests :

dtds | A local copy of the dtds used in the deployment descriptors. (Useful to be able to edit friendly the DDs with emacs).
util | Utility classes.

## Building the suite

### Using ant

This test has been designed to be compiled and run using Ant.
Ant must be installed (with the optional tasks package) and the environment variables `%ANT_HOME%` or `$ANT_HOME` must be set.
`$ANT_HOME/bin` must have been added to the `PATH` environment variable.
The xalan product must be installed, and the `xalan.jar` must be present in `$ANT_HOME/lib`. (xalan is necessary for the JUnitReport ant task).
The JUnit product must also be installed, and the `junit.jar` must be present in `$ANT_HOME/lib`.
For xalan and JUnit, you may also choose to update the file $JONAS_ROOT/bin/unix/config_env (on Unix) or %JONAS_ROOT%\bin\nt\config_env.bat (on Windows) by adding the path to `xalan.jar` and `junit.jar` in the predefined classpath used by JOnAS which is defined in this file.

Main Ant targets are the following :

clean | for deleting all generated classes
compile | for compiling all java classes
deploy | for deploying, generating ejbjars
install | for installing ejbjars under $JONAS_ROOT/ejbjars This target should be used to rebuild all the test suite.

To build the jonas tests :

1. Customize jonas-tests/stress/scripts/build.properties according to your environment.

2. Go to the jonas-tests/stress/scripts directory and type
   `sh build.sh install` on Unix or
   `build install` on Windows

### Using make

1. Set the correct paths for all the jar files included in classpath.
   For this, edit the file `$JONAS_ROOT/gmk/config.mk` and follow the instructions at the end of the file.

2. Then you have to do is:

         cd $OBJECTWEB_HOME/jonas_test/stress
         make

## Running the suite

### Using Ant

You can launch the complete JOnAS test suite via Ant and obtain a test suite report.

You should use the XTRA_CLASSPATH environment variable or modify the predefined classpath used by JOnAS in the $JONAS_ROOT/bin/unix/config_env (on Unix) or %JONAS_ROOT%\bin\nt\config_env.bat (on Windows) file, by adding the path to jonas_tests/conformance/classes/$OBJECTWEB_ORB.

1. Update the dbm.datasources property in the jonas-tests/stress/scripts/build.properties file according to your environment.
   Actually, the JOnAS suite need only one datasource with jdbc_1 as datasource.name.

2. You can launch the complete JOnAS test suite via the batchtest ant target.

3. Then you obtain a test suite report generated under jonas_tests/stress/reports/html.

### Using scripts

It may be interesting to launch only one of the suites or only one testcase of a test suite, particularly to debug a testcase that fails.

For that, you can find under the jonas_tests/stress/scripts directory two Unix scripts.

ser1.sh must be run first, after a slight customization. It will run the EJBServer. EJBServer name is EJB. You will have to customize DATASOURCES variable according to the datasource file you use.

junit.sh can be run then. Depending on the number of arguments, you will run

1. all the junit tests
2. all suite in a client directory
3. 1 named suite in a directory
4. 1 testCase in 1 particular suite in a directory

Exemple:

    sh ser1.sh
    sh junit.sh security
    sh junit.sh entity F_BasicHomeInterfaceEB testFinderEnumObjNotFound

## How to contribute ?

### Coding conventions

Coding conventions are the same for jonas or for jonas_tests. They must follow Code Conventions for the JavaTM Programming Language

### Submitting a contribution to jonas team

Today, you must follow the same rules than for jonas.