|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.javatest.TestEnvironment
public class TestEnvironment
This class provides "environments", as embodied by groups of related properties.
Environments have a name, and consist of those properties provided whose names
do not begin with "env.", and in addition, those
properties provided whose names begin "env.env-name.".
In addition, an environment may inherit the properties of another environment
by defining a property env.env-nameinherits=inherited-env-name
The values of the environment's properties are split into words and various
substitutions are performed.
The preferred way to make an environment is via a configuration interview,
avoiding the use of the env.env-name prefix, which is
retained for backwards compatibility with older test suites that read environments
from environment (.jte) files.
| Nested Class Summary | |
|---|---|
class |
TestEnvironment.Element
A class representing an entry in a test environment. |
static class |
TestEnvironment.Fault
This exception is used to report resolving values in an environment. |
| Constructor Summary | |
|---|---|
|
TestEnvironment(java.lang.String name,
java.util.Map[] propTables,
java.lang.String[] propTableNames)
Construct an environment for a named group of properties. |
|
TestEnvironment(java.lang.String name,
java.util.Map propTable,
java.lang.String propTableName)
Construct an environment for a named group of properties. |
protected |
TestEnvironment(TestEnvironment o)
|
| Method Summary | |
|---|---|
static void |
addDefaultPropTable(java.lang.String name,
java.util.Map propTable)
Add a default set of properties to be included when environments are created. |
static void |
clearDefaultPropTables()
Remove all previously registered default property tables. |
TestEnvironment |
copy()
Create a copy of the current environment. |
java.util.Collection |
elements()
Enumerate the elements for this environment, including any inherited elements. |
java.util.Collection |
elementsUsed()
Get a collection containing those entries in this environment that have been referenced, either directly via lookup, or indirectly via the $ syntax in other entries. |
java.lang.String |
getDescription()
Get the description of this environment, as given by the "description" entry. |
java.util.HashMap |
getExtraValues()
|
java.lang.String[] |
getInherits()
Get the list of names of inherited environments, including this environment, in reverse order or inheritance (ie this one, parent, grandparent etc). |
java.lang.String |
getName()
Get the distinguishing name for the properties of this environment. |
boolean |
hasUndefinedValues()
Check if the environment has any undefined values. |
java.util.Set |
keys()
Enumerate the keys for this environment, including any inherited keys. |
java.lang.String[] |
lookup(java.lang.String key)
Lookup a named property in the environment. |
void |
put(java.lang.String name,
java.lang.String value)
A backdoor method to add global properties to the environment. |
void |
put(java.lang.String name,
java.lang.String[] value)
A backdoor method to add global properties to the environment. |
void |
putUrlAndFile(java.lang.String name,
java.io.File f)
A backdoor method to add global properties to the environment that have a value that might be desired as both a file and a URL. |
void |
resetElementsUsed()
Reset the record of entries in this environment that have been referenced. |
java.lang.String[] |
resolve(java.lang.String s)
Resolve a value in the environment by splitting it into words and performing various substitutions on it. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TestEnvironment(java.lang.String name,
java.util.Map propTable,
java.lang.String propTableName)
throws TestEnvironment.Fault
name - The name by which to identify the group of properties
for this environmentpropTable - Dictionaries containing (but not limited to) the
properties for this environment.propTableName - The name of the property table, for use in diagnostics etc
TestEnvironment.Fault - if there is an error in the table
public TestEnvironment(java.lang.String name,
java.util.Map[] propTables,
java.lang.String[] propTableNames)
throws TestEnvironment.Fault
name - The name by which to identify the group of properties
for this environmentpropTables - Dictionaries containing (but not limited to) the
properties for this environment. They should be ordered
so that values specified in later tables override those
specified in subsequent tables.propTableNames - The names of the property tables, for use in diagnostics etc
TestEnvironment.Fault - if there is an error in the given tablesprotected TestEnvironment(TestEnvironment o)
| Method Detail |
|---|
public static void addDefaultPropTable(java.lang.String name,
java.util.Map propTable)
name - a name for this collection or properties, so that the
source of the properties can be identified when browing an environmentpropTable - a table of properties to be included when environments
are created
java.lang.NullPointerException - if either name or propTable is null.clearDefaultPropTables()public static void clearDefaultPropTables()
addDefaultPropTable(java.lang.String, java.util.Map)public TestEnvironment copy()
public java.lang.String getName()
public java.lang.String getDescription()
public java.lang.String[] getInherits()
public void put(java.lang.String name,
java.lang.String value)
name - The name of the property to be writtenvalue - The value of the property to be written
public void put(java.lang.String name,
java.lang.String[] value)
name - The name of the property to be writtenvalue - The value of the property to be written
public void putUrlAndFile(java.lang.String name,
java.io.File f)
name - The name of the property to be writtenf - The file indicating the value to be stored.public java.util.HashMap getExtraValues()
public java.lang.String[] lookup(java.lang.String key)
throws TestEnvironment.Fault
key - The name of the property to look up
TestEnvironment.Fault - is thrown if there is a problem resolving the value
of the propertyresolve(java.lang.String)
public java.lang.String[] resolve(java.lang.String s)
throws TestEnvironment.Fault
$name' and `${name}' are
replaced by the result of calling `lookup(name)'.
`$/' is replaced by the platform-specific file separator;
`$:' is replaced by the platform-specific path separator; and
`$$' is replaced by a single `$'.
No substitutions are performed inside single-quoted strings; $ substitutions
are performed in double-quoted strings.
s - The string to be resolved
TestEnvironment.Fault - This is thrown if there is a problem resolving the value
of the argument.public boolean hasUndefinedValues()
public java.util.Set keys()
public java.util.Collection elementsUsed()
resetElementsUsed()public void resetElementsUsed()
elementsUsed()public java.util.Collection elements()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||