public class BaseDirTestWatcher extends DirTestWatcher
This is a DirTestWatcher which creates all the temporary directories
required by a Drillbit and the various dfs.* storage workspaces. It
also provides convenience methods that do the following:
The BaseDirTestWatcher creates the following directories in the
base temp directory (for a description of where the base temp
directory is located please read the docs for DirTestWatcher):
getTmpDir()getStoreDir()getRootDir()getDfsTestTmpDir()
The BaseDirTestWatcher is used in BaseTestQuery and an
example of how it is used in conjunction with the ClusterFixture can
be found in ExampleTest.
| Modifier and Type | Class and Description |
|---|---|
static class |
BaseDirTestWatcher.DirType
An enum used to represent the directories mapped to the dfs.root and
dfs.tmp workspaces respectively.
|
| Constructor and Description |
|---|
BaseDirTestWatcher()
Creates a
BaseDirTestWatcher which does not delete it's temp directories at the end of tests. |
BaseDirTestWatcher(boolean deleteDirAtEnd)
Creates a
BaseDirTestWatcher. |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear contents of cluster directories
|
File |
copyFileToRoot(Path relPath)
This copies a filed or directory from the maven project into the temp root
directory (corresponding to dfs.root).
|
File |
copyResourceToRoot(Path relPath)
This copies a file or directory from
src/test/resources into the
temp root directory (corresponding to dfs.root). |
File |
copyResourceToRoot(Path relPath,
Path destPath)
This copies a file or directory from src/test/resources into the
temp root directory (corresponding to dfs.root).
|
File |
copyResourceToTestTmp(Path relPath,
Path destPath)
This copies a file or directory from
src/test/resources into the
temp root directory (corresponding to dfs.root). |
File |
getCodegenDir()
Gets the temp directory that should be used to save generated code files.
|
File |
getDfsTestTmpDir()
Gets the temp directory that should be used by the dfs.tmp workspace.
|
File |
getHomeDir()
Gets the temp directory that is a proxy for the user's home directory.
|
File |
getRootDir()
Gets the temp directory that should be used to hold the contents of the
dfs.root workspace.
|
File |
getSpillDir() |
File |
getStoreDir()
Gets the temp directory that should be used by the
LocalPersistentStore. |
File |
getTmpDir()
Gets the temp directory that should be used as a Drillbit's temp tmp directory.
|
File |
makeRootSubDir(Path relPath)
Creates a directory in the temp root directory (corresponding to
dfs.root) at the given relative path.
|
File |
makeTestTmpSubDir(Path relPath)
Creates a directory in the tmp directory (corresponding to dfs.tmp)
at the given relative path.
|
void |
newDfsTestTmpDir()
This methods creates a new directory which can be mapped to dfs.tmp.
|
void |
removeFileFromRoot(Path relPath)
Removes a file or directory copied at relativePath inside the root directory
|
void |
replaceMetaDataContents(File metaDataFile,
File replacePath,
String customStringReplacement)
Replaces placeholders in test Parquet metadata files.
|
void |
start(Class<?> suite) |
protected void |
starting(org.junit.runner.Description description) |
createTempDir, failed, finished, getDir, makeSubDirpublic BaseDirTestWatcher()
BaseDirTestWatcher which does not delete it's temp directories at the end of tests.public BaseDirTestWatcher(boolean deleteDirAtEnd)
BaseDirTestWatcher.deleteDirAtEnd - If true, temp directories are deleted at the end of tests. If
false, temp directories are not deleted at the end of tests.public void start(Class<?> suite)
protected void starting(org.junit.runner.Description description)
starting in class DirTestWatcherpublic void clear()
public File getTmpDir()
public File getHomeDir()
public File getStoreDir()
LocalPersistentStore.LocalPersistentStore.public File getDfsTestTmpDir()
public File getRootDir()
public File getCodegenDir()
public File getSpillDir()
public void newDfsTestTmpDir()
public File makeRootSubDir(Path relPath)
relPath - The relative path in the temp root directory at which to create a
directory.File corresponding to the sub directory that
was created.public File makeTestTmpSubDir(Path relPath)
relPath - The relative path in the tmp directory at which to create a
directory.File corresponding to the sub directory that
was created.public File copyResourceToRoot(Path relPath)
src/test/resources into the
temp root directory (corresponding to dfs.root). The relative path
of the file or directory in src/test/resources is preserved in the
temp root directory.relPath - The relative path of the file or directory in
src/test/resources to copy into the root temp folder.File corresponding to the copied file or
directory in the temp root directory.public File copyFileToRoot(Path relPath)
relPath - The relative path of the file or directory in the maven module to
copy into the root temp folder.File corresponding to the copied file or
directory in the temp root directory.public File copyResourceToRoot(Path relPath, Path destPath)
relPath - The source relative path of a file or directory from
src/test/resources that will be copied.destPath - The destination relative path of the file or directory in the temp
root directory.File corresponding to the final copied file or
directory in the temp root directory.public void removeFileFromRoot(Path relPath) throws IOException
relPath - - relative path of file/directory to be deleted from the root directoryIOException - - Throws exception in case of failurepublic File copyResourceToTestTmp(Path relPath, Path destPath)
src/test/resources into the
temp root directory (corresponding to dfs.root). The file or
directory is copied to the provided relative destPath in the temp root
directory.relPath - The source relative path of a file or directory from
src/test/resources that will be copied.destPath - The destination relative path of the file or directory in the temp
root directory.File corresponding to the final copied file or
directory in the temp root directory.public void replaceMetaDataContents(File metaDataFile, File replacePath, String customStringReplacement)
metaDataFile - The Parquet metadata file to do string replacement on.replacePath - The path to replace >REPLACED_IN_TEST with in the Parquet
metadata file.customStringReplacement - If this is provided a CUSTOM_STRING_REPLACEMENT is replaced
in the Parquet metadata file with this string.Copyright © 2021 The Apache Software Foundation. All rights reserved.