Testing

CAS has two sets of tests, one for the back end database access module and another set to test the service itself. To install both tests, install the CAS test package (gt4-cas-delegation-test-$version;-src_bundle.tar.gz) using GPT. FILLME: instructions into GLOBUS_LOCATION.

Assumptions:

  • A back end database has been set up and configured. By default Derby is set up and configured.
  • The CAS service and tests are installed in $GLOBUS_LOCATION.
  • The sample commands assume:

    1. The container is started up on localhost and port 8443.
    2. The default Derby database configuration is used, i.e database name is casDatabase and user is casAdmin

1.  Testing the back end database module

  1. Run:

    cd $GLOBUS_LOCATION 
  2. Populate the file etc/globus_cas_unit_test/casTestProperties with the database configuration information shown in the following table.

    Table 1. Test database properties

    dbDriver The JDBC driver to be used
    dbConnectionURL The JDBC connection url to be used to connect to the database
    dbUsername The user name to use when connecting to the database
    dbPassword The password corresponding to the user name

    If default Derby configuration is required,

    1. Uncomment the lines in etc/globus_cas_unit_test/casTestProperties following the comment # Uncomment below for Derby Embedded Driver..

    2. Edit dbConnectionURL to replace GLOBUS_LOCATION with path to your installation. For example, if your GLOBUS_LOCATION is /temp/globus, then the property should look like dbConnectionURL=jdbc:derby:/temp/globus/var/casDatabase

    3. Comment out all other occurances of these properties

  3. The database needs to be empty for these tests to work and will be deleted by this target. Run:

          set GLOBUS_LOCATION=C:\globus
          ant -f share/globus_cas_unit_test/cas-test-build.xml testDatabase 
  4. Test reports are placed in $GLOBUS_LOCATION/share/globus_cas_unit_test/cas-test-reports.

[Important]Important

The database bootstrap needs to be done again for the server to be ready to receive client requests.

2.  Testing the CAS service module

These tests can be set up so as to be able to test multiple user scenarios or they can be configured to run as just a single identity. The first set of tests are used to test admin functionality and set up the database for a second user. As the second user the permissions and queries are tested to ensure that the setup worked.

As with the previous any database backend can be used for testing. If the default Derby database is used, it needs to be configured in network mode since these tests require that both the tested CAS server and the tests use the database. Two files need to be modified for configuring these tests and they are described below.

  1. The etc/globus_cas_unit_test/casTestProperties needs to be configured with appropriate database information and service information.

    The database information is configured similar to previous test, but for the default Derby installation, the network driver needs to be used.

    1. Uncomment the lines in etc/globus_cas_unit_test/casTestProperties following the comment # Uncomment below for Derby Network Driver..

    2. Edit dbConnectionURL to replace GLOBUS_LOCATION with path to your installation. For example, if your GLOBUS_LOCATION is /temp/globus, then the property should look like dbConnectionURL=jdbc:derby:/temp/globus/var/casDatabase

    3. Comment out all other occurances of these properties.

    Now edit the server specific information as shown below:

    Table 2. Test properties

    user1SubjectDNThe DN of the user running the first set of tests.
    user2SubjectDNThe DN of the user running the second set of tests. This DN has to be different from the value specified for user1SubjectDN. Note: Both tests can be run as the same user as long as the DN of the certificate being used to run the tests matches the value specified in user1SubjectDN. In this case, the value of user2SubjectDN can be set to a arbitrary string.
    maxAssertionLifetimeShould match the value set in the service configuration as shown in Configuration Information.
    hostHost on which the CAS service is running.
    portPort on which the CAS service is running.
    securityTypeThis is an optional parameter indicating the security type to use. Can be set to message for Secure Message or conversation for Secure Conversation or transport for Secure Transport (the default configuration).
    protTypeThis is an optional parameter indicating the protection type to use. Can be set to signature for integrity protection (the default configuration) or encryption for privacy protection.
  2. Edit The etc/globus_cas_unit_test/jndi-config.xml to replace GLOBUS_LOCATION with the actual Globus Location of your install.

Steps for testing:

  1. Run:

    cd $GLOBUS_LOCATION
  2. Source $GLOBUS_LOCATION/etc/globus-devel-env.sh or $GLOBUS_LOCATION/etc/globus-devel-env.csh or $GLOBUS_LOCATION/etc/globus-devel-env.bat as appropriate for your environment.

  3. In the test properties file, set user2SubjectDN to the subject in your regular proxy. The following returns the appropriate string:

    casadmin$ java org.globus.tools.CertInfo -subject -globus
  4. Generate an independent proxy using the following command:

    casadmin$ java org.globus.tools.ProxyInit -independent
  5. Set the identity in the proxy generated from the above step as user1SubjectDN in the test properties file. The following command will return the relevant string:

    casadmin$ java org.globus.tools.ProxyInfo -subject -globus
  6. Start the container on the port and host configured in CAS Test Properties.
  7. The following command runs the tests for self permissions and sets up the database for a user with subjectDN user2SubjectDN:

    casadmin$ ant -f share/globus_cas_unit_test/cas-test-build.xml user1TestService
  8. To test as the second user, generate a proxy for the subject DN specified for the second user:

    casadmin$ java org.globus.tools.ProxyInit 
  9. Now run the following:

    casadmin$ ant -f share/globus_cas_unit_test/cas-test-build.xml user2TestService
  10. Test reports are placed in $GLOBUS_LOCATION/share/globus_cas_unit_test/cas-test-reports.
  11. After these tests, the CAS database needs to be reset and all entries need to be deleted.

    ant -f share/globus_cas_unit_test/cas-test-build.xml testDatabase

[Important]Important

The database bootstrap needs to be done again for the server to be ready to receive client requests.