com.sun.javatest
Class FileParameters

java.lang.Object
  extended by com.sun.javatest.BasicParameters
      extended by 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.MutableTestsParameters
ALL_TESTS, SPECIFIED_TESTS
 
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.ConcurrencyParameters
MAX_CONCURRENCY, MIN_CONCURRENCY
 
Fields inherited from interface com.sun.javatest.Parameters.TimeoutFactorParameters
MAX_TIMEOUT_FACTOR, MIN_TIMEOUT_FACTOR
 
Constructor Summary
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
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 exist
java.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.
The test suite, work directory and report directory are evaluated relative to the user's current directory, unless the location specified is an absolute path. The exclude list and environment files are located relative to the test suite location, unless they are absolute paths.

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 interface Parameters
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 interface Parameters.LegacyEnvParameters
Returns:
the set of files which define the exclude list
See Also:
Parameters.LegacyEnvParameters.getAbsoluteEnvFiles(), Parameters.LegacyEnvParameters.setEnvFiles(java.io.File[])

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 interface Parameters.LegacyEnvParameters
Returns:
the set of files which contact the exclude list
See Also:
Parameters.LegacyEnvParameters.getEnvFiles(), 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 interface Parameters.LegacyEnvParameters
Parameters:
files - the set of files which contain the environment to be used
See Also:
Parameters.LegacyEnvParameters.getEnvFiles(), Parameters.LegacyEnvParameters.getAbsoluteEnvFiles()

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 interface Parameters.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 interface Parameters.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 interface Parameters
Specified by:
getEnv in interface Parameters.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 interface Parameters
Overrides:
isValid in class BasicParameters
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 interface Parameters
Overrides:
getErrorMessage in class BasicParameters
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()


Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.