public static interface Testing.Files
| Modifier and Type | Field and Description |
|---|---|
static String |
DATA_DIR |
static String |
DBZ_TEST_DATA_DIR_ENV_VAR_NAME |
static String |
DBZ_TEST_DATA_DIR_SYSTEM_PROPERTY_KEY |
| Modifier and Type | Method and Description |
|---|---|
static File |
createTestingDirectory(String relativePath)
Create a directory within the test data directory at the given relative path.
|
static File |
createTestingDirectory(String relativePath,
boolean removeExistingContent)
Create a directory within the test data directory at the given relative path.
|
static File |
createTestingFile()
Create a randomly-named file within the test data directory.
|
static File |
createTestingFile(Path relativePath)
Create a file within the test data directory at the given relative path.
|
static File |
createTestingFile(String relativePath)
Create a file within the test data directory at the given relative path.
|
static Path |
createTestingPath(String relativePath)
Create the path to a file within the test data directory at the given relative path.
|
static String |
dataDir()
Returns the name of the directory where tests are storing their data.
|
static void |
delete(File fileOrFolder)
A method that will delete a file or folder only if it is within the 'target' directory (for safety).
|
static void |
delete(Path path)
A method that will delete a file or folder only if it is within the 'target' directory (for safety).
|
static void |
delete(String path)
A method that will delete a file or folder only if it is within the 'target' directory (for safety).
|
static String |
determineTestDataDir() |
static boolean |
inTestDataDir(File file)
Verify that the supplied file or directory is within the test data directory.
|
static boolean |
inTestDataDir(Path path)
Verify that the supplied file or directory is within the test data directory.
|
static InputStream |
readResourceAsStream(String pathOnClasspath)
Obtain an InputStream to a named resource on the classpath used to load this
Testing class. |
static InputStream |
readResourceAsStream(String pathOnClasspath,
Class<?> testClass)
Obtain an InputStream to a named resource on the given classpath.
|
static String |
readResourceAsString(String pathOnClasspath)
Read a classpath resource into a string.
|
static final String DBZ_TEST_DATA_DIR_ENV_VAR_NAME
static final String DBZ_TEST_DATA_DIR_SYSTEM_PROPERTY_KEY
static final String DATA_DIR
static String determineTestDataDir()
static InputStream readResourceAsStream(String pathOnClasspath, Class<?> testClass)
pathOnClasspath - the path of the resource on the classpathtestClass - the test class, used for accessing the class loaderstatic InputStream readResourceAsStream(String pathOnClasspath)
Testing class.pathOnClasspath - the path of the resource on the classpathstatic String readResourceAsString(String pathOnClasspath)
pathOnClasspath - the path of the resource on the classpathstatic File createTestingDirectory(String relativePath)
relativePath - the path of the directory within the test data directory; may not be nullstatic String dataDir()
'target/data'.
This value can be overridden by value of the DBZ_TEST_DATA_DIR system or environment variable.static File createTestingFile()
static File createTestingFile(String relativePath)
relativePath - the path of the file within the test data directory; may not be nullstatic File createTestingFile(Path relativePath)
relativePath - the path of the file within the test data directory; may not be nullstatic Path createTestingPath(String relativePath)
relativePath - the path of the file within the test data directory; may not be nullstatic File createTestingDirectory(String relativePath, boolean removeExistingContent) throws IOException
relativePath - the path of the directory within the test data directory; may not be nullremoveExistingContent - true if any existing content should be removedIOException - if there is a problem deleting the files at this pathstatic void delete(String path)
path - the path to the file or folder in the target directorystatic void delete(File fileOrFolder)
fileOrFolder - the file or folder in the target directorystatic void delete(Path path)
path - the path to the file or folder in the target directorystatic boolean inTestDataDir(File file)
file - the file or directory; may not be nullstatic boolean inTestDataDir(Path path)
path - the path to the file or directory; may not be nullCopyright © 2021 JBoss by Red Hat. All rights reserved.