Difference between revisions of "EclipseLink/Development/Testing/SDO"

From Eclipsepedia

Jump to: navigation, search
(Running the SDO Junit tests in Eclipse)
(Summary)
 
(30 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
== Summary ==
 
== 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 SDO 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.
+
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. Ant 1.7 or greater is recommended when using EclipseLink's Ant build files.
# Checkout using subclipse all projects individually into your eclipse workspace
+
# Checkout using [[http://subclipse.tigris.org/update_1.2.x | Subclipse]] all projects individually into your eclipse workspace
## Build classes in eclipse and run/debug there
+
## [[EclipseLink/Development/TestStatus/SDO-Instructions#Running_the_SDO_Junit_tests_in_Eclipse|Build classes in eclipse and run/debug there]]
## Build/run classes using Ant
+
## [[EclipseLink/Development/TestStatus/SDO-Instructions#Running_the_SDO_Junit_tests_using_Ant|Build/run classes using Ant]]
# 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
+
# Checkout using [[http://tortoisesvn.tigris.org | TortoiseSVN]] the root trunk into a folder outside your workspace ''(IE: c:/view_el)'' 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 - but you will requires some build.properties changes.
## Build classes in eclipse and run/debug there
+
## [[EclipseLink/Development/TestStatus/SDO-Instructions#Running_the_SDO_Junit_tests_in_Eclipse|Build classes in eclipse and run/debug there]]
## Build/run classes using Ant
+
## [[EclipseLink/Development/TestStatus/SDO-Instructions#Running_the_SDO_Junit_tests_using_Ant|Build/run classes using Ant]]
  
===Prerequisites===
+
[[EclipseLink/Test/Prereq| General prerequisites for building & running EclipseLink tests]]
* [[http://tortoisesvn.tigris.org | TortoiseSVN]] and a saved [[http://www.chiark.greenend.org.uk/~sgtatham/putty | PuTTY]] SSH session
+
# 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
* TortoiseSVN - network setting - SSH client set as <TortoiseSVN_HOME>\bin\TortoisePlink -l <userName> -pw <password_cleartext>
+
[[Image:Explorer_right_click_svn_settings_menu.JPG|400px]]
+
* Eclipse 3.2|3.3|1.5 installed with the subclipse pluggin for in-eclipse checkouts
+
* Referenced projects '''eclipselink.core''' and '''eclipselink.lib''' checked out into workspace or view
+
* Required projects '''eclipselink.sdo''', '''eclipselink.sdo.lib''' and '''eclipselink.sdo.test''' checked out into workspace or view
+
* If using [[EclipseLink/Development/TestStatus/SDO-Instructions#Running_the_SDO_Junit_tests_using_Ant|Ant]] instead of [[EclipseLink/Development/TestStatus/SDO-Instructions#Running_the_SDO_Junit_tests_in_Eclipse|Eclipse]] to run - edit build.properties either at this project level or globally in your user directory on windows: C:/Documents and Settings/<user-dir>
+
<blockquote style="background: grey; border: 1px solid rgb(153, 153, 153); padding: 1em;"><pre><nowiki>
+
javaee.lib=<jar_location>/javaee.jar - required by MOXy or core tests
+
junit.lib=<JUNIT_HOME>/junit.jar - required by eclipselink.sdo.test
+
tools.lib=<JAVA_HOME>/lib/tools.jar - required by eclipselink.sdo.test
+
</nowiki></pre></blockquote>
+
*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 '''[[EclipseLink/Development/TestStatus/SDO-Instructions#Building_.26_Running_inside_an_Eclipse_Workspace|inside]]''' an eclipse workspace or '''[[EclipseLink/Development/TestStatus/SDO-Instructions#Building_.26_Running_outside_an_Eclipse_Workspace|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===
 
===Configuration options===
Line 36: Line 24:
 
===Running using Eclipse===
 
===Running using Eclipse===
 
'''Setting up Eclipse
 
'''Setting up Eclipse
* Checkout 5 of 11 new projects (projects will be created inside the workspace) (core,core.lib,sdo,sdo.lib,sdo.test) using SVN (turn off automatic build temporarily)
+
* Checkout/Create or Update 5 of 11 new projects (they will be created inside the workspace using SVN)
 +
**org.eclipse.persistence.core
 +
**eclipselink.core.lib
 +
**org.eclipse.persistence.sdo
 +
**eclipselink.sdo.lib
 +
**eclipselink.sdo.test
 +
* Turn off ''build automatically'' temporarily
 
[[Image:eclipselink_sdo_java_projects_workspace_ide__cap.jpg|600px]]  
 
[[Image:eclipselink_sdo_java_projects_workspace_ide__cap.jpg|600px]]  
 
# Goto [[EclipseLink/Development/TestStatus/SDO-Instructions#Running_the_SDO_Junit_tests_in_Eclipse|Running the SDO JUnit tests in Eclipse]]
 
# Goto [[EclipseLink/Development/TestStatus/SDO-Instructions#Running_the_SDO_Junit_tests_in_Eclipse|Running the SDO JUnit tests in Eclipse]]
Line 43: Line 37:
 
Subversion checkout is outside the eclipse workspace.
 
Subversion checkout is outside the eclipse workspace.
 
* Create your own view directory - for example "c:/view_el/"
 
* Create your own view directory - for example "c:/view_el/"
* Check out the SVN project for SDO into this directory using the format '''svn+ssh://<username>@<svn_session>/svnroot/technology/org.eclipse.persistence/trunk
+
* Check out the SVN project for SDO into this directory using the format '''svn+ssh://<username>@<svn_session>/svnroot/rt/org.eclipse.persistence/trunk
 
[[Image:Explorer_right_click_svn_checkout_dialog.JPG]]  
 
[[Image:Explorer_right_click_svn_checkout_dialog.JPG]]  
 
* Either build all 4 core, jpa, moxy and sdo projects into an eclipselink.jar by following the instructions in [[EclipseLink/Development/TestStatus/MOXy-Instructions| 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...
 
* Either build all 4 core, jpa, moxy and sdo projects into an eclipselink.jar by following the instructions in [[EclipseLink/Development/TestStatus/MOXy-Instructions| 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...
Line 56: Line 50:
 
===Running using Eclipse===
 
===Running using Eclipse===
 
'''Setting up Eclipse
 
'''Setting up Eclipse
* Create 5 of 11 new projects (core,core.lib,sdo,sdo.lib,sdo.test) from existing source = "c:/view_el/eclipselink.* (turn off automatic build temporarily)
+
* Create 5 of 11 new projects from existing source = "c:/view_el/eclipselink.*
 +
**org.eclipse.persistence.core
 +
**eclipselink.core.lib
 +
**org.eclipse.persistence.sdo
 +
**eclipselink.sdo.lib
 +
**eclipselink.sdo.test
 +
* Turn off ''build automatically'' temporarily
 
[[Image:eclipselink_sdo_java_projects_ide_cap.jpg]]  
 
[[Image:eclipselink_sdo_java_projects_ide_cap.jpg]]  
 
# Goto [[EclipseLink/Development/TestStatus/SDO-Instructions#Running_the_SDO_Junit_tests_in_Eclipse|Running the SDO JUnit tests in Eclipse]]
 
# Goto [[EclipseLink/Development/TestStatus/SDO-Instructions#Running_the_SDO_Junit_tests_in_Eclipse|Running the SDO JUnit tests in Eclipse]]
  
 
== Running the SDO Junit tests using Ant==
 
== Running the SDO Junit tests using Ant==
These instructions are common to both running Ant inside or outside an eclipse workspace.
+
These instructions are common to both running Ant ''inside'' or ''outside'' an eclipse workspace.
 
# Classpath Variable entry
 
# Classpath Variable entry
## Several variables will need to be configured either in your <project> or <user-dir> build.properties
+
## 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.
 
##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.
+
# 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
+
# View results in the reports subdirectory '''true''' or ''false''
  
 
== Running the SDO Junit tests in Eclipse==
 
== Running the SDO Junit tests in Eclipse==
These instructions are common to both running from projects checked out inside or outside an eclipse workspace.
+
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
+
* Turn ''build automatically'' back on to build classes
 
* Classpath Variable entry
 
* 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
 
[[Image:Eclipse_classpath_var_tools_entry.JPG|500px]]
 
 
* 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.
 
* 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
+
* 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.
+
* 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.
 
*[[Image:eclipselink_sdo_test_working_directory.jpg|500px]]  
 
*[[Image:eclipselink_sdo_test_working_directory.jpg|500px]]  
 
* Setup sdo variables, in particular those used by class generation
 
* Setup sdo variables, in particular those used by class generation
 
**In eclipse, navigate to '''Window | Preferences | Java | Installed JRE's | <your JDK> | Edit | Default VM Arguments'''
 
**In eclipse, navigate to '''Window | Preferences | Java | Installed JRE's | <your JDK> | Edit | Default VM Arguments'''
***-Djaxb.test.contextpath=oracle.toplink.testing.ox.jaxb.dom
+
***-DuseLogging=true ''- Optional flag''
***-Dtoplink.xml.platform=oracle.toplink.platform.xml.jaxp.JAXPPlatform
+
***-DignoreCRLF=true ''- Optional flag for windows clients''
***-DuseLogging=true
+
***-DcustomContext=true ''- Optional flag''
***-DuseSAXParsing=true
+
***-DloggingLevelFinest=false ''- turn on finest level logging'' ''- Optional flag''
***-DuseDeploymentXML=false
+
***-DignoreCRLF=true ''- for windows clients''
+
***-DcustomContext=true  
+
***-DloggingLevelFinest=false ''- turn on finest level logging''
+
 
***-Xloggc:c:\wse\gc.log -DXprof ''(profiling log - optional)''
 
***-Xloggc:c:\wse\gc.log -DXprof ''(profiling log - optional)''
 
***-DXmx512m ''(increase memory size - may be required for some larger suites like loadandsave)''
 
***-DXmx512m ''(increase memory size - may be required for some larger suites like loadandsave)''
***-Dparser=org.eclipse.persistence.platform.xml.jaxp.JAXPParser
+
***The '''SDOClassGenTestSuite''' suite has a runtime dependency on the following jars and classes (sdo classes, sdo.test classes, (mail.jar, activation.jar in eclipselink.core.lib) and commonj.sdo.jar).
***The '''SDOClassGenTestSuite''' suite has a runtime dependency on the following jars and classes (sdo classes, sdo.test classes, mail.jar, activation.jar, commonj.sdo.jar and tools.jar)
+
****(c:/view_el is your svn checkout dir, there are no spaces between entries...)  
****You will need to reference your JDK for the tools.jar and location for mail.jar and activation.jar (We use for example the '''ext''' directory off of your SVN checkout dir.)
+
****(c:/view_el is your svn checkout dir, c:/view_el/ext containes extension jars, there are no spaces between entries...)  
+
 
*****[[Image:Eclipse_jre_vm_arg_dialog.JPG|500px]]  
 
*****[[Image:Eclipse_jre_vm_arg_dialog.JPG|500px]]  
 
****Pending: variable below using system environment variable %ECLIPSE_VIEW% (TBD 20071029)
 
****Pending: variable below using system environment variable %ECLIPSE_VIEW% (TBD 20071029)
 
<blockquote style="background: grey; border: 1px solid rgb(153, 153, 153); padding: 1em;"><pre><nowiki>
 
<blockquote style="background: grey; border: 1px solid rgb(153, 153, 153); padding: 1em;"><pre><nowiki>
 +
Required flag
 
-Dsdo.classgen.compile.path=c:/view_el/sdo/eclipselink.sdo.test/classes;
 
-Dsdo.classgen.compile.path=c:/view_el/sdo/eclipselink.sdo.test/classes;
c:/view_el/sdo/eclipselink.sdo/classes;c:/view_el/sdo/eclipselink.sdo.lib/commonj.sdo.jar;
+
c:/view_el/sdo/org.eclipse.persistence.sdo/classes;c:/view_el/sdo/eclipselink.sdo.lib/commonj.sdo.jar;
c:/view_el/ext/mail.jar;c:/view_el/ext/activation.jar;c:/jdk1.5.0/lib/tools.jar;.;
+
c:/view_el/eclipselink.core.lib/mail.jar;c:/view_el/eclipselink.core.lib/activation.jar;.;
 
</nowiki></pre></blockquote>
 
</nowiki></pre></blockquote>
 
* Run the test and observe results in the Console
 
* Run the test and observe results in the Console
Line 115: Line 107:
  
 
== Interpreting Ant Test Results==
 
== Interpreting Ant Test Results==
* See the [[EclipseLink/Development/TestStatus/JUnit-Results|SDO test results page numbers]] and the [[EclipseLink/Development/TestStatus#/SDO|detailed results]] to validate your own results.
+
* See the [[EclipseLink/Development/TestStatus#/SDO |SDO test results page]] to validate your own results.
 
* Depending on the value of the customContext variable look under the true|false subdirectory in ''junit-noframes.html''
 
* Depending on the value of the customContext variable look under the true|false subdirectory in ''junit-noframes.html''

Latest revision as of 16:41, 26 November 2008

Contents

[edit] 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. Ant 1.7 or greater is recommended when using EclipseLink's Ant build files.

  1. Checkout using [| Subclipse] all projects individually into your eclipse workspace
    1. Build classes in eclipse and run/debug there
    2. Build/run classes using Ant
  2. Checkout using [| TortoiseSVN] the root trunk into a folder outside your workspace (IE: c:/view_el) 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 - but you will requires some build.properties changes.
    1. Build classes in eclipse and run/debug there
    2. Build/run classes using Ant

General prerequisites for building & running EclipseLink tests

  1. 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

[edit] 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.
    • customContext = true (run test using an thread-safe instantiable instance of SDOHelperContext) - default
    • customContext = false (run test using static HelperContext Singleton)

[edit] Building & Running inside an Eclipse Workspace

[edit] Running using Ant

  1. The <project>/build.properties is configured to run inside eclipse by default - leave eclipselink.core and eclipselink.core.lib variables as-is on the local build.properties
  2. Navigate to the <workspace>/eclipselink.sdo.test directory
  3. Goto Running the SDO JUnit tests using Ant

[edit] Running using Eclipse

Setting up Eclipse

  • Checkout/Create or Update 5 of 11 new projects (they will be created inside the workspace using SVN)
    • org.eclipse.persistence.core
    • eclipselink.core.lib
    • org.eclipse.persistence.sdo
    • eclipselink.sdo.lib
    • eclipselink.sdo.test
  • Turn off build automatically temporarily

Eclipselink sdo java projects workspace ide cap.jpg

  1. Goto Running the SDO JUnit tests in Eclipse

[edit] Building & Running outside an Eclipse Workspace

Subversion checkout is outside the eclipse workspace.

  • Create your own view directory - for example "c:/view_el/"
  • Check out the SVN project for SDO into this directory using the format svn+ssh://<username>@<svn_session>/svnroot/rt/org.eclipse.persistence/trunk

Explorer right click svn checkout dialog.JPG

  • 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...

[edit] Running using Ant

  1. 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...
    1. eclipselink.core=../../foundation/eclipselink.core
    2. eclipselink.core.lib=../../foundation/eclipselink.core.lib
  2. Navigate to the eclipselink.sdo.test directory
  3. Goto Running the SDO JUnit tests using Ant

[edit] Running using Eclipse

Setting up Eclipse

  • Create 5 of 11 new projects from existing source = "c:/view_el/eclipselink.*
    • org.eclipse.persistence.core
    • eclipselink.core.lib
    • org.eclipse.persistence.sdo
    • eclipselink.sdo.lib
    • eclipselink.sdo.test
  • Turn off build automatically temporarily

Eclipselink sdo java projects ide cap.jpg

  1. Goto Running the SDO JUnit tests in Eclipse

[edit] Running the SDO Junit tests using Ant

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

  1. Classpath Variable entry
    1. Several variables will need to be configured either in your <project> or <user-dir> build.properties
    2. junit.lib=<JUNIT_HOME>/junit.jar - If junit.jar is not in your ant lib dir.
  2. 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.
  3. View results in the reports subdirectory true or false

[edit] 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
  • 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.
  • Eclipselink sdo test working directory.jpg
  • Setup sdo variables, in particular those used by class generation
    • In eclipse, navigate to Window | Preferences | Java | Installed JRE's | <your JDK> | Edit | Default VM Arguments
      • -DuseLogging=true - Optional flag
      • -DignoreCRLF=true - Optional flag for windows clients
      • -DcustomContext=true - Optional flag
      • -DloggingLevelFinest=false - turn on finest level logging - Optional flag
      • -Xloggc:c:\wse\gc.log -DXprof (profiling log - optional)
      • -DXmx512m (increase memory size - may be required for some larger suites like loadandsave)
      • The SDOClassGenTestSuite suite has a runtime dependency on the following jars and classes (sdo classes, sdo.test classes, (mail.jar, activation.jar in eclipselink.core.lib) and commonj.sdo.jar).
        • (c:/view_el is your svn checkout dir, there are no spaces between entries...)
          • Eclipse jre vm arg dialog.JPG
        • Pending: variable below using system environment variable %ECLIPSE_VIEW% (TBD 20071029)
Required flag
-Dsdo.classgen.compile.path=c:/view_el/sdo/eclipselink.sdo.test/classes;
c:/view_el/sdo/org.eclipse.persistence.sdo/classes;c:/view_el/sdo/eclipselink.sdo.lib/commonj.sdo.jar;
c:/view_el/eclipselink.core.lib/mail.jar;c:/view_el/eclipselink.core.lib/activation.jar;.;
  • Run the test and observe results in the Console

[edit] Debugging

[edit] 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.

[edit] Debugging using Eclipse built classes

Eclipse builds with debugging info by default.

[edit] Interpreting Ant Test Results

  • See the SDO test results page to validate your own results.
  • Depending on the value of the customContext variable look under the true|false subdirectory in junit-noframes.html