You may wish to run the tests individually first, so you can get a feel
for how to interact with the command-line interface. However, you must
successfully complete all of the tests for your program category, using
the program com.sun.jini.compat.harness.Runner
, for your
service to be considered conformant.
Passing the Jini Technology Lookup, Discovery,
and Join Compatibility Kit gives details of the procedures
necessary to verify compatibility.
The individual tests are documented in the Jini(TM) Technology Lookup, Discovery, and Join Compatibility Kit Test Descriptions.
This document contains instructions for setting up your environment to run the LDJ Kit tests, followed by two examples of running the kit.
Please ensure that the combination of operating system and Java(TM) 2 SDK, Standard Edition that you are using is one that we have tested. For a list of supported configurations, take a look at the platforms on which the LDJ Kit has been tested, listed at http://java.sun.com/developer/products/jini/tested.html.
Make sure that the Java 2 SDK executable files are accessible from your executable path environment variable. You can test to ensure that you have the correct version of the Java 2 SDK installed and that your executable path is set up properly by typing:
java -version
rmid
The LDJ Kit starts a lookup service which requires that the Java Remote Method Invocation (Java RMI) activation daemon be running. The RMI activation daemon needs to be started in the following way:
For example, on a UNIX platform using the Java 2 SDK v1.2.2-006 (or later), starting
- On the default port, 1098
- With a log directory to which you have write permission
- In a shell or window with no CLASSPATH setting
- If v1.2.2-006 (or later) of the Java 2 SDK is being used, see the document on
rmid
Exec Policies for Jini(TM) Technologyrmid
as follows:% cd /tmp % setenv CLASSPATH % rmid -J-Dsun.rmi.activation.execPolicy=nonecausesrmid
to enforce the same security policy as earlier versions ofrmid
. For earlier versions of 1.2.2, there is no need to set the property,-J-Dsun.rmi.activation.execPolicy=none
.To run
rmid
on Microsoft Windows platforms, using the Java 2 SDK v1.2.2-006 (or later), open a Command Prompt window, by using the "Start" button, and selecting "Programs" and then "Command Prompt". In that window:C:\> cd C:\temp C:\> set CLASSPATH= C:\> start /min rmid -J-Dsun.rmi.activation.execPolicy=nonecausesrmid
to enforce the same security policy as earlier versions ofrmid
. For earlier versions of 1.2.2, there is no need to set the property,-J-Dsun.rmi.activation.execPolicy=none
.
You will need an HTTP server for your service. If you do not use an HTTP server to provide your downloadable JAR files to clients, you will fail at least one of the tests in the LDJ Kit. You can use the HTTP server provided with the Jini Technology Starter Kit (starter kit). Instructions on how to run it may be found in the starter kit.
It is important to note that the LDJ Kit test harness always starts an HTTP server on port 8080 for internal use. As a result, the HTTP server used to support class loading for the service under test must use a port other than 8080. The default HTTP port 80 is therefore available for use; however, in this document it will be assumed that all services use an HTTP server bound to port 8081.
The LDJ Kit configuration file contains property definitions that must be customized for your environment. Since none of the files provided with the LDJ Kit distribution should be modified directly, change directory to the LDJ Kit installation directory and copy the
ldj.prop
file to a new file name, for modification. This file name will be passed to the LDJ Kit command line later.For example, on a UNIX platform where you have the LDJ Kit installed in
/files/jinildj1_0/
:% cd /files % cp jinildj1_0/ldj.prop my.propOr on the Microsoft Windows platforms, where you have the LDJ Kit software installed inC:\files\jinildj1_0
:% cd C:\files % copy jinildj1_0\ldj.prop my.propThere are two property values, specifying directory locations, that you must set in order for the LDJ Kit to run correctly. Other property values may also be necessary in certain situations. The LDJ Kit properties are:In addition to the above properties, Admins can define their own properties. The
- property:
com.sun.jini.compat.scratchDir
must be set: Always
purpose: Specifies the directory used by the LDJ Kit for temporary storage. If the scratchDir does not exist, an attempt will be made to create it for you.
restrictions: The path must be absolute, including a leading slash (/) on UNIX or a drive letter (:\\) on windows. Slashes in Windows path names must be doubled (\\).
- property:
com.sun.jini.compat.installDir
must be set: Always
purpose: Specifies the directory where the LDJ Kit is installed and is used to find LDJ Kit JAR files and other configuration files.
restrictions: The path must be absolute, including a leading slash (/) on UNIX or a drive letter (:\\) on Windows. Slashes in Windows path names must be doubled (\\).
- property:
com.sun.jini.compat.failureTime
must be set: Only if running on a very slow network.
purpose: Sets the smallest unit of time, in milliseconds, that is useful for failure detection. Multiples of this time are used in many tests for timing. The default value is 30000 milliseconds (30 seconds).
restrictions: None.
- property:
com.sun.jini.compat.categories
must be set: Only if the-categories
option is not set on the LDJ Kit command line.
purpose: Specifies the category of the program that you are testing.
restrictions: Possible values are: client, service, and lookup. You can specify multiple categories by using a comma-separated list with no spaces.
- property:
com.sun.jini.compat.adminClass
must be set: Always
purpose: Specifies the implementation class of the Admin component. If you want to use your own custom Admin, you must specify its class name here.
restrictions: Must be a dot-delimited class name of a class that is in the LDJ Kit's classpath.
- property:
com.sun.jini.compat.lookupPlatformDir
must be set: If your service being tested expects certain classes to be available in the lookup service class loader hierarchy.
purpose: Specifies the directory that contains your extra classes or JAR files that need to be in the class loader hierarchy of the LDJ Kit's lookup service.
restrictions: Since all classes and JAR files in this directory will be loaded through the extension class loader, this directory must contain only the necessary classes and JAR files and nothing more. Slashes in Windows path names must be doubled (\\). The given directory path must be an absolute pathname.
- property:
com.sun.jini.compat.unofficialQuietTime
must be set: During an official LDJ Kit test run, this property must either not be set or be set to a value greater than or equal to the default value of 600000 milliseconds (10 minutes).
purpose: Sets the time, in milliseconds, that the LDJ Kit should wait to ensure that an action or event does not occur. Setting this property to a value less than 10 minutes is generally used for debugging purposes since it will speed up the LDJ Kit execution time.
restrictions: Setting this property to anything less than the default value of 600000 (10 minutes) will make the LDJ Kit run unofficial.
- property:
com.sun.jini.compat.debugLevel
must be set: Completely optional.
purpose: Sets the debug level of the LDJ Kit. This property is generally used for debugging purposes.
restrictions: The possible values are:
- none - no extra feedback (the default)
- error - only displays extra information when something fails
- all - shows all extra information
- property:
com.sun.jini.compat.defaultAdmin.address
must be set: If using any of the default Admins and your program is running on a different host than the LDJ Kit.
purpose: All DefaultAdmin subclasses use this property to determine the host address of the program being tested.
restrictions: This property must be set to test a program (service, client, or lookup service) that will be run on a host that is different than where the LDJ Kit will be run.ldj.prop
configuration file included in the LDJ Kit download contains commented-out property definitions for the example Admins contained in the LDJ Kit. These are for reference purposes only.
DefaultServiceAdmin
com.sun.jini.mahalo
package in the Jini starter kit.
For this example, we assume that the Jini technology infrastructure
software and documentation is available in the directory /files/jini2_1
.
The DefaultServiceAdmin
asks you to start and stop your
service (Mahalo) for each test. Since the activatable implementation of
Mahalo is being used and to ensure that the service is re-created
rather than reactivated for each test, there will be a lot of manual stopping and restarting of
rmid
. To make the stopping and
restarting easier, this example will require four shells or windows:
one in which to run an http server for Mahalo, one in which to run
rmid
, one in which to run Mahalo,
and one in which to run the LDJ Kit.
The general order of operations will be:
rmid
is started as specified earlier
rmid
rmid
rmid
Customize the LDJ Kit configuration file
Copy the LDJ Kit configuration file to
my.prop
as specified earlier and set these properties:
com.sun.jini.compat.scratchDir=/tmp
com.sun.jini.compat.installDir=/files/jinildj1_0
com.sun.jini.compat.unofficialQuietTime=60000
com.sun.jini.compat.categories=service
com.sun.jini.compat.adminClass=com.sun.jini.compat.harness.DefaultServiceAdmin
The
com.sun.jini.compat.installDir
should accurately reflect the installation directory of the LDJ Kit on your system. Thecom.sun.jini.compat.scratchDir
should be a location to which the LDJ Kit may write temporary files and log files. If the specified directory does not exist, then the directory will be created for you as part of the LDJ Kit run. Lowering the value ofcom.sun.jini.compat.unofficialQuietTime
from its default 600000 milliseconds (10 minutes) to 60000 milliseconds (1 minute) will dramatically decrease the test time for this example run.
Assuming that an http server for Mahalo andrmid
are already running in two windows, start the test program in a third window. For complete instructions on starting the LDJ Kit, see the Command-line Usage for the Jini Technology Lookup, Discovery, and Join Compatibility Kit. Here's an example of how to start the test harness on a UNIX platform:The output should look like:
java -Djava.security.policy=/files/jinildj1_0/policy/policy.all -cp /files/jinildj1_0/lib/compat.jar com.sun.jini.compat.harness.Runner /files/my.prop -tests com.sun.jini.compat.test.RegistrationTest
--------------------------- CONFIGURATION FILE: /files/my.prop --------------------------- SETTING UP THE TEST LIST: Adding test: com.sun.jini.compat.test.RegistrationTest --------------------------- LDJ Kit PROPERTIES: Date started: Thu May 22 18:39:21 EDT 2005 Installation directory of the LDJ Kit: com.sun.jini.compat.installDir=/files/jinildj1_0 Scratch directory for the LDJ Kit: com.sun.jini.compat.scratchDir=/tmp Platform directory for the LDJ Kit Lookup Service: com.sun.jini.compat.lookupPlatformDir=null Failure time (in milliseconds): com.sun.jini.compat.failureTime=30000 Quiet time (in milliseconds): com.sun.jini.compat.unofficialQuietTime=60000 Categories being tested: com.sun.jini.compat.categories=service Debug output level of the LDJ Kit: com.sun.jini.compat.debugLevel=none Admin class for the program-under-test: com.sun.jini.compat.adminClass=com.sun.jini.compat.harness.DefaultServiceAdmin IP address of the program-under-test: com.sun.jini.compat.adminClass.getAddress()=myhost/123.45.67.89 --------------------------- ENVIRONMENT PROPERTIES: JVM information: Java HotSpot(TM) Client VM, 1.4.1-b21 Sun Microsystems Inc. LDJ Kit VM classpath: /files/jinildj1_0/lib/compat.jar:/files/jini2_1/lib/jsk-platform.jar OS information: SunOS, 5.8, sparc --------------------------- STARTING TO RUN THE TESTS Running com.sun.jini.compat.test.RegistrationTest... Time is Thu May 22 18:42:18 EDT 2005 UNOFFICIAL TEST RUN Start the program now. Press Enter when program started:
At this point, start Mahalo in a fourth window.
For an example of how to start the activatable implementation of Mahalo using either JRMP or Jini ERI for remote communication, see the API documentation for the
com.sun.jini.mahalo
package in the v2.1 starter kit.
- Once Mahalo has started and registered with the activation system, you can return to the shell where the LDJ Kit is executing and press the "Enter" key. At this point, you should see a new message in that shell:
Testing....- The program pauses and asks you to select your service from the ones registered with the lookup service started by the LDJ Kit:
Which of the following is the program being tested? 0) None of these 1) class com.sun.jini.compat.reggie.RegistrarProxy from codebase http://123.45.67.89:8080/compat-lus-dl.jar 2) class com.sun.jini.mahalo.TxnManagerImpl_Stub from http://myHostName:8081/mahalo-dl.jarSelect the number of Mahalo, and press the "Enter" key:Select number and press Enter: 2- You are then prompted to stop the program. Before you press the "Enter" key, you'll need to perform the sequence of "clean-up" activities, which we will go through next.
Stop the program now. Press Enter when program stopped:- In the window where you are running
rmid
, quit out of the process and remove the log directory:% rmid ^C % rm -rf log- Remember to remove the log directory for Mahalo:
% rm -rf /tmp/txn_log- Return to the
Runner
window, press the "Return" or "Enter" key, and you'll see:Test Passed: OK --------------------------Congratulations! You've made it through one of the ten tests that a service must pass.
my.prop
, to comment out the
property com.sun.jini.compat.unofficialQuietTime
. Because an
official run would take about an hour to complete successfully, this
example will continue to use a
com.sun.jini.compat.unofficialQuietTime
of 60000
milliseconds (1 minute).
By using one of the custom Admins provided with the LDJ Kit, you will avoid having
to start and stop rmid
and Mahalo for each of the ten
tests. In addition, you will never have to execute the Mahalo command line,
as the Admin will take care of registering Mahalo's activation descriptor
with rmid
.
First you will need to change several of the properties in the config file, so edit
my.prop
(created in the previous example) to define these property values:The
com.sun.jini.compat.scratchDir=/tmp
com.sun.jini.compat.installDir=/files/jinildj1_0
com.sun.jini.compat.unofficialQuietTime=60000
com.sun.jini.compat.categories=service
com.sun.jini.compat.adminClass=com.sun.jini.compat.admin2.ServiceStarterAdmin
com.sun.jini.compat.admin2.starterConfig=/files/jinildj1_0/configs/mahalo-activatable.config
com.sun.jini.compat.admin2.jskHome=/files/jini2_1
com.sun.jini.compat.admin2.javaHome=/files/java
com.sun.jini.compat.admin2.*
properties that are defined above are all documented in theldj.prop
file.
Assuming that an http server for Mahalo is running (at port 8081) in one window and that
rmid
is running in a second window, start the test program in a third window. For complete instructions on starting the LDJ Kit, see the Command-line Usage for the Jini Technology Lookup, Discovery, and Join Compatibility Kit.The Admin we are using,
com.sun.jini.compat.admin2.ServiceStarterAdmin
, is contained in thecompat-admin2.jar
within the LDJ Kitlib
directory. This Admin requires thatjsk-platform.jar
, found in the Jini starter kitlib
directory, also be included in the classpath. Here's an example of how to start the test harness on a UNIX platform:The output will tell you that ten of the tests are applicable to the service being tested and that nine of the tests are just to test lookup services. The output may look a little disconcerting the first time you execute the command, but as long as it doesn't contain any errors that tell you it can't locate a class or a policy file, you should be in good shape. Without
java -Djava.security.policy=/files/jinildj1_0/policy/policy.all -cp /files/jinildj1_0/lib/compat.jar:/files/jinildj1_0/lib/compat-admin2.jar:/files/jini2_1/lib/jsk-platform.jar com.sun.jini.compat.harness.Runner /files/my.prop
com.sun.jini.compat.debugLevel
set toall
, some tests may appear to be doing nothing. Be patient. Some tests will take many times the value specified by thecom.sun.jini.compat.unofficialQuietTime
property to execute.A complete set of successful results will look like this:
--------------------------- CONFIGURATION FILE: /files/my.prop --------------------------- SETTING UP THE TEST LIST: Adding test: com.sun.jini.compat.test.RequestPacketTest Adding test: com.sun.jini.compat.test.UnicastRequestTest Adding test: com.sun.jini.compat.test.CodeDownloadTest Adding test: com.sun.jini.compat.test.AnnouncementResponseTest Adding test: com.sun.jini.compat.test.RegistrationTest Adding test: com.sun.jini.compat.test.MultiRegistrationTest Adding test: com.sun.jini.compat.test.PublicGroupTest Adding test: com.sun.jini.compat.test.NonPublicGroupTest Adding test: com.sun.jini.compat.test.MultiGroupTest Adding test: com.sun.jini.compat.test.LeaseTest Skipping test: com.sun.jini.compat.test.LookupByServiceIDTest Reason: category mismatch Categories selected for this run: service Categories this test applies to: lookup Skipping test: com.sun.jini.compat.test.LookupByClassTest Reason: category mismatch Categories selected for this run: service Categories this test applies to: lookup Skipping test: com.sun.jini.compat.test.LookupBySuperClassTest Reason: category mismatch Categories selected for this run: service Categories this test applies to: lookup Skipping test: com.sun.jini.compat.test.LookupByInterfaceTest Reason: category mismatch Categories selected for this run: service Categories this test applies to: lookup Skipping test: com.sun.jini.compat.test.MultipleServiceLeaseRenewalTest Reason: category mismatch Categories selected for this run: service Categories this test applies to: lookup Skipping test: com.sun.jini.compat.test.ServiceLeaseExpirationTest Reason: category mismatch Categories selected for this run: service Categories this test applies to: lookup Skipping test: com.sun.jini.compat.test.ServiceIDTest Reason: category mismatch Categories selected for this run: service Categories this test applies to: lookup Skipping test: com.sun.jini.compat.test.MultipleEventLeaseRenewalTest Reason: category mismatch Categories selected for this run: service Categories this test applies to: lookup Skipping test: com.sun.jini.compat.test.EventLeaseExpirationTest Reason: category mismatch Categories selected for this run: service Categories this test applies to: lookup --------------------------- LDJ Kit PROPERTIES: Date started: Thu May 22 20:09:03 EDT 2005 Installation directory of the LDJ Kit: com.sun.jini.compat.installDir=/files/jinildj1_0 Scratch directory for the LDJ Kit: com.sun.jini.compat.scratchDir=/tmp Failure time (in milliseconds): com.sun.jini.compat.failureTime=30000 Quiet time (in milliseconds): com.sun.jini.compat.unofficialQuietTime=60000 Categories being tested: com.sun.jini.compat.categories=service Debug output level of the LDJ Kit: com.sun.jini.compat.debugLevel=none Admin class for the program-under-test: com.sun.jini.compat.adminClass=com.sun.jini.compat.admin2.ServiceStarterAdmin IP address of the program-under-test: com.sun.jini.compat.adminClass.getAddress()=myhost/123.45.67.89 --------------------------- ENVIRONMENT PROPERTIES: JVM information: Java HotSpot(TM) Client VM, 1.4.1-b21 Sun Microsystems Inc. LDJ Kit VM classpath: /files/jinildj1_0/lib/compat.jar:/files/jinildj1_0/lib/compat-admin2.jar:/files/jini2_1/lib/jsk-platform.jar OS information: SunOS, 5.8, sparc --------------------------- STARTING TO RUN THE TESTS Running com.sun.jini.compat.test.RequestPacketTest... Time is Thu May 22 20:09:03 EDT 2005 UNOFFICIAL TEST RUN Test Passed: OK -------------------------- Running com.sun.jini.compat.test.UnicastRequestTest... Time is Thu May 22 20:10:26 EDT 2005 UNOFFICIAL TEST RUN Test Passed: OK -------------------------- Running com.sun.jini.compat.test.CodeDownloadTest... Time is Thu May 22 20:11:14 EDT 2005 UNOFFICIAL TEST RUN Test Passed: OK -------------------------- Running com.sun.jini.compat.test.AnnouncementResponseTest... Time is Thu May 22 20:12:31 EDT 2005 UNOFFICIAL TEST RUN Test Passed: OK -------------------------- Running com.sun.jini.compat.test.RegistrationTest... Time is Thu May 22 20:13:15 EDT 2005 UNOFFICIAL TEST RUN Test Passed: OK -------------------------- Running com.sun.jini.compat.test.MultipleRegistrationTest... Time is Thu May 22 20:14:38 EDT 2005 UNOFFICIAL TEST RUN Test Passed: OK -------------------------- Running com.sun.jini.compat.test.PublicGroupTest... Time is Thu May 22 20:35:12 EDT 2005 UNOFFICIAL TEST RUN Test Passed: OK -------------------------- Running com.sun.jini.compat.test.NonPublicGroupTest... Time is Thu May 22 20:37:37 EDT 2005 UNOFFICIAL TEST RUN Test Passed: OK -------------------------- Running com.sun.jini.compat.test.MultipleGroupTest... Time is Thu May 22 20:40:58 EDT 2005 UNOFFICIAL TEST RUN Test Passed: OK -------------------------- Running com.sun.jini.compat.test.LeaseTest... Time is Thu May 22 20:47:55 EDT 2005 UNOFFICIAL TEST RUN Test Passed: OK -------------------------- Summary -- com.sun.jini.compat.test.RequestPacketTest Test Passed: OK -------------------------- com.sun.jini.compat.test.UnicastRequestTest Test Passed: OK -------------------------- com.sun.jini.compat.test.CodeDownloadTest Test Passed: OK -------------------------- com.sun.jini.compat.test.AnnouncementResponseTest Test Passed: OK -------------------------- com.sun.jini.compat.test.RegistrationTest Test Passed: OK -------------------------- com.sun.jini.compat.test.MultipleRegistrationTest Test Passed: OK -------------------------- com.sun.jini.compat.test.PublicGroupTest Test Passed: OK -------------------------- com.sun.jini.compat.test.NonPublicGroupTest Test Passed: OK -------------------------- com.sun.jini.compat.test.MultipleGroupTest Test Passed: OK -------------------------- com.sun.jini.compat.test.LeaseTest Test Passed: OK -------------------------- # of tests started = 10 # of tests completed = 10 # of tests passed = 10 # of tests failed = 0 -------------------------- Date finished: Thu May 22 20:50:51 EDT 2005 Time elapsed: 2508 seconds