Examples of Using EditJTI

The following are examples of basic operations that can be performed by using EditJTI:

See Editing Responses in a Configuration File for a detailed list of options that can be used in the EditJTI command.

Edit a Configuration File

When using EditJTI to edit a configuration file you can use either one of two edit command formats:

  1. tag=value for direct replacement of values. You must know the tag-name for the question that sets the value.
  2. /old pattern/new pattern/ to replace all occurrences (strings) of an "old pattern" to a "new pattern." This format replaces all occurrences in the file.

When using the /old pattern/new pattern/ format, the separator used can be any character, however, it is recommended that the string be enclosed in quotes to avoid shell problems:

"|/java/jdk/1.3/|/java/jck/1.4/|"

The following text is a note
To run the following examples of editing configuration files, you must replace myoriginal.jti with a .jti file name that exists on your system. Win32 users must also replace the "\" file separators with "/" to run these examples.

Example:
java -cp lib/javatest.jar com.sun.javatest.EditJTI -o mynew.jti "|/java/jdk/1.3/|/java/jck/1.4/|" myoriginal.jti

Generate a Log of All Updates

You can use the -l option to generate a log of all updates to the jti file which can be used later.

Example:
java -cp lib/javatest.jar com.sun.javatest.EditJTI -o mynew.jti -l myeditlog.html "|/java/jdk/1.3/|/java/jck/1.4/|" myoriginal.jti

Preview But Not Change

You can use the -n option to preview but not perform updates to the jti file:

Example:
java -cp lib/javatest.jar com.sun.javatest.EditJTI -n -o mynew.jti -l myeditlog.html "|/java/jdk/1.3/|/java/jck/1.4/|" myoriginal.jti

Echo Results of Your Edit

You can include the -v option to echo results of your edit.

Example:
java -cp lib/javatest.jar com.sun.javatest.EditJTI -n -v -o mynew.jti -l myeditlog.html "|/java/jdk/1.3/|/java/jck/1.4/|" myoriginal.jti

Show Paths for Debugging

The -p option can be used to show the path during debugging. Using -p options in the command string displays how the path is changed by your edit.

Example:
java -cp lib/javatest.jar com.sun.javatest.EditJTI -n -o mynew.jti -l myeditlog.html -p "|/java/jdk/1.3/|/java/jck/1.4/|" myoriginal.jti

Change Test Suites or Create a New Interview

The following example uses the -ts option to create an empty interview derived from the test suite (mytestsuite.ts). This is only recommended for very simple test suites.

Example:
java -cp lib/javatest.jar com.sun.javatest.EditJTI -o mynew.jti -l myeditlog.html -ts mytestsuite.ts "|/java/jdk/1.3/|/java/jck/1.4/|" myoriginal.jti

If a change is made that is not in the current interview path, then the interview will be invalid and the tests can not be run.

Generally, you should not use EditJTI to change the interview path, only the values on the existing path. If you are in doubt about the current interview path, open the Configuration Editor in the JavaTest harness and use it to change the values. The Configuration Editor will then display the current interview path for that question name/value.

Change the HTTP Port and Overwrite Original Configuration File

The following example changes the http port used when running tests and overwrites original configuration file (myoriginal.jti in this example).

The following text is a note
To run the following example you must use a .jti file that exists on your system and include httpPort in your current interview path. If your current interview path does not include httpPort you will not be able to change its value from the command line. To view the current interview path, open your .jti file in the Configuration Editor. See Obtaining the Question tag-name for detailed information about the tag-name for the question.

java -cp lib/javatest.jar com.sun.javatest.EditJTI httpPort=8081 myoriginal.jti

Change the HTTP Port and Create a New Configuration File

The following example changes the http port used when running tests and writes the changed configuration to a new configuration file (myoutput.jti in this example). The original configuration file (myoriginal.jti in this example) remains unchanged.

The following text is a note
To run the following example you must use a .jti file that exists on your system and include httpPort in your current interview path. If your current interview path does not include httpPort you will not be able to change its value from the command line. To view the current interview path, open your .jti file in the Configuration Editor. See Obtaining the Question tag-name for detailed information about the tag-name for the question.

java -cp lib/javatest.jar com.sun.javatest.EditJTI -o myoutput.jti httpPort=8081 myoriginal.jti

Doing Escapes in a UNIX Shell

The following uses the syntax for doing escapes in a UNIX shell. Changes to the original configuration file (myconfig.jti in this example) are written to a new configuration file (my-newconfig.jti in this example).

The following text is a note
To run the following example you must replace myoriginal.jti with a .jti file name that exists on your system and only change values that are in your current interview path. To view the current interview path, open your .jti file in the Configuration Editor. Win32 users must also change "/" file separators to "\" to run these examples.

To change a value in the command line, use the tag-name for the question that sets the value. See Obtaining the Question tag-name for detailed information about viewing the tag-name for the question.

java -cp lib/javatest.jar com.sun.javatest.EditJTI -o my-newconfig.jti tck.serialport.midPort=/dev/term/a tck.connection.httpsCert="\"CN=Brian K, OU=JSW, O=Sun, L=SCA22, ST=CA, C=US\"" myoriginal.jti

A detailed description of the utility is also available in your TCK at:

doc/javatest/editJTI.html