|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Dictionary
java.util.Hashtable
java.util.Properties
suramadu.util.exec.TestProperties
The TestProperties class supports the loading and maintenance of a properties file with naming convention of <class name>.properties This object is mutable, so properties that are loaded are subject to change by the user
Field Summary | |
static java.lang.String |
CLASSNAME
|
static java.lang.String |
CPS
|
static int |
DATAFILEHEADERWIDTH
|
static java.lang.String |
FILEOUTPUTERROR
|
static java.lang.String |
HOSTNAME
|
static java.lang.String |
INPUT_PREFIX
|
static java.lang.String |
OSNAME
|
static java.lang.String |
OSVERSION
|
static java.lang.String |
OUTPUT_PREFIX
|
static java.lang.String |
PLATFORM
|
static java.lang.String |
PROPERTIESLOADED
|
static java.lang.String |
RAWDATAFILE
|
static java.lang.String |
TIMESTAMP
|
Constructor Summary | |
TestProperties()
No arg constructor. |
|
TestProperties(java.lang.Class aClass)
Constructor that takes an a Class object. |
|
TestProperties(java.lang.Class aClass,
java.util.Properties defaultProps)
Constructor that takes an a Class object and another TestProperties object to act as a source for default properties should the property not exist in the properties file for this class. |
|
TestProperties(java.lang.Class aClass,
java.lang.String[] defaultProps)
Constructor that takes an a Class object and an array of Strings. |
|
TestProperties(PropertiesFileName aPfn,
java.util.Properties defaultProps)
Constructor that takes an a Class object and another TestProperties object to act as a source for default properties should the property not exist in the properties file for this class. |
Method Summary | |
java.lang.Object |
_get(java.lang.Object key)
Get the value for the specified property. |
java.lang.Object |
_put(java.lang.Object key,
java.lang.Object value)
Overloaded from java.util.Properties. |
static java.util.Properties |
arrayToProperties(java.lang.Class aClass,
java.lang.String[] props)
This is a helper method that translates an array of Strings into a TestProperties object. |
void |
close()
Writes the output file |
static java.util.Iterator |
factory(java.lang.Class pClass,
java.lang.Class aClass)
This static method is used to get an array of properties objects for multiple runs of the same Suramadu test. |
static java.util.Iterator |
factory(java.lang.Class pClass,
java.lang.Class aClass,
java.util.Properties defaultProps)
This static method is used to get an array of properties objects for multiple runs of the same Suramadu test. |
static java.util.Iterator |
factory(java.lang.Class pClass,
java.lang.Class aClass,
java.lang.String[] defaultProps)
This static method is used to get an array of properties objects for multiple runs of the same Suramadu test. |
boolean |
getBooleanInputProperty(java.lang.String key)
|
boolean |
getBooleanOutputProperty(java.lang.String key)
The get*Property() methods are the normal methods used to retrieve a property's value. |
java.lang.String |
getClassName()
Get the full package and class name of the class for which this properties object was created. |
double |
getDoubleInputProperty(java.lang.String key)
The get*Property() methods are the normal methods used to retrieve a property's value. |
double |
getDoubleOutputProperty(java.lang.String key)
The get*Property() methods are the normal methods used to retrieve a property's value. |
float |
getFloatInputProperty(java.lang.String key)
The get*Property() methods are the normal methods used to retrieve a property's value. |
float |
getFloatOutputProperty(java.lang.String key)
The get*Property() methods are the normal methods used to retrieve a property's value. |
java.lang.String |
getInputProperty(java.lang.String key)
The get*Property() methods are the normal methods used to retrieve a property's value. |
int |
getIntInputProperty(java.lang.String key)
The get*Property() methods are the normal methods used to retrieve a property's value. |
int |
getIntOutputProperty(java.lang.String key)
The get*Property() methods are the normal methods used to retrieve a property's value. |
long |
getLongInputProperty(java.lang.String key)
The get*Property() methods are the normal methods used to retrieve a property's value. |
long |
getLongOutputProperty(java.lang.String key)
The get*Property() methods are the normal methods used to retrieve a property's value. |
java.lang.String |
getOutputProperty(java.lang.String key)
The get*Property() methods are the normal methods used to retrieve a property's value. |
java.lang.String |
getPackageName()
Get the name of the package containing for the current properties file. |
java.lang.String |
getPropertiesFilename()
Get the fully qualified path of the properties file acting as the source to this TestProperties instantiation. |
java.lang.String |
getProperty(java.lang.String key)
Get the value for the specified property. |
void |
loadProperties(java.lang.Class aClass,
java.util.Properties defaultProps)
Load class properties |
void |
loadProperties(java.lang.Class aClass,
java.lang.String[] defaultProps)
Load class properties |
void |
loadProperties(PropertiesFileName aPfn,
java.util.Properties defaultProps)
Load class properties |
java.util.Enumeration |
propertyNames()
Recursive procedures |
java.util.Enumeration |
propertyNames(boolean shortNames)
|
void |
putAll(java.util.Map t)
Overloads Hashtable.putAll(). |
void |
read(java.io.InputStream is)
|
java.lang.Object |
setInputProperty(java.lang.String key,
boolean value)
|
java.lang.Object |
setInputProperty(java.lang.String key,
double value)
|
java.lang.Object |
setInputProperty(java.lang.String key,
float value)
|
java.lang.Object |
setInputProperty(java.lang.String key,
int value)
|
java.lang.Object |
setInputProperty(java.lang.String key,
long value)
|
java.lang.Object |
setInputProperty(java.lang.String key,
java.lang.Number value)
setting input properties |
java.lang.Object |
setInputProperty(java.lang.String key,
java.lang.String value)
|
java.lang.Object |
setOutputProperty(java.lang.String key,
boolean value)
|
java.lang.Object |
setOutputProperty(java.lang.String key,
java.util.Collection c)
|
java.lang.Object |
setOutputProperty(java.lang.String key,
java.util.Collection c,
boolean newFile)
|
java.lang.Object |
setOutputProperty(java.lang.String key,
double value)
|
java.lang.Object |
setOutputProperty(java.lang.String key,
double[] values)
|
java.lang.Object |
setOutputProperty(java.lang.String key,
double[] values,
boolean newFile)
|
java.lang.Object |
setOutputProperty(java.lang.String key,
float value)
|
java.lang.Object |
setOutputProperty(java.lang.String key,
float[] values)
|
java.lang.Object |
setOutputProperty(java.lang.String key,
float[] values,
boolean newFile)
|
java.lang.Object |
setOutputProperty(java.lang.String key,
int value)
|
java.lang.Object |
setOutputProperty(java.lang.String key,
int[] values)
|
java.lang.Object |
setOutputProperty(java.lang.String key,
int[] values,
boolean newFile)
|
java.lang.Object |
setOutputProperty(java.lang.String key,
long value)
|
java.lang.Object |
setOutputProperty(java.lang.String key,
long[] values)
|
java.lang.Object |
setOutputProperty(java.lang.String key,
long[] values,
boolean newFile)
|
java.lang.Object |
setOutputProperty(java.lang.String key,
java.lang.Number value)
|
java.lang.Object |
setOutputProperty(java.lang.String key,
java.lang.String value)
setting output properties |
java.lang.Object |
setProperty(java.lang.String key,
java.lang.String value)
Overloaded from java.util.Properties. |
java.lang.String |
toString()
Displays a nicely formatted summary of test and its current working property list. |
Methods inherited from class java.util.Properties |
getProperty, list, list, load, save, store |
Methods inherited from class java.util.Hashtable |
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, remove, size, values |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String INPUT_PREFIX
public static final java.lang.String OUTPUT_PREFIX
public static final java.lang.String TIMESTAMP
public static final java.lang.String PLATFORM
public static final java.lang.String OSNAME
public static final java.lang.String OSVERSION
public static final java.lang.String CLASSNAME
public static final java.lang.String HOSTNAME
public static final java.lang.String CPS
public static final java.lang.String PROPERTIESLOADED
public static final java.lang.String RAWDATAFILE
public static final java.lang.String FILEOUTPUTERROR
public static final int DATAFILEHEADERWIDTH
Constructor Detail |
public TestProperties()
public TestProperties(java.lang.Class aClass) throws PropertyValidationException
aClass
- the name of the class whose properties file is to be loadedpublic TestProperties(java.lang.Class aClass, java.lang.String[] defaultProps) throws PropertyValidationException
aClass
- the name of the class whose properties file is to be loadeddefaultProps
- An array of Strings that will define the contents of the default properties for this instance. It's length must be
even (name value pairs). The even numbered elements (zero based) are names, the odd numbered elements are values.#TestProperties( Class aClass, qqProperties defaultProps )
public TestProperties(java.lang.Class aClass, java.util.Properties defaultProps) throws PropertyValidationException
aClass
- the name of the class whose properties file is to be loadeddefaultProps
- if provided (not null), will provide a set of default values for unspecified propertiespublic TestProperties(PropertiesFileName aPfn, java.util.Properties defaultProps) throws PropertyValidationException
aPfn
- A PropertiesFileName class for the properties file to be read.defaultProps
- if provided (not null), will provide a set of default values for unspecified propertiesMethod Detail |
public static java.util.Iterator factory(java.lang.Class pClass, java.lang.Class aClass) throws PropertyValidationException, java.lang.InstantiationException, java.lang.IllegalAccessException
pClass
- The specific subclass of TestProperties being instantiated.aClass
- The class of the actual test being run.
PropertyValidationException
java.lang.InstantiationException
java.lang.IllegalAccessException
TestProperties(Class)
public static java.util.Iterator factory(java.lang.Class pClass, java.lang.Class aClass, java.lang.String[] defaultProps) throws PropertyValidationException, java.lang.InstantiationException, java.lang.IllegalAccessException
pClass
- The specific subclass of TestProperties being instantiated.aClass
- The class of the actual test being run.defaultProps
-
PropertyValidationException
java.lang.InstantiationException
java.lang.IllegalAccessException
TestProperties(Class, String[])
public static java.util.Iterator factory(java.lang.Class pClass, java.lang.Class aClass, java.util.Properties defaultProps) throws PropertyValidationException, java.lang.InstantiationException, java.lang.IllegalAccessException
pClass
- The specific subclass of TestProperties being instantiated.aClass
- The class of the actual test being run.defaultProps
-
PropertyValidationException
java.lang.InstantiationException
java.lang.IllegalAccessException
TestProperties(Class, Properties)
public void loadProperties(java.lang.Class aClass, java.util.Properties defaultProps) throws PropertyValidationException
aClass
- defaultProps
-
PropertyValidationException
- If a property is malformedpublic void loadProperties(java.lang.Class aClass, java.lang.String[] defaultProps) throws PropertyValidationException
aClass
- defaultProps
-
PropertyValidationException
public void loadProperties(PropertiesFileName aPfn, java.util.Properties defaultProps) throws PropertyValidationException
aPfn
- defaultProps
-
PropertyValidationException
- If a property is malformedpublic java.lang.String getPackageName()
public java.lang.String getPropertiesFilename()
public java.lang.String getClassName()
public java.lang.String getOutputProperty(java.lang.String key) throws PropertyValidationException
key
- the property name
java.lang.NumberFormatException
- If there is a parsing error.
PropertyValidationException
public int getIntOutputProperty(java.lang.String key) throws PropertyValidationException
key
- the property name
java.lang.NumberFormatException
- If there is a parsing error.
PropertyValidationException
public long getLongOutputProperty(java.lang.String key) throws PropertyValidationException
key
- the property name
java.lang.NumberFormatException
- If there is a parsing error.
PropertyValidationException
public float getFloatOutputProperty(java.lang.String key) throws PropertyValidationException
key
- the property name
java.lang.NumberFormatException
- If there is a parsing error.
PropertyValidationException
public double getDoubleOutputProperty(java.lang.String key) throws PropertyValidationException
key
- the property name
java.lang.NumberFormatException
- If there is a parsing error.
PropertyValidationException
public boolean getBooleanOutputProperty(java.lang.String key) throws PropertyValidationException
key
- the property name
java.lang.NumberFormatException
- If there is a parsing error.
PropertyValidationException
public java.lang.String getInputProperty(java.lang.String key) throws PropertyValidationException
key
- the property name
java.lang.NumberFormatException
- If there is a parsing error.
PropertyValidationException
public int getIntInputProperty(java.lang.String key) throws PropertyValidationException
key
- the property name
java.lang.NumberFormatException
- If there is a parsing error.
PropertyValidationException
public long getLongInputProperty(java.lang.String key) throws PropertyValidationException
key
- the property name
java.lang.NumberFormatException
- If there is a parsing error.
PropertyValidationException
public float getFloatInputProperty(java.lang.String key) throws PropertyValidationException
key
- the property name
java.lang.NumberFormatException
- If there is a parsing error.
PropertyValidationException
public double getDoubleInputProperty(java.lang.String key) throws PropertyValidationException
key
- the property name
java.lang.NumberFormatException
- If there is a parsing error.
PropertyValidationException
public boolean getBooleanInputProperty(java.lang.String key) throws PropertyValidationException
key
-
PropertyValidationException
public java.util.Enumeration propertyNames()
public java.util.Enumeration propertyNames(boolean shortNames)
public java.lang.String getProperty(java.lang.String key)
key
- the name of the property
Properties
public java.lang.Object setProperty(java.lang.String key, java.lang.String value)
key
- The property name whose value will be set.value
- The value that will be set for the named property.
Properties
public java.lang.Object setOutputProperty(java.lang.String key, java.lang.String value)
public java.lang.Object setOutputProperty(java.lang.String key, java.lang.Number value)
public java.lang.Object setOutputProperty(java.lang.String key, boolean value)
public java.lang.Object setOutputProperty(java.lang.String key, int value)
public java.lang.Object setOutputProperty(java.lang.String key, long value)
public java.lang.Object setOutputProperty(java.lang.String key, float value)
public java.lang.Object setOutputProperty(java.lang.String key, double value)
public java.lang.Object setOutputProperty(java.lang.String key, java.util.Collection c)
public java.lang.Object setOutputProperty(java.lang.String key, java.util.Collection c, boolean newFile)
public java.lang.Object setOutputProperty(java.lang.String key, int[] values)
public java.lang.Object setOutputProperty(java.lang.String key, int[] values, boolean newFile)
public java.lang.Object setOutputProperty(java.lang.String key, long[] values)
public java.lang.Object setOutputProperty(java.lang.String key, long[] values, boolean newFile)
public java.lang.Object setOutputProperty(java.lang.String key, float[] values)
public java.lang.Object setOutputProperty(java.lang.String key, float[] values, boolean newFile)
public java.lang.Object setOutputProperty(java.lang.String key, double[] values)
public java.lang.Object setOutputProperty(java.lang.String key, double[] values, boolean newFile)
public java.lang.Object setInputProperty(java.lang.String key, java.lang.String value) throws PropertyValidationException
PropertyValidationException
public java.lang.Object setInputProperty(java.lang.String key, java.lang.Number value)
public java.lang.Object setInputProperty(java.lang.String key, boolean value) throws PropertyValidationException
PropertyValidationException
public java.lang.Object setInputProperty(java.lang.String key, int value) throws PropertyValidationException
PropertyValidationException
public java.lang.Object setInputProperty(java.lang.String key, long value) throws PropertyValidationException
PropertyValidationException
public java.lang.Object setInputProperty(java.lang.String key, float value) throws PropertyValidationException
PropertyValidationException
public java.lang.Object setInputProperty(java.lang.String key, double value) throws PropertyValidationException
PropertyValidationException
public java.lang.Object _get(java.lang.Object key)
key
- the name of the property
Properties
public java.lang.Object _put(java.lang.Object key, java.lang.Object value)
key
- The property name whose value will be set.value
- The value that will be set for the named property.
Properties
public void putAll(java.util.Map t)
t
- Mappings to be stored in this map.
java.lang.NullPointerException
- if the specified map is null.Hashtable
public void close() throws java.io.IOException
java.io.IOException
public void read(java.io.InputStream is) throws java.io.IOException
java.io.IOException
public java.lang.String toString()
public static java.util.Properties arrayToProperties(java.lang.Class aClass, java.lang.String[] props) throws PropertyValidationException
aClass
- the name of the class whose properties file is to be loadedprops
- An array of Strings that will define the contents of the default properties for this instance. It's length must be
even (name value pairs). The even numbered elements (zero based) are names, the odd numbered elements are values.
PropertyValidationException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |