public class TestUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static boolean |
mCollectExceptions |
static java.lang.String |
mGoldFileBaseDir |
Constructor and Description |
---|
TestUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
checkResults(java.lang.Class testClass,
oracle.odi.domain.root.NamedObject namedObj)
Compare the results of a debug dump of the specified mapping object to
to previously stored results in a gold results file.
|
static java.io.File |
checkResults(java.lang.Class testClass,
oracle.odi.domain.root.NamedObject namedObj,
java.lang.String suffix)
Compare the results of a debug dump of the specified mapping object to
to previously stored results in a gold results file.
|
static void |
checkResults(java.lang.Class testClass,
java.lang.String objectName,
java.lang.String resultsFilePath,
java.lang.String suffix,
boolean ignoreWhitespace)
Compare the results text in the specified results file path to previously stored
results in a gold results file.
|
static void |
checkResults(java.lang.Class testClass,
java.lang.String objectName,
java.lang.String resultsFilePath,
java.lang.String suffix,
boolean ignoreWhitespace,
java.util.Map goldFileSubstitutionMap)
Compare the results text in the specified results file path to previously stored
results in a gold results file.
|
static void |
checkResults(java.lang.Class testClass,
java.lang.String objectName,
java.lang.String resultsFilePath,
java.lang.String suffix,
boolean ignoreWhitespace,
java.util.Map goldFileSubstitutionMap,
boolean checkForIntersection)
Compare the results text in the specified results file path to previously stored
results in a gold results file.
|
static java.io.File |
checkResults(oracle.odi.domain.root.NamedObject namedObj)
Compare the results of a debug dump of the specified mapping object to
to previously stored results in a gold results file.
|
static void |
checkResults(oracle.odi.domain.root.NamedObject namedObj,
java.io.File goldFile)
Compare the results of a debug dump of the specified mapping object to
to previously stored results in a gold results file.
|
static void |
checkResults(oracle.odi.domain.root.NamedObject namedObj,
java.lang.String suffix)
Compare the results of a debug dump of the specified mapping object to
to previously stored results in a gold results file.
|
static void |
checkResults(java.lang.String objectName,
java.lang.String resultsFilePath,
java.lang.String goldFilePath,
boolean ignoreWhitespace)
Compare the results text in the specified results file path to previously stored
results in a gold results file.
|
static void |
checkResults(java.lang.String objectName,
java.lang.String resultsFilePath,
java.lang.String goldFilePath,
boolean ignoreWhitespace,
java.util.Map goldFileSubstitutionMap)
Compare the results text in the specified results file path to previously stored
results in a gold results file.
|
static void |
checkResults(java.lang.String objectName,
java.lang.String resultsFilePath,
java.lang.String goldFilePath,
boolean ignoreWhitespace,
java.util.Map goldFileSubstitutionMap,
boolean checkForIntersection)
Compare the results text in the specified results file path to previously stored
results in a gold results file.
|
static void |
checkResultsConent(java.lang.Class testClass,
java.lang.String objectName,
java.lang.String[] resultFilePaths,
java.lang.String suffix,
boolean ignoreWhitespace)
Compare the content in the specified results file path to previously stored
content in a gold results file.
|
static void |
checkResultsContent(java.lang.String objectName,
java.lang.String resultsFilePath,
java.lang.String goldFilePath,
boolean ignoreWhitespace)
Compare the results text in the specified results file path to previously stored
results in a gold results file.
|
static void |
checkResultsText(java.lang.Class testClass,
java.lang.String objectName,
java.lang.String resultsText,
java.lang.String suffix,
boolean ignoreWhitespace)
Compare the specified results text to previously stored
results in a gold results file.
|
static void |
checkResultsText(java.lang.Class testClass,
java.lang.String objectName,
java.lang.String resultsText,
java.lang.String suffix,
boolean ignoreWhitespace,
java.util.Map goldFileSubstitutionMap)
Compare the specified results text to previously stored
results in a gold results file.
|
static void |
checkResultsText(java.lang.Class testClass,
java.lang.String objectName,
java.lang.String resultsText,
java.lang.String suffix,
boolean ignoreWhitespace,
java.util.Map goldFileSubstitutionMap,
boolean checkForIntersection)
Compare the specified results text to previously stored
results in a gold results file.
|
static void |
checkResultsText(java.lang.String objectName,
java.lang.String resultsText) |
static void |
checkResultsText(java.lang.String objectName,
java.lang.String resultsText,
boolean ignoreWhitespace)
Compare the specified results text to previously stored
results in a gold results file.
|
static void |
checkResultsText(java.lang.String objectName,
java.lang.String resultsText,
java.lang.String suffix) |
static void |
checkResultsText(java.lang.String objectName,
java.lang.String resultsText,
java.lang.String suffix,
boolean ignoreWhitespace)
Compare the specified results text to previously stored
results in a gold results file.
|
static void |
checkResultsText(java.lang.String objectName,
java.lang.String resultsText,
java.lang.String suffix,
boolean ignoreWhitespace,
java.util.Map goldFileSubstitutionMap)
Compare the specified results text to previously stored
results in a gold results file.
|
static void |
clearFixGoldFileScript() |
static boolean |
compareFiles(java.lang.String path1,
java.lang.String path2,
boolean ignoreWhitespace)
Return compare the content for 2 files
|
static java.lang.String |
diffFiles(java.lang.String path1,
java.lang.String path2,
boolean ignoreWhitespace,
java.util.Map file1SubstitutionMap,
java.lang.String[] correctedFile1Text)
Return a diff string for 2 files, null if the files are identical
|
static java.lang.String |
diffFiles(java.lang.String path1,
java.lang.String path2,
boolean ignoreWhitespace,
java.util.Map file1SubstitutionMap,
java.lang.String[] correctedFile1Text,
java.lang.Boolean checkForIntersection)
Return a diff string for 2 files, null if the files are identical
|
static void |
diffWhitespace(java.lang.String s1,
java.lang.String s2)
Throw an assert failure if the specified strings are not equal.
|
static boolean |
diffWhitespace(java.lang.String s1,
java.lang.String s2,
boolean throwAssertFailure) |
static java.io.File |
dumpObjectToResultsFile(oracle.odi.domain.root.NamedObject namedObj,
java.lang.String suffix)
Dump the metadata for the specified named object to a results file,
and return a file object which represents the results file.
|
static java.io.File |
dumpStringToResultsFile(java.lang.String objectName,
java.lang.String suffix,
java.lang.String resultsStr) |
static boolean |
equalsIgnoreWhitespace(java.lang.String s1,
java.lang.String s2)
Return true if the specified strings are equal.
|
static java.lang.String |
getGoldFilePath(java.lang.Class testClass,
java.lang.String resultName) |
static java.lang.String |
getTestObjectName(oracle.odi.domain.root.NamedObject namedObj) |
static java.lang.String |
readFullFile(java.lang.String pathName) |
static void |
resetGoldFileBaseDir() |
static void |
setGoldFileBaseDir(java.lang.String path) |
static void |
testEnd() |
static void |
throwCollectedExceptions() |
static java.lang.String |
trimWhitespace(java.lang.String str) |
public static java.lang.String mGoldFileBaseDir
public static boolean mCollectExceptions
public static java.io.File checkResults(oracle.odi.domain.root.NamedObject namedObj) throws java.lang.Exception
namedObj
- The object to be dumped and the dump compared to a gold file.java.lang.Exception
public static void checkResults(oracle.odi.domain.root.NamedObject namedObj, java.io.File goldFile) throws java.lang.Exception
namedObj
- The object to be dumped and the dump compared to a gold file.goldFile
- A file object representing the gold file results that will
be compared to the actual results.java.lang.Exception
public static void checkResults(oracle.odi.domain.root.NamedObject namedObj, java.lang.String suffix) throws java.lang.Exception
namedObj
- The object to be dumped and the dump compared to a gold file.suffix
- A uniqueness suffix in case the same object is checked multiple times, with different configuration.java.lang.Exception
public static void checkResults(java.lang.Class testClass, oracle.odi.domain.root.NamedObject namedObj) throws java.lang.Exception
testClass
- The test case class where the results were generated. Used to find the gold file pathnamedObj
- The object to be dumped and the dump compared to a gold file.java.lang.Exception
public static java.io.File checkResults(java.lang.Class testClass, oracle.odi.domain.root.NamedObject namedObj, java.lang.String suffix) throws java.lang.Exception
testClass
- The test case class where the results were generated. Used to find the gold file pathnamedObj
- The object to be dumped and the dump compared to a gold file.suffix
- A uniqueness suffix in case the same object is checked multiple times, with different configuration.java.lang.Exception
public static java.io.File dumpObjectToResultsFile(oracle.odi.domain.root.NamedObject namedObj, java.lang.String suffix) throws java.io.FileNotFoundException
namedObj
- The object to dump.suffix
- A suffix for the results file name, or null if none.java.io.FileNotFoundException
public static java.io.File dumpStringToResultsFile(java.lang.String objectName, java.lang.String suffix, java.lang.String resultsStr)
public static void checkResultsText(java.lang.Class testClass, java.lang.String objectName, java.lang.String resultsText, java.lang.String suffix, boolean ignoreWhitespace) throws java.lang.Exception
testClass
- The test case class where the results were generated. Used to find the gold file pathobjectName
- The name of the object that is being checked.resultsText
- The results text to be compared. This text will be stored in a temporary file.suffix
- A uniqueness suffix in case the same object is checked multiple times, with different configuration.ignoreWhitespace
- If true, ignore white space when comparing results.java.lang.Exception
public static void checkResultsText(java.lang.Class testClass, java.lang.String objectName, java.lang.String resultsText, java.lang.String suffix, boolean ignoreWhitespace, java.util.Map goldFileSubstitutionMap) throws java.lang.Exception
testClass
- The test case class where the results were generated. Used to find the gold file pathobjectName
- The name of the object that is being checked.resultsText
- The results text to be compared. This text will be stored in a temporary file.suffix
- A uniqueness suffix in case the same object is checked multiple times, with different configuration.ignoreWhitespace
- If true, ignore white space when comparing results.goldFileSubstitutionMap
- A hash map whose keys are text snippets that will be
replaced by the corresponding value in the gold file, during results checking. If null,
it is not used.java.lang.Exception
public static void checkResultsText(java.lang.Class testClass, java.lang.String objectName, java.lang.String resultsText, java.lang.String suffix, boolean ignoreWhitespace, java.util.Map goldFileSubstitutionMap, boolean checkForIntersection) throws java.lang.Exception
testClass
- The test case class where the results were generated. Used to find the gold file pathobjectName
- The name of the object that is being checked.resultsText
- The results text to be compared. This text will be stored in a temporary file.suffix
- A uniqueness suffix in case the same object is checked multiple times, with different configuration.ignoreWhitespace
- If true, ignore white space when comparing results.goldFileSubstitutionMap
- A hash map whose keys are text snippets that will becheckForIntersection
- check whether all content of gold file is included in real file
replaced by the corresponding value in the gold file, during results checking. If null,
it is not used.java.lang.Exception
public static void checkResultsText(java.lang.String objectName, java.lang.String resultsText, boolean ignoreWhitespace) throws java.lang.Exception
objectName
- The name of the object that is being checked.resultsText
- The results text to be compared. This text will be stored in a temporary file.suffix
- A uniqueness suffix in case the same object is checked multiple times, with different configuration.java.lang.Exception
public static void checkResultsText(java.lang.String objectName, java.lang.String resultsText) throws java.lang.Exception
java.lang.Exception
public static void checkResultsText(java.lang.String objectName, java.lang.String resultsText, java.lang.String suffix, boolean ignoreWhitespace) throws java.lang.Exception
objectName
- The name of the object that is being checked.resultsText
- The results text to be compared. This text will be stored in a temporary file.java.lang.Exception
public static void checkResultsText(java.lang.String objectName, java.lang.String resultsText, java.lang.String suffix, boolean ignoreWhitespace, java.util.Map goldFileSubstitutionMap) throws java.lang.Exception
objectName
- The name of the object that is being checked.resultsText
- The results text to be compared. This text will be stored in a temporary file.goldFileSubstitutionMap
- A hash map whose keys are text snippets that will be
replaced by the corresponding value in the gold file, during results checking. If null,
it is not used.java.lang.Exception
public static void checkResultsText(java.lang.String objectName, java.lang.String resultsText, java.lang.String suffix) throws java.lang.Exception
java.lang.Exception
public static void checkResults(java.lang.Class testClass, java.lang.String objectName, java.lang.String resultsFilePath, java.lang.String suffix, boolean ignoreWhitespace) throws java.lang.Exception
testClass
- The test case class where the results were generated. Used to find the gold file pathobjectName
- The name of the object that is being checked.resultsFilePath
- A path name of a file that already contains the current results text.suffix
- A uniqueness suffix in case the same object is checked multiple times, with different configuration.
before results checking. If null, it is ignored.java.lang.Exception
public static void setGoldFileBaseDir(java.lang.String path)
public static void resetGoldFileBaseDir()
public static void checkResults(java.lang.Class testClass, java.lang.String objectName, java.lang.String resultsFilePath, java.lang.String suffix, boolean ignoreWhitespace, java.util.Map goldFileSubstitutionMap) throws java.lang.Exception
testClass
- The test case class where the results were generated. Used to find the gold file pathobjectName
- The name of the object that is being checked.resultsFilePath
- A path name of a file that already contains the current results text.suffix
- A uniqueness suffix in case the same object is checked multiple times, with different configuration.goldFileSubstitutionMap
- A hash map used to do text substitution in the gold file
before results checking. If null, it is ignored.java.lang.Exception
public static void checkResults(java.lang.Class testClass, java.lang.String objectName, java.lang.String resultsFilePath, java.lang.String suffix, boolean ignoreWhitespace, java.util.Map goldFileSubstitutionMap, boolean checkForIntersection) throws java.lang.Exception
testClass
- The test case class where the results were generated. Used to find the gold file pathobjectName
- The name of the object that is being checked.resultsFilePath
- A path name of a file that already contains the current results text.suffix
- A uniqueness suffix in case the same object is checked multiple times, with different configuration.goldFileSubstitutionMap
- A hash map used to do text substitution in the gold filecheckForIntersection
- check whether all content of gold file is included in the real file
before results checking. If null, it is ignored.java.lang.Exception
public static java.lang.String getGoldFilePath(java.lang.Class testClass, java.lang.String resultName)
public static void checkResultsConent(java.lang.Class testClass, java.lang.String objectName, java.lang.String[] resultFilePaths, java.lang.String suffix, boolean ignoreWhitespace) throws java.lang.Exception
testClass
- The test case class where the results were generated. Used to find the gold file pathobjectName
- The name of the object that is being checked.resultsFilePath
- A path name of a file that already contains the current results text.suffix
- A uniqueness suffix in case the same object is checked multiple times, with different configuration.java.lang.Exception
public static void checkResults(java.lang.String objectName, java.lang.String resultsFilePath, java.lang.String goldFilePath, boolean ignoreWhitespace) throws java.lang.Exception
testClass
- The test case class where the results were generated. Used to find the gold file pathobjectName
- The name of the object that is being checked.resultsFilePath
- A path name of a file that already contains the current results text.suffix
- A uniqueness suffix in case the same object is checked multiple times, with different configuration.java.lang.Exception
public static java.lang.String getTestObjectName(oracle.odi.domain.root.NamedObject namedObj)
public static void checkResults(java.lang.String objectName, java.lang.String resultsFilePath, java.lang.String goldFilePath, boolean ignoreWhitespace, java.util.Map goldFileSubstitutionMap) throws java.lang.Exception
testClass
- The test case class where the results were generated. Used to find the gold file pathobjectName
- The name of the object that is being checked.resultsFilePath
- A path name of a file that already contains the current results text.suffix
- A uniqueness suffix in case the same object is checked multiple times, with different configuration.goldFileSubstitutionMap
- A hash map used to perform text substitution in the gold
file before results checking. If null, it is ignored.java.lang.Exception
public static void checkResults(java.lang.String objectName, java.lang.String resultsFilePath, java.lang.String goldFilePath, boolean ignoreWhitespace, java.util.Map goldFileSubstitutionMap, boolean checkForIntersection) throws java.lang.Exception
testClass
- The test case class where the results were generated. Used to find the gold file pathobjectName
- The name of the object that is being checked.resultsFilePath
- A path name of a file that already contains the current results text.suffix
- A uniqueness suffix in case the same object is checked multiple times, with different configuration.goldFileSubstitutionMap
- A hash map used to perform text substitution in the gold
file before results checking. If null, it is ignored.java.lang.Exception
public static void checkResultsContent(java.lang.String objectName, java.lang.String resultsFilePath, java.lang.String goldFilePath, boolean ignoreWhitespace) throws java.lang.Exception
objectName
- The name of the object that is being checked.resultsFilePath
- A path name of a file that already contains the current results text.goldFilePath
- A path name of a file that already contains the previously stored text.java.lang.Exception
public static void throwCollectedExceptions()
public static void testEnd()
public static void clearFixGoldFileScript()
public static java.lang.String diffFiles(java.lang.String path1, java.lang.String path2, boolean ignoreWhitespace, java.util.Map file1SubstitutionMap, java.lang.String[] correctedFile1Text) throws java.io.FileNotFoundException
path1
- Path name for file 1path2
- Path name for file 2file1SubstitutionMap
- A hash map used to perform text substitution in file1,
and create a modified version of file2 used to correct file1 if necessary.correctedFile1Text
- A string array whose first element is the corrected file1 text,
if a substitution map was provided.java.io.FileNotFoundException
public static java.lang.String diffFiles(java.lang.String path1, java.lang.String path2, boolean ignoreWhitespace, java.util.Map file1SubstitutionMap, java.lang.String[] correctedFile1Text, java.lang.Boolean checkForIntersection) throws java.io.FileNotFoundException
path1
- Path name for file 1path2
- Path name for file 2file1SubstitutionMap
- A hash map used to perform text substitution in file1,
and create a modified version of file2 used to correct file1 if necessary.correctedFile1Text
- A string array whose first element is the corrected file1 text,
if a substitution map was provided.checkForIntersection
- to ignore error if content of path2 file is part of of path1 filejava.io.FileNotFoundException
public static boolean compareFiles(java.lang.String path1, java.lang.String path2, boolean ignoreWhitespace) throws java.io.FileNotFoundException
path1
- Path name for file 1path2
- Path name for file 2java.io.FileNotFoundException
public static java.lang.String trimWhitespace(java.lang.String str)
public static java.lang.String readFullFile(java.lang.String pathName) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public static boolean equalsIgnoreWhitespace(java.lang.String s1, java.lang.String s2)
public static void diffWhitespace(java.lang.String s1, java.lang.String s2)
s1
- s2
- public static boolean diffWhitespace(java.lang.String s1, java.lang.String s2, boolean throwAssertFailure)