|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.javatest.WorkDirectory
public class WorkDirectory
A class providing access to the working state of a test run, as embodied in a work directory.
Nested Class Summary | |
---|---|
static class |
WorkDirectory.BadDirectoryFault
Signals that there is a serious, unrecoverable problem when trying to open or create a work directory. |
static class |
WorkDirectory.Fault
This exception is used to report problems that arise when using work directories. |
static class |
WorkDirectory.InitializationFault
Signals that there is a problem trying to initialize from the data in the work directory. |
static class |
WorkDirectory.MismatchFault
Signals that a work directory does not match the given test suite. |
static class |
WorkDirectory.NotWorkDirectoryFault
Signals that a directory (while valid in itself) is not a valid work directory. |
static class |
WorkDirectory.PurgeFault
Signals that a problem occurred while trying to purge files in work directory. |
static class |
WorkDirectory.TemplateMissingFault
Signals that the template pointed to by that directory is missing. |
static class |
WorkDirectory.TestSuiteFault
Signals that there is a problem trying to determine the test suite appropriate for the work directory. |
static class |
WorkDirectory.WorkDirectoryExistsFault
Signals that a work directory already exists when an attempt is made to create one. |
Field Summary | |
---|---|
static java.lang.String |
JTDATA
|
Method Summary | |
---|---|
static void |
changeTemplate(java.io.File dir,
java.io.File newTemplate)
|
static WorkDirectory |
convert(java.io.File dir,
TestSuite ts)
Convert an existing directory into a work directory. |
static WorkDirectory |
create(java.io.File dir,
TestSuite ts)
Create a new work directory with a given name, and for a given test suite. |
static java.lang.String[] |
getDiffInPaths(java.lang.String newPath,
java.lang.String oldWDpath)
|
java.io.File |
getFile(java.lang.String name)
Get a file in this work directory. |
java.io.File |
getJTData()
Get the data directory for this work directory. |
java.lang.String |
getLogFileName()
|
java.lang.String |
getPath()
Get the root directory for this work directory. |
java.lang.String |
getPrevWDPath()
|
java.io.File |
getRoot()
Get the root directory for this work directory. |
java.io.File |
getSystemFile(java.lang.String name)
Get a file in the system directory for this work directory. |
java.util.Map<java.lang.String,java.lang.String> |
getTestAnnotations(java.lang.String testName)
Get any annotations for the given test. |
java.util.Map<java.lang.String,java.lang.String> |
getTestAnnotations(TestResult tr)
Get any annotations for the given test in this work directory. |
TestResultTable |
getTestResultTable()
Get a test result table containing the test results in this work directory. |
TestSuite |
getTestSuite()
Get the test suite for this work directory. |
int |
getTestSuiteTestCount()
Find out the number of tests in the entire test suite. |
static boolean |
isEmptyDirectory(java.io.File dir)
Check if a directory is an empty directory. |
boolean |
isTRTSet()
|
static boolean |
isUsableWorkDirectory(java.io.File dir)
Do sanity check of workdir. |
static boolean |
isWorkDirectory(java.io.File dir)
Check if a directory is a work directory. |
void |
log(I18NResourceBundle i18n,
java.lang.String key)
Print a text message to the workdir logfile. |
void |
log(I18NResourceBundle i18n,
java.lang.String key,
java.lang.Object arg)
Print a text message to the workdir logfile. |
void |
log(I18NResourceBundle i18n,
java.lang.String key,
java.lang.Object[] args)
Print a text message to the workdir logfile. |
static WorkDirectory |
open(java.io.File dir)
Open an existing work directory, using the default test suite associated with it. |
static WorkDirectory |
open(java.io.File dir,
TestSuite testSuite)
Open an existing work directory, using an explicit test suite. |
boolean |
purge(java.lang.String path)
Clean the contents of the given path. |
void |
putTestAnnotation(java.lang.String testName,
java.lang.String key,
java.lang.String value)
Add an annotation for the given test. |
void |
putTestAnnotation(TestResult tr,
java.lang.String key,
java.lang.String value)
See putTestAnnotation(String,String,String). |
void |
setTestResultTable(TestResultTable trt)
Set a test result table containing the test descriptions for the tests in this test suite. |
void |
setTestSuiteTestCount(int num)
Specify the total number of tests found in this testsuite. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String JTDATA
Method Detail |
---|
public static boolean isWorkDirectory(java.io.File dir)
dir
- the directory to be checked
public static boolean isEmptyDirectory(java.io.File dir)
dir
- the directory to be checked
public static boolean isUsableWorkDirectory(java.io.File dir)
public static WorkDirectory create(java.io.File dir, TestSuite ts) throws WorkDirectory.BadDirectoryFault, WorkDirectory.WorkDirectoryExistsFault, WorkDirectory.InitializationFault
dir
- the directory to be created as a work directory.
This directory may (but need not) exist; if it does exist, it must be empty.ts
- the test suite for which this will be a work directory
WorkDirectory.WorkDirectoryExistsFault
- if the work directory
could not be created because it already exists.
If this exception is thrown, you may want to call open(java.io.File)
instead.
WorkDirectory.BadDirectoryFault
- is there was a problem creating
the work directory.
WorkDirectory.InitializationFault
- if there are unrecoverable problems encountered
while reading the data present in the work directoryconvert(java.io.File, com.sun.javatest.TestSuite)
,
open(java.io.File)
public static WorkDirectory convert(java.io.File dir, TestSuite ts) throws WorkDirectory.BadDirectoryFault, WorkDirectory.WorkDirectoryExistsFault, java.io.FileNotFoundException, WorkDirectory.InitializationFault
dir
- the directory to be converted to a work directoryts
- the test suite for which this will be a work directory
java.io.FileNotFoundException
- if the directory to be converted does
not exist
WorkDirectory.WorkDirectoryExistsFault
- if the work directory
could not be created because it already exists.
If this exception is thrown, you may want to call open(java.io.File)
instead.
WorkDirectory.BadDirectoryFault
- is there was a problem creating
the work directory.
WorkDirectory.InitializationFault
- if there are unrecoverable problems encountered
while reading the data present in the work directorycreate(java.io.File, com.sun.javatest.TestSuite)
,
open(java.io.File)
public java.lang.String getLogFileName()
public static void changeTemplate(java.io.File dir, java.io.File newTemplate)
public static java.lang.String[] getDiffInPaths(java.lang.String newPath, java.lang.String oldWDpath)
public static WorkDirectory open(java.io.File dir) throws java.io.FileNotFoundException, WorkDirectory.BadDirectoryFault, WorkDirectory.NotWorkDirectoryFault, WorkDirectory.MismatchFault, WorkDirectory.TestSuiteFault, WorkDirectory.InitializationFault, WorkDirectory.TemplateMissingFault
dir
- the directory to be opened as a WorkDirectory
java.io.FileNotFoundException
- if the directory identified by dir
does
not exist. If this exception is thrown, you may want to call create(java.io.File, com.sun.javatest.TestSuite)
instead.
WorkDirectory.BadDirectoryFault
- if there was a problem opening the
work directory.
WorkDirectory.NotWorkDirectoryFault
- if the directory identified
by dir
is a valid directory, but has not yet been
initialized as a work directory. If this exception is thrown,
you may want to call create(java.io.File, com.sun.javatest.TestSuite)
instead.
WorkDirectory.MismatchFault
- if the test suite recorded in
the work directory does not match the test suite's ID recorded
in the work directory.
WorkDirectory.TestSuiteFault
- if there was a problem determining
the test suite for which this is a work directory.
If this exception is thrown, you can override the test suite
using the other version of open(File,TestSuite)
.
WorkDirectory.InitializationFault
- if there are unrecoverable
problems encountered while reading the data present in the
work directory
WorkDirectory.TemplateMissingFault
public static WorkDirectory open(java.io.File dir, TestSuite testSuite) throws java.io.FileNotFoundException, WorkDirectory.BadDirectoryFault, WorkDirectory.NotWorkDirectoryFault, WorkDirectory.MismatchFault, WorkDirectory.InitializationFault, WorkDirectory.TemplateMissingFault
open(File)
.
dir
- The directory to be opened as a WorkDirectory.testSuite
- The test suite to be associated with this work directory.
java.io.FileNotFoundException
- if the directory identified by dir
does
not exist. If this exception is thrown, you may want to call create(java.io.File, com.sun.javatest.TestSuite)
instead.
WorkDirectory.BadDirectoryFault
- if there was a problem opening
the work directory.
WorkDirectory.NotWorkDirectoryFault
- if the directory identified by
dir
is a valid directory, but has not yet been
initialized as a work directory. f this exception is thrown,
you may want to call create(java.io.File, com.sun.javatest.TestSuite)
instead.
WorkDirectory.MismatchFault
- if the specified test suite does not
match the ID recorded in the work directory.
WorkDirectory.InitializationFault
- if there are unrecoverable
problems encountered while reading the data present in the
work directory
WorkDirectory.TemplateMissingFault
public java.lang.String getPrevWDPath()
public java.io.File getRoot()
public java.lang.String getPath()
public java.io.File getJTData()
public java.io.File getFile(java.lang.String name)
name
- the name of a file within this work directory
public java.io.File getSystemFile(java.lang.String name)
name
- the name of a file within the system (jtData) directory
public TestSuite getTestSuite()
public int getTestSuiteTestCount()
setTestSuiteTestCount(int)
,
TestSuite.getEstimatedTestCount()
public void setTestSuiteTestCount(int num)
num
- the number of tests in the test suitegetTestSuiteTestCount()
,
TestSuite.getEstimatedTestCount()
public TestResultTable getTestResultTable()
setTestResultTable(com.sun.javatest.TestResultTable)
public void setTestResultTable(TestResultTable trt)
trt
- a test result table containing the test descriptions for the tests
in this work directory
java.lang.NullPointerException
- if trt is null.
java.lang.IllegalArgumentException
- if the test result table has been
initialized with a different work directory.getTestResultTable()
public boolean isTRTSet()
public void log(I18NResourceBundle i18n, java.lang.String key)
i18n
- a resource bundle containing the localized messageskey
- a key into the resource bundle for the required messagepublic void log(I18NResourceBundle i18n, java.lang.String key, java.lang.Object arg)
i18n
- a resource bundle containing the localized messageskey
- a key into the resource bundle for the required messagearg
- An argument to be formatted into the specified message.
If this is a Throwable
, its stack trace
will be included in the log.public void log(I18NResourceBundle i18n, java.lang.String key, java.lang.Object[] args)
i18n
- a resource bundle containing the localized messageskey
- a key into the resource bundle for the required messageargs
- An array of arguments to be formatted into the specified message.
If the first arg is a Throwable
, its stack
trace will be included in the log.public void putTestAnnotation(TestResult tr, java.lang.String key, java.lang.String value)
putTestAnnotation(String,String,String).
- See Also:
putTestAnnotation(String,String,String)
public void putTestAnnotation(java.lang.String testName, java.lang.String key, java.lang.String value)
testName
- Test for which the annotation should be added. This is
the value from TestResult.getTestName()
.key
- The name of the value to be entered. The namespace for this
value is unique for each testName
.value
- The value of the annotation. Null removes the value from
the map, an empty string should be used otherwise.public java.util.Map<java.lang.String,java.lang.String> getTestAnnotations(java.lang.String testName)
java.lang.NullPointerException
- if the parameter is null.getTestAnnotations(TestResult)
,
putTestAnnotation(String, String, String)
,
putTestAnnotation(TestResult, String, String)
public java.util.Map<java.lang.String,java.lang.String> getTestAnnotations(TestResult tr)
tr
- The test to get annotations for.
java.lang.NullPointerException
- if the parameter is null.public boolean purge(java.lang.String path) throws WorkDirectory.PurgeFault
path
- Path to a directory in this work directory or a path to
a jtr file. A zero length string removes the root.
WorkDirectory.PurgeFault
- If the file cannot be removed; the message field
may not contain any useful information due to deficiencies in
java.io.File.delete()..
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |