public class TestResultTable
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
TestResultTable.Fault
Exception class to communicate any special conditions which may occur
while using this class.
|
static interface |
TestResultTable.Observer
Observer to monitor changes to a TestResultTable.
|
class |
TestResultTable.PathRecord
Keeps track of the path to a specific node in the TestResultTable tree.
|
static interface |
TestResultTable.TreeEventObserver
Extension to TreeObserver to receive notifications related
to events happened on tree nodes.
|
static interface |
TestResultTable.TreeIterator
Defines an iterator/enumerator interface for retrieving tests out of the
tree.
|
static interface |
TestResultTable.TreeNode
Interface to a node which contitutes the skeleton of the test result tree.
|
static interface |
TestResultTable.TreeNodeObserver
Observer interface to watch a single tree node.
|
static interface |
TestResultTable.TreeObserver
Tree-aware observer of the TRT.
|
Constructor and Description |
---|
TestResultTable()
Deprecated.
This method will become private.
XXX make this method private
|
TestResultTable(WorkDirectory wd)
Create a table for the tests in a work directory and its
associated test suite and test finder.
|
TestResultTable(WorkDirectory wd,
TestFinder tf)
Create a table for the tests in a work directory and its
associated test suite, overriding the test suite's default test finder.
|
Modifier and Type | Method and Description |
---|---|
void |
addObserver(TestResultTable.Observer o)
Add a general purpose observer.
|
void |
addObserver(TestResultTable.TreeObserver obs)
Add a tree-aware observer.
|
void |
dispose() |
static java.lang.String[] |
distillUrls(java.lang.String[] urls)
Removes from sorted array all overlapping entries.
|
java.util.Enumeration |
elements()
List all the tests in the tree.
|
java.util.Enumeration |
elements(java.io.File[] tests,
TestFilter[] filters)
Same as getIterator() with the same args.
|
java.util.Enumeration |
elements(java.lang.String[] urls,
TestFilter[] filters)
This method is the same as getIterator() with the same params.
|
java.util.Enumeration |
elements(java.lang.String url,
TestFilter[] filters)
Get an enumerator capable of producing a filtered view of the test
suite.
|
java.util.Enumeration |
elements(TestFilter[] filters)
Same description as getIterator() method with same args.
|
static java.util.Enumeration |
elements(TestResultTable.TreeNode node)
List all the tests under this node.
|
static java.util.Enumeration |
elements(TestResultTable.TreeNode node,
TestFilter filter)
Same description as getIterator() method with same args.
|
static java.util.Enumeration |
elements(TestResultTable.TreeNode node,
TestFilter[] filters)
Same description as getIterator() method with same args.
|
protected void |
finalize() |
static TestResultTable.TreeNode |
findNode(TestResultTable.TreeNode node,
java.lang.String path)
Used to find a branch node somewhere in the tree based on a path.
|
TestResult |
getCachedResult(TestDescription td)
This method returns TestResult from map of test results, collected by
TestResultCache worker.
|
int |
getCurrentTestCount()
How many tests have been found so far.
|
TestResultTable.TreeIterator |
getIterator()
List all the tests in the tree.
|
TestResultTable.TreeIterator |
getIterator(java.io.File[] tests,
TestFilter[] filters)
Get an iterator capable of producing a filtered view of the test suite.
|
TestResultTable.TreeIterator |
getIterator(java.lang.String[] paths,
TestFilter[] filters)
Get an iterator capable of producing a filtered view of the test suite.
|
TestResultTable.TreeIterator |
getIterator(TestFilter[] filters)
List all the tests in the tree subject to the given filters.
|
static TestResultTable.TreeIterator |
getIterator(TestResultTable.TreeNode node)
List all the tests under this node.
|
static TestResultTable.TreeIterator |
getIterator(TestResultTable.TreeNode node,
TestFilter filter)
Get an iterator capable of producing a filtered view of the test suite.
|
static TestResultTable.TreeIterator |
getIterator(TestResultTable.TreeNode node,
TestFilter[] filters)
Get an iterator capable of producing a filtered view of the test suite.
|
java.util.concurrent.locks.ReentrantLock |
getLock() |
static TestResultTable.TreeNode[] |
getObjectPath(TestResult target)
Find the specified test, recording the path from the root.
|
static TestResultTable.TreeNode[] |
getObjectPath(TestResultTable.TreeNode target)
Find the specified test, recording the path from the root.
|
TestResultTable.TreeNode |
getRoot()
Get the root TreeNode of this result table.
|
static java.lang.String |
getRootRelativePath(TestResultTable.TreeNode node)
Get the path to this node, relative to the root of the testsuite.
|
TestFinder |
getTestFinder()
Get the finder that TRT is using to read the test suite.
|
java.io.File |
getTestSuiteRoot()
Get the root URL of the test suite.
|
WorkDirectory |
getWorkDir()
Deprecated.
Use getWorkDirectory
|
WorkDirectory |
getWorkDirectory()
Get the work directory associated with this object.
|
boolean |
isReady()
Determine the update status of the table.
|
TestResult |
lookup(java.lang.String jtrPath)
Find a specific instance of a test result.
|
TestResult |
lookup(TestDescription td)
Find a specific instance of a test result.
|
boolean |
prune() |
boolean |
prune(TestResultTable.TreeNode node) |
boolean |
refreshIfNeeded(java.lang.String test)
Refresh a test if the files on disk have been modified since the test was read.
|
boolean |
refreshIfNeeded(TestResultTable.TreeNode node)
Refresh a folder if the files on disk have been modified since the
folder was read.
|
void |
removeObserver(TestResultTable.Observer o)
Remove a general purpose observer.
|
void |
removeObserver(TestResultTable.TreeObserver obs)
Remove a tree-aware observer.
|
TestResult |
resetTest(java.lang.String testName)
This method purges the given test, including attempting to delete the
associated JTR file, then replaces it with a basic
NOT_RUN
test of the same name. |
TestResult |
resetTest(TestResult tr)
This method purges the given test, including attempting to delete the
associated JTR file, then replaces it with a basic
NOT_RUN
test of the same name. |
java.lang.Object |
resolveUrl(java.lang.String url)
Take a URL and find the node in the current test tree to which it refers
to.
|
void |
setTestFinder(TestFinder tf)
Set the test finder for this object.
|
void |
setWorkDirectory(WorkDirectory wd)
Set the work directory associated with this object.
|
int |
size()
Find out the size of the entire tree.
|
void |
update(TestResult tr)
Update the information in the table with a new test result.
|
void |
update(TestResult tr,
boolean suppressScan)
Update the information in the table with a new test result.
|
boolean |
validatePath(java.lang.String path)
Validate that a path is valid in this TestResultTable according to the
rules for initial URLs.
|
boolean |
waitUntilReady()
This method blocks until the work directory data has been completely
synchronized.
|
public TestResultTable()
public TestResultTable(WorkDirectory wd)
wd
- The work directory to associate with this table.public TestResultTable(WorkDirectory wd, TestFinder tf)
wd
- The work directory to associate with this table.tf
- The finder to use. Do not use this constructor unless
necessary.TestResultTable(WorkDirectory)
public void dispose()
public void setTestFinder(TestFinder tf)
tf
- The finder to use.java.lang.IllegalStateException
- Thrown if the finder for this object is already set.getTestFinder()
public WorkDirectory getWorkDir()
public WorkDirectory getWorkDirectory()
setWorkDirectory(com.sun.javatest.WorkDirectory)
public void setWorkDirectory(WorkDirectory wd)
wd
- The work directory, or null if none set.getWorkDirectory()
public int getCurrentTestCount()
public void update(TestResult tr)
tr
- The test to insert or update.JavaTestError
- Throws if the result cache throws an error.public void update(TestResult tr, boolean suppressScan)
tr
- The test to insert or update.suppressScan
- Request that test finder activity be suppressed if possibleJavaTestError
- Throws if the result cache throws an error.public boolean waitUntilReady()
public boolean isReady()
waitUntilReady()
public TestResult lookup(TestDescription td)
td
- The test description which corresponds to the target result.public TestResult lookup(java.lang.String jtrPath)
jtrPath
- The work relative path of the test result file.
Output from TestResult.getWorkRelativePath() is
the best source of this info.public java.lang.Object resolveUrl(java.lang.String url)
TreeNode
TestResult
url
- A forward-slash separated path referring to node names along a
path originating at the root node.public boolean validatePath(java.lang.String path)
path
- The path to validate. Should be internal URL format (forward
slashes, relative to test root, ...) Null is acceptable but will
immediately result in null being returned.public static TestResultTable.TreeNode[] getObjectPath(TestResult target)
target
- The test to generate the path for.public static TestResultTable.TreeNode[] getObjectPath(TestResultTable.TreeNode target)
target
- The node to generate the path for.public TestResultTable.TreeIterator getIterator()
public java.util.Enumeration elements()
getIterator()
public TestResultTable.TreeIterator getIterator(TestFilter[] filters)
filters
- The Filters to run tests through before "selecting"
them for iteration. May be null.public java.util.Enumeration elements(TestFilter[] filters)
filters
- The Filters to run tests through before "selecting"
them for iteration. May be null.getIterator()
public static TestResultTable.TreeIterator getIterator(TestResultTable.TreeNode node)
node
- The tree node to being the iteration at.public static java.util.Enumeration elements(TestResultTable.TreeNode node)
node
- The tree node to being the iteration at.getIterator()
public static TestResultTable.TreeIterator getIterator(TestResultTable.TreeNode node, TestFilter filter)
node
- The tree node to being the iteration at. May be null.filter
- The filter to run tests through before "selecting"
them for iteration.public static java.util.Enumeration elements(TestResultTable.TreeNode node, TestFilter filter)
node
- The tree node to being the enumeration at. May be null.filter
- The filter to run tests through before "selecting"
them for enumeration. May be null.getIterator()
public static TestResultTable.TreeIterator getIterator(TestResultTable.TreeNode node, TestFilter[] filters)
node
- The tree node to begin enumerating at. May be null.filters
- The test filters to apply to any tests found.public static java.util.Enumeration elements(TestResultTable.TreeNode node, TestFilter[] filters)
node
- The tree node to begin enumerating at. May be null.filters
- The test filters to apply to any tests found.getIterator()
public java.util.Enumeration elements(java.lang.String url, TestFilter[] filters)
url
- The test URL to scan. This value should have already be
normalized to a '/' file separator. May be null.filters
- The test filters to apply to any tests found. May be null.getIterator()
public TestResultTable.TreeIterator getIterator(java.io.File[] tests, TestFilter[] filters) throws TestResultTable.Fault
tests
- The set of files base the iterator on. May be null.
If this set is not empty, the contents should have already been
validated using the validatePath() method.filters
- The test filters to apply to any tests found. May be null.TestResultTable.Fault
- Thrown if the given initialUrls are invalid.validatePath(java.lang.String)
public java.util.Enumeration elements(java.io.File[] tests, TestFilter[] filters) throws TestResultTable.Fault
tests
- The set of files base the enumerator on. May be null.filters
- The test filters to apply to any tests found. May be null.TestResultTable.Fault
- Thrown if the given initialUrls are invalid.getIterator()
public TestResultTable.TreeIterator getIterator(java.lang.String[] paths, TestFilter[] filters)
paths
- The test URLs to scan. Values should have already be normalized to a
'/' file separator. May not be null.filters
- The test filters to apply to any tests found. May be null.public java.util.Enumeration elements(java.lang.String[] urls, TestFilter[] filters)
urls
- The test URLs to scan. Values should have already be normalized to a
'/' file separator.filters
- The test filters to apply to any tests found.getIterator()
public int size()
public TestResultTable.TreeNode getRoot()
public java.io.File getTestSuiteRoot()
public TestFinder getTestFinder()
setTestFinder(com.sun.javatest.TestFinder)
public static java.lang.String getRootRelativePath(TestResultTable.TreeNode node)
node
- The node to find the path to.public static TestResultTable.TreeNode findNode(TestResultTable.TreeNode node, java.lang.String path)
node
- Where to start the searchpath
- The work relative position of the JTR (TestResult.getWorkRelativePath())java.lang.IllegalArgumentException
- If the starting node or path is null.public void addObserver(TestResultTable.Observer o)
o
- The observer to attach. Must never be null.public void removeObserver(TestResultTable.Observer o)
o
- The observer to remove.public void addObserver(TestResultTable.TreeObserver obs)
obs
- The observer to attach. Must never be null.public void removeObserver(TestResultTable.TreeObserver obs)
obs
- The observer to remove.public TestResult resetTest(TestResult tr)
NOT_RUN
test of the same name. This operation has no effect if the given test
is not in the tree.
Matching objects for removal is done only by reference. The operation
may fail (return null
) if the test exists, but is not the
same object. If you really want to remove a test by name, you can use
resetTest(String)
.
NOTE: This method will cause waitUntilReady() to block.
tr
- The test to find, purge and replace.NOT_RUN
test. Null if the operation fails
because the test could not be found.resetTest(String)
public TestResult resetTest(java.lang.String testName)
NOT_RUN
test of the same name. This operation has no effect if the given test
is not in the tree. The resetTest(TestResult)
method is
more efficient than this one, use it if you already have the object.
NOTE: This method may cause waitUntilReady() to block.
testName
- The test to find, purge and replace. This is of the form
given by TestResult.getTestName().NOT_RUN
test. Null if the given test name
could not be found.TestResult.getTestName()
public boolean refreshIfNeeded(java.lang.String test) throws TestResultTable.Fault
test
- The path for the test to be refreshedTestResultTable.Fault
- if the test indicated cannot be located for
refreshing.public boolean refreshIfNeeded(TestResultTable.TreeNode node) throws TestResultTable.Fault
node
- the node representing the folder to be refreshedTestResultTable.Fault
- if the node indicated cannot be located for
refreshing.public boolean prune() throws TestResultTable.Fault
TestResultTable.Fault
public boolean prune(TestResultTable.TreeNode node) throws TestResultTable.Fault
TestResultTable.Fault
public static java.lang.String[] distillUrls(java.lang.String[] urls)
urls
- A sorted list of test urlsprotected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public TestResult getCachedResult(TestDescription td)
public java.util.concurrent.locks.ReentrantLock getLock()
Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.