public class ScriptUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ScriptUtils.DrillbitRun |
static class |
ScriptUtils.RunResult
Handy run result class to capture the information we need for testing and
to do various kinds of validation on it.
|
static class |
ScriptUtils.ScriptRunner
The "business end" of the tests: runs drillbit.sh and captures results.
|
| Modifier and Type | Field and Description |
|---|---|
File |
distribDir |
boolean |
externalLogDir |
File |
javaHome |
static String[] |
scripts
Scripts we must copy from the source tree to create a simulated
Drill bin directory.
|
static String[] |
sqlLineArgs
Out-of-the-box command-line arguments when launching sqlline.
|
static String[] |
stdArgs
Out-of-the-box command-line arguments when launching Drill.
|
static String |
TEMP_DIR |
File |
testDir |
File |
testDrillHome |
File |
testLogDir |
File |
testSiteDir |
static boolean |
USE_SOURCE |
static boolean |
useSource |
| Modifier and Type | Method and Description |
|---|---|
void |
copyFile(File source,
File dest) |
File |
createDir(File dir)
Remove, then create a directory.
|
void |
createEnvFile(File file,
Map<String,String> env,
boolean overrideValue)
Create a drill-env.sh or distrib-env.sh file with the given environment in
the recommended format.
|
void |
createEnvFileWithCondition(File file,
Map<String,String> condition,
Map<String,String> env,
boolean overrideValue)
Creates a drill-env.sh or distrib-env.sh file with the given environment under
a given condition.
|
void |
createMockConf(File siteDir)
Build a "starter" conf or site directory by creating a mock
drill-override.conf file.
|
void |
createMockDistrib() |
ScriptUtils |
fromDistrib(String distrib) |
ScriptUtils |
fromSource(String sourceDir) |
void |
initialSetup()
Create the basic test directory.
|
static ScriptUtils |
instance() |
File |
makeDummyJar(File dir,
String prefix)
The tests should not require jar files, but we simulate them to be a bit
more realistic.
|
void |
removeDir(File dir) |
void |
writeEnvFile(PrintWriter out,
String key,
String value,
boolean overrideValue) |
void |
writeFile(File file,
String contents)
Create a simple text file with the given contents.
|
public File distribDir
public File javaHome
public File testDir
public File testDrillHome
public File testSiteDir
public File testLogDir
public boolean externalLogDir
public static String[] sqlLineArgs
public static final boolean USE_SOURCE
public static final String TEMP_DIR
public static boolean useSource
public static String[] stdArgs
public static String[] scripts
public static ScriptUtils instance()
public ScriptUtils fromSource(String sourceDir)
public ScriptUtils fromDistrib(String distrib)
public void initialSetup()
throws IOException
IOExceptionpublic void createMockDistrib()
throws IOException
IOExceptionpublic File makeDummyJar(File dir, String prefix) throws IOException
IOExceptionpublic void writeFile(File file, String contents) throws IOException
IOExceptionpublic void writeEnvFile(PrintWriter out, String key, String value, boolean overrideValue)
public void createEnvFile(File file, Map<String,String> env, boolean overrideValue) throws IOException
file - - File instance to set environment variables inenv - - Environment to be placed inside FileoverrideValue - - true - Set environment value such that it overrides previously set value
- false - Set environment value in recommended format.IOExceptionpublic void createEnvFileWithCondition(File file, Map<String,String> condition, Map<String,String> env, boolean overrideValue) throws IOException
file - - File instance to set environment and condition incondition - - Conditions to guard environment variableenv - - Environment to be placed inside FileoverrideValue - - true - Set environment value such that it overrides previously set value
- false - Set environment value in recommended format.IOExceptionpublic void createMockConf(File siteDir) throws IOException
IOExceptionpublic void removeDir(File dir) throws IOException
IOExceptionpublic File createDir(File dir) throws IOException
IOExceptionpublic void copyFile(File source, File dest) throws IOException
IOExceptionCopyright © 2021 The Apache Software Foundation. All rights reserved.