Package com.sun.javatest
Class FileParameters
- java.lang.Object
-
- com.sun.javatest.BasicParameters
-
- com.sun.javatest.FileParameters
-
- All Implemented Interfaces:
Parameters
,Parameters.ConcurrencyParameters
,Parameters.EnvParameters
,Parameters.ExcludeListParameters
,Parameters.KeywordsParameters
,Parameters.LegacyEnvParameters
,Parameters.MutableConcurrencyParameters
,Parameters.MutableExcludeListParameters
,Parameters.MutableKeywordsParameters
,Parameters.MutablePriorStatusParameters
,Parameters.MutableTestsParameters
,Parameters.MutableTimeoutFactorParameters
,Parameters.PriorStatusParameters
,Parameters.TestsParameters
,Parameters.TimeoutFactorParameters
public class FileParameters extends BasicParameters implements Parameters.LegacyEnvParameters
An implementation of Parameters, using data read from a .jtp file.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.sun.javatest.Parameters
Parameters.ConcurrencyParameters, Parameters.EnvParameters, Parameters.ExcludeListParameters, Parameters.KeywordsParameters, Parameters.LegacyEnvParameters, Parameters.MutableConcurrencyParameters, Parameters.MutableExcludeListParameters, Parameters.MutableKeywordsParameters, Parameters.MutablePriorStatusParameters, Parameters.MutableTestsParameters, Parameters.MutableTimeoutFactorParameters, Parameters.PriorStatusParameters, Parameters.TestsParameters, Parameters.TimeoutFactorParameters
-
-
Field Summary
-
Fields inherited from class com.sun.javatest.BasicParameters
concurrencyError, excludeListError, keywordsError, testSuiteError, timeoutFactorError, workDirError
-
Fields inherited from interface com.sun.javatest.Parameters.ConcurrencyParameters
MAX_CONCURRENCY, MIN_CONCURRENCY
-
Fields inherited from interface com.sun.javatest.Parameters.MutableExcludeListParameters
CHECK_EVERY_RUN, CHECK_EVERY_X_DAYS, CUSTOM_EXCLUDE_LIST, INITIAL_EXCLUDE_LIST, LATEST_EXCLUDE_LIST, NO_EXCLUDE_LIST
-
Fields inherited from interface com.sun.javatest.Parameters.MutableKeywordsParameters
ALL_OF, ANY_OF, EXPR, MATCH_KEYWORDS, NO_KEYWORDS
-
Fields inherited from interface com.sun.javatest.Parameters.MutablePriorStatusParameters
MATCH_PRIOR_STATUS, NO_PRIOR_STATUS
-
Fields inherited from interface com.sun.javatest.Parameters.MutableTestsParameters
ALL_TESTS, SPECIFIED_TESTS
-
Fields inherited from interface com.sun.javatest.Parameters.TimeoutFactorParameters
MAX_TIMEOUT_FACTOR, MIN_TIMEOUT_FACTOR
-
-
Constructor Summary
Constructors Constructor Description FileParameters()
Create an empty FileParameters object.FileParameters(java.io.File file)
Create a FileParameters object, based on data read from a parameter file.FileParameters(java.lang.String... args)
Create a FileParameters object, based on command-line-like args.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.File[]
getAbsoluteEnvFiles()
Get the set of files which define the environment used to run the tests.TestEnvironment
getEnv()
Get the environment of test-suite-specific configuration values, to be passed to the script used to run each test.java.io.File[]
getEnvFiles()
Get the set of files which define the environment used to run the tests.java.lang.String
getEnvName()
Get the name of the environment to be used, from the set of environments contained in the fles set by setEnvFiles.Parameters.EnvParameters
getEnvParameters()
Get an object which provides access to the environment of test-suite-specific configuration values to be used when each test is run.TestEnvContext
getEnvTable()
Get an object containing the environments read from the environment files.java.lang.String
getErrorMessage()
If there is an error in any of the configuration values, as indicated by isValid, this method will provide a detail message about one or more of the invalid values.java.io.File
getReportDir()
Get the report directory given in the parameters.static boolean
isParameterFile(java.io.File file)
Determine if the specified file is a parameter file, as determined by whether its extension is .jtp or not.boolean
isValid()
Determine whether all the configuration values are valid.void
setEnvFiles(java.io.File... files)
Set the files which contain the environment used to run the tests.void
setEnvName(java.lang.String name)
Set the name of the environment to be used, from the set of environments contained in the fles set by setEnvFiles.void
setReportDir(java.io.File dir)
Set the report directory.-
Methods inherited from class com.sun.javatest.BasicParameters
equal, equal, getAbsoluteFiles, getConcurrency, getConcurrencyParameters, getCustomExcludeFiles, getExcludeFiles, getExcludeList, getExcludeListFilter, getExcludeListParameters, getExcludeMode, getFilters, getKeywords, getKeywordsFilter, getKeywordsMode, getKeywordsParameters, getLatestExcludeAutoCheckInterval, getLatestExcludeAutoCheckMode, getMatchKeywordsMode, getMatchKeywordsValue, getMatchPriorStatusValues, getPriorStatusFilter, getPriorStatusMode, getPriorStatusParameters, getPriorStatusValues, getRelevantTestFilter, getSpecifiedTests, getTests, getTestsMode, getTestsParameters, getTestSuite, getTimeoutFactor, getTimeoutFactorParameters, getWorkDirectory, isLatestExcludeAutoCheckEnabled, setConcurrency, setCustomExcludeFiles, setExcludeFiles, setExcludeMode, setKeywords, setKeywordsMode, setLatestExcludeAutoCheckEnabled, setLatestExcludeAutoCheckInterval, setLatestExcludeAutoCheckMode, setMatchKeywords, setMatchPriorStatusValues, setPriorStatusMode, setPriorStatusValues, setSpecifiedTests, setTests, setTestsMode, setTestSuite, setTestSuite, setTimeoutFactor, setWorkDirectory, setWorkDirectory
-
-
-
-
Constructor Detail
-
FileParameters
public FileParameters()
Create an empty FileParameters object.
-
FileParameters
public FileParameters(java.io.File file) throws java.io.FileNotFoundException, java.io.IOException
Create a FileParameters object, based on data read from a parameter file.- Parameters:
file
- the file to be read to initialize this object- Throws:
java.io.FileNotFoundException
- if the file does not existjava.io.IOException
- if there is a problem reading the file
-
FileParameters
public FileParameters(java.lang.String... args)
Create a FileParameters object, based on command-line-like args. The args that are accepted are:-t
testsuite-testsuite
testsuite- Specify the test suite
-keywords
expr- Specify a keyword expression, used to filter the tests to be run.
-status
status-list- Specify the status values used to select tests at runtime.
status-list should be a comma-separated list of words from
the following list:
passed
,failed
,error
,notRun
-exclude
exclude-list-file- Specify an exclude-list file containing a list of tests to be excluded from the test run. The option can be specified more than once, with different files.
-envFile
environment-file- Specify an environment file, containing environment entries providing details on how to run tests. The option can be specified more than once, with different files.
-env
environment-name- Specify the name of the environment to be used from the set of environment files.
-concurrency
number- Specify how many tests JT Harness may run at once. The default is 1.
-timeoutFactor
number- Specify a scale factor to be used to multiply the timeout value for each test, to allow for running on slow CPUs.
-report
report-dir-r
report-dir- Specify a directory in which to write reports at the end of the test run.
-workDir
work-dir-w
work-dir- Specify a directory in which to write the results of the individual tests.
- initial-files
- Trailing file arguments are treated as initial files, used to select which parts of the test suite should be run.
- Parameters:
args
- The args used to initialize the FileParameters object.- Throws:
java.lang.IllegalArgumentException
- If an unrecognized argument is found.
-
-
Method Detail
-
isParameterFile
public static boolean isParameterFile(java.io.File file)
Determine if the specified file is a parameter file, as determined by whether its extension is .jtp or not.- Parameters:
file
- the file to be checked- Returns:
- true if the specified file is a parameter file, and false otherwise
-
getEnvParameters
public Parameters.EnvParameters getEnvParameters()
Description copied from interface:Parameters
Get an object which provides access to the environment of test-suite-specific configuration values to be used when each test is run.- Specified by:
getEnvParameters
in interfaceParameters
- Returns:
- an object which provides access to the environment to be used when each test is run.
-
getEnvFiles
public java.io.File[] getEnvFiles()
Description copied from interface:Parameters.LegacyEnvParameters
Get the set of files which define the environment used to run the tests. The files are returned as they were set by setEnvFiles.- Specified by:
getEnvFiles
in interfaceParameters.LegacyEnvParameters
- Returns:
- the set of files which define the exclude list
- See Also:
Parameters.LegacyEnvParameters.getAbsoluteEnvFiles()
,Parameters.LegacyEnvParameters.setEnvFiles(java.io.File...)
-
setEnvFiles
public void setEnvFiles(java.io.File... files)
Description copied from interface:Parameters.LegacyEnvParameters
Set the files which contain the environment used to run the tests. Relative files will be evaluated relative to the test suite root directory.- Specified by:
setEnvFiles
in interfaceParameters.LegacyEnvParameters
- Parameters:
files
- the set of files which contain the environment to be used- See Also:
Parameters.LegacyEnvParameters.getEnvFiles()
,Parameters.LegacyEnvParameters.getAbsoluteEnvFiles()
-
getAbsoluteEnvFiles
public java.io.File[] getAbsoluteEnvFiles()
Description copied from interface:Parameters.LegacyEnvParameters
Get the set of files which define the environment used to run the tests. The files are all returned as absolute files.- Specified by:
getAbsoluteEnvFiles
in interfaceParameters.LegacyEnvParameters
- Returns:
- the set of files which contact the exclude list
- See Also:
Parameters.LegacyEnvParameters.getEnvFiles()
,Parameters.LegacyEnvParameters.setEnvFiles(java.io.File...)
-
getEnvName
public java.lang.String getEnvName()
Description copied from interface:Parameters.LegacyEnvParameters
Get the name of the environment to be used, from the set of environments contained in the fles set by setEnvFiles.- Specified by:
getEnvName
in interfaceParameters.LegacyEnvParameters
- Returns:
- the name of the environment to be used to run the tests
- See Also:
Parameters.LegacyEnvParameters.setEnvName(java.lang.String)
-
setEnvName
public void setEnvName(java.lang.String name)
Description copied from interface:Parameters.LegacyEnvParameters
Set the name of the environment to be used, from the set of environments contained in the fles set by setEnvFiles.- Specified by:
setEnvName
in interfaceParameters.LegacyEnvParameters
- Parameters:
name
- the name of the environment to be used to run the tests- See Also:
Parameters.LegacyEnvParameters.getEnvName()
-
getEnvTable
public TestEnvContext getEnvTable()
Get an object containing the environments read from the environment files.- Returns:
- an object containing all the environments read from the environment files.
- See Also:
setEnvFiles(java.io.File...)
,setEnvName(java.lang.String)
-
getEnv
public TestEnvironment getEnv()
Description copied from interface:Parameters.EnvParameters
Get the environment of test-suite-specific configuration values, to be passed to the script used to run each test.- Specified by:
getEnv
in interfaceParameters
- Specified by:
getEnv
in interfaceParameters.EnvParameters
- Returns:
- an environment to be passed to the script used to run each test.
- See Also:
Parameters.getEnv()
-
isValid
public boolean isValid()
Description copied from interface:Parameters
Determine whether all the configuration values are valid. If so, the result will be true; if not, the result will be false, and getErrorMessage will provide details about at least one of the invalid values.- Specified by:
isValid
in interfaceParameters
- Overrides:
isValid
in classBasicParameters
- Returns:
- true if and only if all the configuration values are valid
- See Also:
Parameters.getErrorMessage()
-
getErrorMessage
public java.lang.String getErrorMessage()
Description copied from interface:Parameters
If there is an error in any of the configuration values, as indicated by isValid, this method will provide a detail message about one or more of the invalid values. The result is undefined if isValid is true.- Specified by:
getErrorMessage
in interfaceParameters
- Overrides:
getErrorMessage
in classBasicParameters
- Returns:
- a detail message about one or more invalid values
- See Also:
Parameters.isValid()
-
getReportDir
public java.io.File getReportDir()
Get the report directory given in the parameters.- Returns:
- the report directory
- See Also:
setReportDir(java.io.File)
-
setReportDir
public void setReportDir(java.io.File dir)
Set the report directory.- Parameters:
dir
- the report directory- See Also:
getReportDir()
-
-