Summary

The SDO test suite is written using JUnit. It consists of a set of jars and classes that contain various tests and resources. The tests are contained in the eclipselink.sdo.test project. This page is intended to outline the setup and execution steps required to successfully run the SDO JUnit tests. There are 2 ways to checkout EclipseLink and 2 ways to run the tests.

Checkout using tortoiseSVN the root trunk into a folder outside your workspace and either use ant to build an eclipselink.jar or create proxy projects using link to source from eclipse - Recommended if you would like to build the eclipselink.jar

Currently an integrated test suite that will run all EclipseLink projects including SDO is being developed. You can run the SDO test suite by overriding some variables in your <user-dir>/build.properties depending on whether you are running inside an eclipse workspace or outside. The eclipselink.core.lib variable already set on the local build.properties will resolve a dependency on org.eclipse.persistence.internal.libraries.asm in eclipselink-asm.jar

Configuration options

The tests run by default using a non-static customContext=true which is the mode that will normally be used in a multithreaded container.

Building & Running outside an Eclipse Workspace

Check out the SVN project for SDO into this directory using the format svn+ssh://<username>@<svn_session>/svnroot/technology/org.eclipse.persistence/trunk

Either build all 4 core, jpa, moxy and sdo projects into an eclipselink.jar by following the instructions in Building EclipseLink Source - specifically the section on setting up the extension jars not included in eclipselink.core.lib like (aqapi.jar, sdoapi.jar(spatial), ojdb14dms_10.jar(or other jdbc lib), xdb.jar, xml.jar, xmlparserv2.jar), or allow the sdo test script to run off classes by doing the following...

Running using Ant

The <project>/build.properties file is configured to run inside eclipse - modify it or your <user-dir>/build.properties. The following variables account for the different directory structure...

Running the SDO Junit tests using Ant

These instructions are common to both running Ant inside or outside an eclipse workspace.

Classpath Variable entry

Several variables will need to be configured either in your <project> or <user-dir> build.properties

At this point you may get 80 javac/main exceptions if the tools.lib variable is not set for sdo.test. Set this variable in your build.properties to tools.lib=<JAVA_HOME>/lib/tools.jar

junit.lib=<JUNIT_HOME>/junit.jar - If junit.jar is not in your ant lib dir.

Run the eclipselink.sdo.test/build.xml script by typing "ant". This will compile in order eclipselink.core, eclipselink.sdo and eclipselink.sdo.test and should take around 2-4 min.

View results in the reports subdirectory true or false

Running the SDO Junit tests in Eclipse

These instructions are common to both running from projects checked out inside or outside an eclipse workspace.

Turn build automatically back on to build classes

Classpath Variable entry

At this point you should get 2 errors if the TOOLS_LIB variable is not set for sdo.test. Set this variable globally using Window | Preferences | Java | Build Path | Classpath Variables - new -> name=TOOLS_LIB, path=<JAVA_HOME>/lib/tools.jar

Pick a sanity test suite - we will use org.eclipse.persistence.testing.sdo.helper.classgen.SDOClassGenTestSuite as it is small and utilizes resources, core xsd/xml define/load functions as well as internal code compilation.

Create a new java application run/debug target

Modify the arguments tab|working directory to point to ${workspace_loc:eclipselink.sdo.test/resource} or create a resource variable to reuse in other targets - this is where all tests will execute.

Debugging

Debugging using Ant built classes

The generated classes for each project and the eclipselink.jar are debug enabled by default (debuglevel="lines, vars, and source"), in each project the following variable on javac is set to true - enabling the -g flag.

debug="${javac.debug}"

If you would like to build without debugging info - override this value at the project level or in your <user-dir>build.properties.
Note: If you build classes with ant in an eclipse workspace and then try to run in eclipse - even using "build automatically" in eclipse will not recompile these classes - you will need to do a clean and rebuild.