Editing Responses in a Configuration File

The JavaTest harness provides an EditJTI utility that you can use from the command line to edit the responses in a configuration file without opening the JavaTest GUI. The EditJTI utility is the batch command equivalent of the JavaTestTM Configuration Editor.

Format of EditJTI Command

The EditJTI utility loads a configuration (.jti) file, and applies a series of specified edits. You can save the file back to the original file, or to another file. You can use the EditJTI utility to generate an HTML log of the questions and responses as well as write a quick summary of the questions and responses to the console. The EditJTI utility provides a preview mode; in addition, configuration files are normally backed up before being overwritten.

Example:
java -cp lib/javatest.jar com.sun.javatest.EditJTI [OPTIONS] [EDIT COMMANDS] original configuration file

While it is possible to use EditJTI to change the order of commands in a configuration file, because of the dependencies between values, it is recommended that major changes in the .jti file be accomplished by using the Configuration Editor.

OPTIONS
The various options are as follows:
-help
-usage
/?
Display a summary of the command line options.
-classpath classpath
-cp classpath
Override the default classpath used to load the classes for the configuration interview. The default is determined from the work directory and test suite specified in the configuration file. The new location will be as specified by this option.
-log log-file
-l log-file
Generate an HTML log containing the questions and responses from the configuration file. The log is generated after any edits have been applied.
-out out-file
-o out-file
Specify where to write the configuration file after the edits (if any) have been applied. The default is to overwrite the input file if the interview is edited.
-path
-p
Generate a summary to the console output stream of the sequence of questions and responses from the configuration file. The summary is generated after any edits have been applied.
-preview
-n
Do not write out any files, but instead, preview what would happen if this option were not specified.
-testsuite test-suite
-ts test-suite
Override the default location used to load the classes for the configuration interview. The default is determined from the work directory and test suite specified in the configuration file. The new location is determined from the specified test suite.
-verbose
-v
Verbose mode. As the edit commands are executed, details of the changes are written to the console output stream.

EDIT COMMANDS
Two different types of edit command are supported.
tag-name=value
Set the value for the question whose tag is tag-name to value. It is an error if no such question is found. The question must be on the current path of questions being asked by the interview. To determine the current path, use the -path option. See Obtaining the Question tag-name below.
/search-string/replace-string/
Scan the path of questions being asked by the interview, looking for responses that match (contain) the search string. In such answers, replace search-string by replace-string. Note that changing the response to a question may change the subsequent questions that are asked. It is an error if no such questions are found.

If you wish to use / in the search string, you may use some other punctuation character as a delimiter, instead of /. For example, |search-string|replace-string|

Note: regular expressions are not currently supported in search-string, but may be supported in a future release.

Depending on the shell you are using, you may need to quote your edit commands, to protect any characters in them against interpretation by the shell.

RETURN CODE
The program will exit with one of the following return codes:
0the operations were successful; the configuration file is complete and ready to use.
1the operations were successful, but the configuration file is incomplete and is not yet ready to use for a test run.
2there was a problem with the command line arguments
3an error occurred while trying to perform the copy

SYSTEM PROPERTIES
Two system properties are recognized:
EditJTI.maxIndent
Used when generating the output for the -path option, this property specifies the maximum length of tag name after which the output will be line-wrapped before writing the corresponding value. The default value is 32.
EditJTI.numBackups
Specifies how many levels of backup to keep when overwriting a .jti file. The default is 2. A value of 0 disables backups.

Obtaining the Question tag-name

There are two ways to obtain the question tag-name:

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

doc/javatest/editJTI.html