public abstract class AbstractDataRushTestCase extends Object
Modifier and Type | Field and Description |
---|---|
protected static TimeZone |
AUSTIN_TIMEZONE
A
TimeZone object indicating the time zone for Austin, Texas, USA. |
Constructor and Description |
---|
AbstractDataRushTestCase() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
cleanScratchDirectory()
Deletes the scratch directory for the test.
|
protected File |
createScratchDirectory()
Creates the scratch directory for the test.
|
protected File |
createScratchDirectory(String fileName)
Creates a scratch directory with the given name
beneath the test's scratch directory.
|
protected String[] |
getArgs(String propertiesPath,
String... resourceAndScratchPropertyKeys)
Generates an array of arguments to be fed to a DataRush application's main method.
|
protected org.apache.commons.logging.Log |
getLogger()
Gets the logger for this test.
|
protected String |
getResourcePath()
Gets the path to the directory containing resources for this test.
|
protected static String |
getResourcePath(Class<?> testClass)
Gets the path to the resource directory of the given class.
|
protected static String |
getResourcePath(Class<?> testClass,
String resourceName)
Gets the file path to a specified resource for the given class.
|
protected String |
getResourcePath(String resourceName)
Gets the file path to a specified resource.
|
protected String |
getScratchPath()
Gets the path to the scratch directory for this test.
|
protected String |
getScratchPath(String fileName)
Gets the file path to a specified scratch file.
|
protected String[] |
getScriptArgs(String scriptFile)
Create arguments for drunner allowing a script to be run that has embedded
$0
and $1 references. |
protected long |
getSeed()
Generates a seed for the current test.
|
protected long |
getSeed(String testName)
Generates a seed for the current test and outputs that seed to the logger provided by
AbstractDataRushTestCase#getLogger() . |
protected org.apache.commons.logging.Log getLogger()
protected long getSeed()
This method is equivalent to getSeed(null)
.
protected long getSeed(String testName)
AbstractDataRushTestCase#getLogger()
. If testName
is null, no log message will be output.testName
- the test name to include in the log messageprotected static String getResourcePath(Class<?> testClass)
testClass
- test class to use as basis for the resource pathprotected String getResourcePath(String resourceName)
resourceName
of null will return the path to the
directory containing the resources for this test.resourceName
- the resource for which to retrieve the pathprotected static String getResourcePath(Class<?> testClass, String resourceName)
resourceName
of null will
return the path to the directory containing the resources for the given class.resourceName
- the resource for which to retrieve the pathprotected String getResourcePath()
This method is equivalent to getResourcePath(null)
.
protected String getScratchPath(String fileName)
fileName
of null will return the path to the
scratch directory for this test.fileName
- the scratch file for which to get the pathprotected String getScratchPath()
This method is equivalent to getScratchPath(null)
.
protected File createScratchDirectory(String fileName)
fileName
- the directory to createprotected File createScratchDirectory()
protected boolean cleanScratchDirectory()
protected String[] getArgs(String propertiesPath, String... resourceAndScratchPropertyKeys)
{0}
denotes the resource file directory and {1}
denotes the scratch file directory).
The specified .properties file and keys are used to create a new .properties file in the scratch directory,
similar to the original, but having the values of the specified keys formatted to contain the actual resource and
scratch file paths. The function returns an array of application arguments pointing to this new file.
As an example, an input file containing:
inputPath={0}/in.txt filterThreshold=23 outputPath={1}/results.txtwould result in new file containing:
inputPath=/myproject/src/test/resources/com/foo/bar/in.txt filterThreshold=23 outputPath=/myproject/target/scratch/com/foo/bar/results.txtif both "inputPath" and "outputPath" were provided as
resourceAndScratchPropertyKeys
.propertiesPath
- the path to the .properties
. This path should be relative to the path provided by
getResourcePath()
.resourceAndScratchPropertyKeys
- the array of keys mapping to file path format stringsprotected String[] getScriptArgs(String scriptFile)
$0
and $1
references. The $0
variable is resolved to the resource path
and the $1
variable is resolved to the scratch path.
The script file will be resolved to the resource path, so no need to call getResourcePath()
before invoking this method.
scriptFile
- name of the script fileCopyright © 2016 Actian Corporation. All rights reserved.