com.sun.javatest
public class Harness extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Harness.Fault
This exception is used to report problems while executing a test run.
|
static interface |
Harness.Observer
This interface provides a means for Harness to report
on events that might be of interest as it executes.
|
Constructor and Description |
---|
Harness()
Instantiate a harness.
|
Harness(java.io.File classDir)
Deprecated.
Use Harness() instead
|
Modifier and Type | Method and Description |
---|---|
void |
addObserver(Harness.Observer o)
Add an observer to be notified during the execution of a test run.
|
boolean |
batch(Parameters params)
Run the tests defined by a new set of parameters.
|
int |
getAutostopThreshold(int n) |
BackupPolicy |
getBackupPolicy()
Get the backup policy object used by this harness, used to determine
the policy for backing up files before overwriting them.
|
static java.io.File |
getClassDir()
Get the class directory or jar file containing JT Harness.
|
long |
getElapsedTime()
Find time since the start of the current or last run.
|
TestEnvironment |
getEnv()
Get the current test environment being used by the harness.
|
long |
getEstimatedTime()
Find out the estimated time required to complete the remaining tests.
|
long |
getFinishTime()
Get the time at which the last run finished.
|
Parameters |
getParameters()
Get the current parameters of the harness.
|
TestResultTable |
getResultTable()
Get the current set of results.
|
long |
getStartTime()
Get the time at which the last run start.
|
int |
getTestsFoundCount()
Find out how many tests to run have been located so far.
|
ReadAheadIterator |
getTestsIterator(TestResultTable.TreeIterator iter) |
boolean |
isAllTestsFound()
Indicates whether the harness has located all the tests it will execute.
|
boolean |
isBatchRun()
Was the harness invoked in batch mode? If it is not in batch mode, this
typically implies that the user is using an interactive GUI interface.
|
boolean |
isRunning()
Check if the harness is currently executing a test suite or not.
|
boolean |
isTracingRequired()
Check if a trace file should be generated while performing a test run.
|
void |
removeObserver(Harness.Observer o)
Remove a previously registered observer so that it will no longer
be notified during the execution of a test run.
|
void |
setAutostopThreshold(int n)
Set the threshold for automatic halting of a test run.
|
void |
setBackupPolicy(BackupPolicy bp)
Set the backup policy object to be used by this harness,
used to determine the policy for backing up files before
overwriting them.
|
static void |
setClassDir(java.io.File classDir)
Specify the class directory or jar file containing JT Harness.
|
void |
setTracingRequired(boolean b)
Set whether a trace file should be generated while performing a test run.
|
void |
start(Parameters p)
Start running all the tests defined by a new set of parameters.
|
void |
stop()
Stop the harness executing any tests.
|
void |
waitUntilDone()
Wait until the harness completes the current task.
|
public Harness(java.io.File classDir)
classDir
- The class dir to put in the environment for otherJVM testsHarness()
,
setClassDir(java.io.File)
public Harness()
public BackupPolicy getBackupPolicy()
setBackupPolicy(com.sun.javatest.util.BackupPolicy)
public void setBackupPolicy(BackupPolicy bp)
bp
- the backup policy object used by this harnessgetBackupPolicy()
public boolean isTracingRequired()
setTracingRequired(boolean)
public void setTracingRequired(boolean b)
b
- whether or not a trace file should be generatedisTracingRequired()
public static java.io.File getClassDir()
setClassDir(java.io.File)
public static void setClassDir(java.io.File classDir)
classDir
- the class directory or jar file containing JT HarnessgetClassDir()
public Parameters getParameters()
public TestEnvironment getEnv()
public TestResultTable getResultTable()
public void addObserver(Harness.Observer o)
o
- the observer to be addedremoveObserver(com.sun.javatest.Harness.Observer)
public void removeObserver(Harness.Observer o)
o
- the observer to be removedaddObserver(com.sun.javatest.Harness.Observer)
public void start(Parameters p) throws Harness.Fault
p
- The parameters to be set when the tests are run.
Any errors in the parameters are reported to
any registered observers.Harness.Fault
- if the harness is currently running tests
and so cannot start running any more tests right now.isRunning()
,
stop()
,
waitUntilDone()
public void waitUntilDone() throws java.lang.InterruptedException
java.lang.InterruptedException
- if the thread making the call is
interrupted.public void stop()
waitUntilDone()
public boolean batch(Parameters params) throws Harness.Fault, java.lang.InterruptedException
params
- The parameters to be used; they will be validated first.Harness.Fault
- if the harness is currently running tests
and cannot start running any more tests right now.java.lang.InterruptedException
- if the thread making the call is
interrupted, perhaps because of an asynchronous call of stop().isRunning()
,
stop()
,
waitUntilDone()
public boolean isRunning()
start(com.sun.javatest.Parameters)
,
batch(com.sun.javatest.Parameters)
,
stop()
,
waitUntilDone()
public boolean isBatchRun() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- If the harness is not running, care should
be taken to handle this in case the run terminates.public boolean isAllTestsFound()
isRunning()
,
getTestsFoundCount()
public long getElapsedTime()
public long getStartTime()
getFinishTime()
public long getFinishTime()
getStartTime()
public long getEstimatedTime()
public int getTestsFoundCount()
isRunning()
public void setAutostopThreshold(int n)
getAutostopThreshold(int)
public int getAutostopThreshold(int n)
setAutostopThreshold(int)
public ReadAheadIterator getTestsIterator(TestResultTable.TreeIterator iter) throws Harness.Fault
Harness.Fault
Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.