![]() | ![]() |
![]() |
| Project | Ver 1.1 | Ver 1.2 | JDO | JPA | Guides | Tools |
| 1.2 | Persistence | JDO ORM | JPA ORM | Runtime | JDO Runtime | JPA Runtime | Extensions | Developer |
JPOX uses JUnit for unit testing. JPOX uses 2 types of unit tests.
For this second type, and because JDO/JPA have many aspects, we use a "scenario" testing strategy. By this we mean that we separate our unit tests into what they test. When developing anything, the unit tests should be the guiding light as to whether you should be checking anything in to CVS. If your change breaks things, you shouldn't check things in. Each test "scenario" has its own project in CVS with names like "test.jdo.general", "test.jpa.general", etc.
The base dependents of all test scenarios are the following projects
There are currently the following scenarios
The JPOX JCA connector test scenarios are the following projects. To run these tests you must create the data source, deploy the JPOX JCA connector and deploy the EJB application.
Prerequisites Before running any tests you need to setup a database which will be used during the tests. Please see Database Notes below for details. The scenario tests are run via Maven1 using the "test" plugin. Before running any tests, you need to build and install the plugin by typing the following from within Plugins/Maven1: maven clean plugin:install Running the tests From within one of the test projects, you simply type maven clean test The results of the tests are stored under target/test-reports/ If you want to run an individual test only, you need to modify the file "project.xml" within the test project in question. If you want to e.g. run only the JDOQLBasicTest in test.jdo.application, the test.jdo.application/project.xml should look like this:
[..]
<!-- JUnit, component tests -->
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>
<unitTest>
<includes>
<include>**/JDOQLBasicTest.java</include>
</includes>
</unitTest>
[..]
Where you feel that our unit tests do not adequately cover functionality, you should add a test. Please follow the following process
Debugging JPOX unit tests might be very boring, but there is a way of reducing the pain in Eclipse using the JPOX Eclipse Plugin. Follow the next steps to make this easier:
To debug the JPOX enhancement, follow the next steps:
Each test project contains a "project.properties" file that determines which database will be used for running the tests of that particular project, e.g. test.jdo.general/project.properties. The value of the property maven.jpox.datastore refers to database configuration files under test.framework/src/conf. Some tests require two database instances, which is why for every database there exist two files, e.g. "maven.jpox.datastore=hsql" refers to both
The default database configured in the test projects is hsqldb. Following are notes about running the JPOX unit tests with particular databases.
For general information about running HSQLDB see the HSQL documentation. Follwing is an exemplary commandline to start the HSQLDB server with the two schemas "jpox" and "jpox2" required for running the jpox test suites:
java -cp /usr/local/maven-repository/hsqldb/jars/hsqldb-1.8.0.4.jar org.hsqldb.Server -database.0 jpoxdb -database.1 jpoxdb2 -dbname.0 jpox -dbname.1 jpox2
If you face the issue ORA-12519, TNS:no appropriate service handler, try increasing the parameters sessions and processes to 300 and open_cursors to 1000. To change these values in Oracle, issue the following statements. alter system set open_cursors = 1000 scope=spfile alter system set sessions = 300 scope=spfile alter system set processes = 300 scope=spfile *.processes=300 *.sessions=300 *.open_cursors=1000 If you face the issue ORA-01000: maximum open cursors exceeded, try increasing the parameter open_cursors to 1000 in the file initXE.ora or init.ora. *.open_cursors=1000 If you face OutOfMemory errors, increase the Xms and Xmx JVM args for running the junit tests. |