QuickStart Cookbook Instructions for CTS 6 bundle

==============================================================
CTS Instructions to get, configure and run CTS 6 for Java EE 6
==============================================================

(1) Grab the Java EE 6 profile for GlassFish V3 zip bundle you wish to test.
    We usually grab (latest-glassfish.zip) from nightly location below:

    Java EE 6 RI Nightly Bundle Location
    ------------------------------------
    http://download.java.net/glassfish/v3/nightly

    unzip bundle to your glassfish location

    Example)
    --------
    mkdir /files/javaee
    cd /files/javaee
    unzip bundle

    This will create a glassfish bundle installed under /files/javaee/glassfishv3

(2) Grab the javaeetck bundle for CTS 6 builds which are built using nightly
    Java EE 6 RI builds from here:

    CTS 6 Bundle location
    ----------------------
    http://jse.us.oracle.com/JWSCQE/links/builds/tcks/javaee_cts/6/patch-nightly

    To run the full CTS 6 grab the following:

    o javaeetck-6.0_<DateTimeStamp>.zip

(3) Create a directory to hold the CTS 6 bundle

    Example)
    --------
    mkdir /files/cts
    cd /files/cts
    unzip the bundle into this directory

    This will create a test bundle installed under /files/cts/javaeetck

(4) Edit your ts.jte file under /files/cts/javaeetck/bin/ts.jte

    set javaee.home     set to directory where your GlassFish v3 appserver is installed
			(from above this would be set to /files/javaee/glassfishv3/glassfish
			 NOTE: subdir glassfish after glassfishv3)
        javaee.home.ri  (same as javaee.home)
        orb.host 	set to host where GlassFish appserver is running (I use localhost)
        orb.port 	set to port where GlassFish appserver is running (usually 3699)
        orb.host.ri     for most cases, this is same as orb.host
        orb.port.ri 	set to port where GlassFish ri appserver is running (usually 3700)

(5) Set the following environment variables and configure your appserver for CTS

    setenv TS_HOME /files/cts/javaeetck				# Set to top level unzipped bundle dir
    setenv ANT_HOME $TS_HOME/tools/ant				# Need to point to ant within CTS (uses special ant libs within CTS)
								# Set ANT_OPTS to pickup new endorsed API's (jaxws2.2/jaxb2.2 etc ...)
								# and for GlassFish V3 use full absolute path to endorsed dir

    setenv ANT_OPTS -Djava.endorsed.dirs=/files/javaee/glassfishv3/glassfish/modules/endorsed

								# ANT_OPTS setting is needed when using ant to
								# build the tests so it picks up the right API's
								# if using SE6 which has a version of jaxws/jaxb
								# within SE6.

    set path = ( $TS_HOME/bin $ANT_HOME/bin $path )		# For convenience add TS_HOME/bin and ANT_HOME bin to path)
    cd $TS_HOME/bin						# Change to TS_HOME/bin to configure for CTS
    ant config.vi 						# Full CTS configuration of appserver
    ant -f xml/impl/glassfish/s1as.xml start.javadb             # Start the JavaDB
    and init.javadb                                             # Init DB with data required to run CTS

(6) We can run tests now. Goto a test directory and type ant runclient to
    run a test.

    All test directories are under the following directory:

    cd $TS_HOME/src/com/sun/ts/tests

    Example 1)
    To run all tests within cts
    ---------------------------
    cd $TS_HOME/src/com/sun/ts/tests
    ant runclient

    Example 2)
    To run all the ejb tests
    ------------------------
    cd $TS_HOME/src/com/sun/ts/tests/ejb
    ant runclient

    Example 3)
    To run all the servlet api tests (just the api sub-directory of tests)
    ----------------------------------------------------------------------
    cd $TS_HOME/src/com/sun/ts/tests/servlet/api
    ant runclient

    To run just the HandlerFlow webservices test
    --------------------------------------------
    cd $TS_HOME/src/com/sun/ts/tests/webservices/handler/HandlerFlow
    ant runclient


(7) How do I run tests in specific vehicles. Right now most of the tests are built for
    several client vehicles determined by the $TS_HOME/src/vehicle.properties file which
    lists the vehicles built for individual tests or test directories. To see the vehicles
    built within your CTS bundle for a given test just change to that test directory and
    type 'ant ld'.

    Example)
    --------
    cd $TS_HOME/src/com/sun/ts/tests/webservices/handler/HandlerFlow
 ohoh 260 =>ant ld
Buildfile: build.xml
     [echo] ts.home = /files/cts/javaeetck/bin/xml/../..
     [echo] The deliverable currently in use is /files/cts/javaeetck/bin/xml/../../bin.
Trying to override old definition of datatype string

ld:
     [echo] Files under
     [echo] /files/cts/javaeetck/bin/xml/../../dist/com/sun/ts/tests/webservices/handler/HandlerFlow
     [echo] --------------------------------------------------
     [echo] HFlowT.ear
     [echo] HFlowT_appclient_vehicle.ear
     [echo] HFlowT_appclient_vehicle_client.jar
     [echo] HFlowT_appclient_vehicle_client.jar.sun-application-client.xml
     [echo] HFlowT_ejb_vehicle.ear
     [echo] HFlowT_ejb_vehicle_client.jar
     [echo] HFlowT_ejb_vehicle_client.jar.sun-application-client.xml
     [echo] HFlowT_ejb_vehicle_ejb.jar
     [echo] HFlowT_ejb_vehicle_ejb.jar.sun-ejb-jar.xml
     [echo] HFlowT_jsp_vehicle.ear
     [echo] HFlowT_jsp_vehicle_web.war
     [echo] HFlowT_jsp_vehicle_web.war.sun-web.xml
     [echo] HFlowT_servlet_vehicle.ear
     [echo] HFlowT_servlet_vehicle_web.war
     [echo] HFlowT_servlet_vehicle_web.war.sun-web.xml
     [echo] HFlowT_web.war
     [echo] HFlowT_web.war.sun-web.xml

BUILD SUCCESSFUL
Total time: 1 second

    The above listing shows the EAR archives built for this test. The client vehicles listed
    above show appclient_vehicle, ejb_vehicle jsp_vehicle and servlet_vehicle are built.

    Example 1)
    To run this test in all vehicles just type:

    cd $TS_HOME/src/com/sun/ts/tests/webservices/handler/HandlerFlow
    ant runclient

    To run specific vehicle clients you need to specify them using javatest keywords.

    Example 2)
    To run this test client in just appclient vehicle:

    cd $TS_HOME/src/com/sun/ts/tests/webservices/handler/HandlerFlow
    ant -Dkeywords="appclient_vehicle" runclient

    Example 3)
    To run this test client in servlet,ejb vehicles:

    cd $TS_HOME/src/com/sun/ts/tests/webservices/handler/HandlerFlow
    ant -Dkeywords="servlet_vehicle | ejb_vehicle" runclient

(8) How do I run a specific test within a testcase.

    cd $TS_HOME/src/com/sun/ts/tests/webservices/handler/HandlerFlow

    Get a list of tests within test case as follows

    grep @testName Client.java
     *   @testName:  DoHandlerTest1
     *   @testName:  DoHandlerTest2
     *   @testName:  DoHandlerTest3
     *   @testName:  DoHandlerTest4
     *   @testName:  DoHandlerTest5
     *   @testName:  DoHandlerTest6

     To run the following test (DoHandlerTest3) in all vehicles type:

     ant -Dkeywords=forward -Dtest.client=Client.java -Dtest=DoHandlerTest3 runclient

     To run the following test (DoHandlerTest3) in appclient,servlet vehicles type:

     ant -Dkeywords="forward & (appclient_vehicle | servlet_vehicle)" -Dtest.client=Client.java \
	-Dtest=DoHandlerTest3 runclient

(9) Controlling CTS javatest harness execution modes

    By default when executing ant runclient on a CTS test the javatest harness
    does a (deploy, run, undeploy) of test archives as specified by the following
    property with TS_HOME/bin/ts.jte file:

# @harness.executeMode  used to run the harness in the following modes
#                       of execution:
#    0 - default (deploy, run, undeploy)
#    1 - deploy only
#    2 - run only
#    3 - undeploy only
#    4 - deploy and run only

    If you want to control the deployment/running/undeployment of CTS test execution
    differently than the default value of 0 you can tweek this parameter value as
    specified above.


(10) Turn on additional test debugging/tracing option

    The following property is used to control this as specified in TS_HOME/bin/ts.jte:

# @harness.log.traceflag  used to turn on/off verbose debugging output
#                         for the tests.

    Set this to true for any additional verbose test output that the test may print out
    via TestUtil.logTrace calls. The default setting is false.


(11) Java EE 6 now has the concept of profiles. By default CTS 6 runs the javaee profile.
    Various profile data is specified in:

    o TS_HOME/src/com/sun/ts/lib/harness/keyword.properties

    Examples of using keywords property to specify profiles are as follows

    To run the full javaee profile of tests
    ---------------------------------------
    cd $TS_HOME/src/com/sun/ts/tests
    ant runclient
      or
    ant -Dkeywords=javaee runclient	# This is the same as above since javaee is the default profile run

    To run the javaee web profile of tests
    --------------------------------------
    cd $TS_HOME/src/com/sun/ts/tests
    ant -Dkeywords=javaee_web_profile runclient

    To run the jsr109 profile in both (web and ejb) profile support
    ---------------------------------------------------------------
    cd $TS_HOME/src/com/sun/ts/tests
    ant -Dkeywords=ws_webejb runclient

    To run the jsr109 profile in just web container profile support
    ---------------------------------------------------------------
    cd $TS_HOME/src/com/sun/ts/tests
    ant -Dkeywords=ws_web runclient

    To run the jsr109 profile in just ejb container profile support
    ---------------------------------------------------------------
    cd $TS_HOME/src/com/sun/ts/tests
    ant -Dkeywords=ws_ejb runclient

(12) Attaching debugger to CTS test clients

     Add the following options to command.textExecute or command.testExecuteAppClient in the ts.jte file
     right after the invocation of java.

     For CTS debugging use these options to java command line invocation (NEW WAY for releases SE5 and up):

     -agentlib:jdwp=transport=dt_socket,address=5555,server=y,suspend=y

     For example here is a sample for these props in ts.jte (extraneous lines removed):

command.testExecute=com.sun.ts.lib.harness.ExecTSTestCmd \
	.
	.
        ${JAVA_HOME}/bin/java \
	-agentlib:jdwp=transport=dt_socket,address=5555,server=y,suspend=y \
	.
	.
        -Ddeliverable.class=${deliverable.class} $testExecuteClass $testExecuteArgs

command.testExecuteAppClient= \
        com.sun.ts.lib.harness.ExecTSTestCmd DISPLAY=${ts.display} HOME="${user.home}" \
	.
	.
        ${JAVA_HOME}/bin/java \
	-agentlib:jdwp=transport=dt_socket,address=5556,server=y,suspend=y \
	.
	.
        -Ddeliverable.class=${deliverable.class} -javaagent:${javaee.home}/modules/gf-client.jar=arg=-configxml,arg=${ts.home}/tmp/appclient/s1as.sun-acc.xml,client=jar=$testExecuteArgs