Oracle Waveset 8.1.1 Deployment Guide

Example 5: Running Tests from Inside the Web Container

Use the following process to run compatibility tests from inside the web container.

Prepare the Test

Use the following steps to prepare the compatibility tests.

ProcedureTo Prepare the Test

  1. Copy ant-junit.jar from Apache ant 1.6.5 to your $WSHOME/WEB-INF/lib directory.

  2. Enable the com.sun.idm.testing.adapter.compatibility.CTServlet by uncommenting the following in the web.xml file:

    • Uncomment servlet definition:


      <servlet>
          <servlet-name>CompatibilityTests</servlet-name>
          <servlet-class>com.sun.idm.testing.adapter.compatibility.CTServlet</servlet-class>
          <load-on-startup>1</load-on-startup>
        </servlet>
    • Uncomment servlet mapping:


      <servlet-mapping>
          <servlet-name>CompatibilityTests</servlet-name>
          <url-pattern>/servlet/CTServlet</url-pattern>
        </servlet-mapping>

    Note –
    • You might have to restart your computer to use the new servlet.

    • The servlet accepts POST requests with certain parameters. Some parameters, such as imported files, allow you to specify multiples.


  3. You can specify the following parameters to the Compatibility Suite:

    Property  

    Description 

    adapter

    Classname of the adapter to test 

    dp

    Name of a custom DataProvider 

    excludedTests

    Comma-separated list of tests to exclude 

    import

    Comma-separated list of files to import 

    importScript

    Comma-separated list of paths to the scripts to execute 

    Note: These scripts return a string of imported XML.

    includedTests

    Comma-separated list of tests to include 

    ns

    DataProvider namespace 

    pass

    Plain Text password used to log user on 

    Note: This password is sent in plain text, which may influence your decision on whether or not to enable the servlet. 

    user

    Name of user who executes test 

    Additional, remote-only parameters include:

    Property 

    Description 

    importXMLText

    String containing XML to import 

    importScriptText

    String containing script to run 

    importScriptSuffix

    Specify bsh if the script is a beanshell script

    Specify js if the script is javascript.

    Note: If you specify multiple scripts to the servlet, the scripts must all be javascript or all beanshell, you cannot specify one of each.

    You can access the servlet through debug/CompatTests.jsp or the command line Java program, CTContainerTest.java.

  4. To prepare for running the tests remotely, copy the file idmtesting.jar and the example folders under sample/compat to the remote system.

Execute the Tests

Run the tests from the CompatTests.jsp page

ProcedureTo Execute the Test

  1. Open a browser and navigate to your idm instance/debug/CompatTests.jsp. For example,

    http://example.com:8080/idm/debug/CompatTests.jsp

  2. To run the example, you must provide the following values:

    Namespace = SimulatedAdapterTests

    Adapter = com.waveset.adapter.SimulatedResourceAdapter

    User Name to Run Test as = configurator

    Password for User to Run Test as = configurator’s password

    Script type = Beanshell radio button

    Import Result of this Script Text = SimulatedCompatibilityConfig.bsh file contents

  3. Copy the contents of the SimulatedCompatibilityConfig.bsh file from the sample/compat/example.4 directory and paste them into this text field.


    Note –

    This script runs Example 4, but you can run the other examples in the same way. The other parameters are available too, but the names are slightly altered in the jsp file.


    You can also run the compatibility test remotely from a command line Java program called CTContainerTest. The usage is as follows:


    CTContainerTest -url url [-v] [-parm1_name parm1_value e ... -parmx_name parmx_value]

    Where:

    • Parameter names are the same as parameters accepted by the servlet.

    • Parameter values are the same as values accepted by the servlet.

    The servlet does not support the following parameters as a command line argument:

    • importScriptText

      You can use the importLocalScriptFile parameter to send the importScriptText parameter to the servlet. The importLocalScriptFile option reads the contents of the file specified by the parameter value, and submits the content of that file to the servlet with the importScriptText parameter name.

    • importXMLText

      You can use the importLocalXMLFile parameter to send the importXMLText parameter to the servlet. The importLocalXMLFile option reads the contents of the file specified by the parameter value, and submits the content of that file to the servlet with the importXMLText parameter name.

    For more information about the available parameters and their use, run the CTContainerTest program with no arguments, as follows:


    java -cp idmtesting.jar com.sun.idm.testing.adapter.CTContainerTest

    The following examples illustrate different ways to run this command.


    Note –

    To run these examples in a Windows environment, you must adjust the hostname and port, change the classpath separation character from a colon (:) to a semicolon (;), and change the path separator from a backward slash (/) to a forward slash (\).


    Running a Compatibility Test Using the Default DataProvider


    java -cp idmtesting.jar:idmcommon.jar com.sun.idm.testing.adapter.CTContainerTest
    -url "http://host:port/idm/servlet/CTServlet"
    -adapter com.waveset.adapter.SimulatedResourceAdapter -ns SimulatedAdapterTests
    -importLocalXMLFile ./example.1/SimulatedCompatibilityConfig.xml -includedTests
    DeleteMissing

    Running a Compatibility Test with Added Tests


    java -cp idmtesting.jar:idmcommon.jar com.sun.idm.testing.adapter.CTContainerTest
    -url "http://host:port/idm/servlet/CTServlet"
    -adapter com.waveset.adapter.SimulatedResourceAdapter -ns SimulatedAdapterTests
    -importLocalXMLFile ./example.2/SimulatedCompatibilityConfig.xml -includedTests
    DeleteMissing,EnableExisting,DisableExisting,DeleteExisting,Create

    Running a Compatibility Test After Finishing the Test Configuration


    java -cp idmtesting.jar:idmcommon.jar com.sun.idm.testing.adapter.CTContainerTest
    -url "http://host:port/idm/servlet/CTServlet"
    -adapter com.waveset.adapter.SimulatedResourceAdapter -ns SimulatedAdapterTests
    -importLocalXMLFile ./example.3/SimulatedCompatibilityConfig.xml

    Running a Compatability Test After Executing Beanshell Script


    java -cp idmtesting.jar:idmcommon.jar com.sun.idm.testing.adapter.CTContainerTest
    -url "http://host:port/idm/servlet/CTServlet"
    -adapter com.waveset.adapter.SimulatedResourceAdapter -ns SimulatedAdapterTests
    -importLocalScriptFile ./example.4/SimulatedCompatibilityConfig.bsh