public class TestDriverContext extends Object implements TestContext
Modifier and Type | Class and Description |
---|---|
static class |
TestDriverContext.TestExecutionPhase
Represents each phase in test execution.
|
TestContext.Empty
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_BATCHAPPS_PATH
The default path of batch application installation base path (relative from the framework home path).
|
static String |
ENV_BATCHAPPS_PATH
Environmental variable: the batch applications installation base path.
|
static String |
ENV_FRAMEWORK_PATH
Environmental variable: the framework home path.
|
static String |
EXTERNAL_LIBRARIES_PATH
The path to the external dependency libraries folder (relative from working directory).
|
static String |
FRAMEWORK_VERSION_PATH
The path to the framework version file (relative from the framework home path).
|
static String |
KEY_BATCHAPPS_PATH
The system property key of the default batch applications installation base path.
|
static String |
KEY_COMPILER_WORKING_DIRECTORY
The system property key of compiler working directory.
|
static String |
KEY_FORCE_EXEC
The system property key of ignoring environment checking.
|
static String |
KEY_FRAMEWORK_PATH
The system property key of the default framework installation path.
|
static String |
KEY_FRAMEWORK_VERSION
The entry key of the test-runtime framework version.
|
static String |
KEY_RUNTIME_WORKING_DIRECTORY
Deprecated.
Use
CompilerConstants.KEY_RUNTIME_WORKING_DIRECTORY instead |
Constructor and Description |
---|
TestDriverContext(Class<?> contextClass)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
cleanUpTemporaryResources()
Removes all temporary resources generated in this context.
|
Optional<String> |
findDevelopmentEnvironmentVersion()
Returns the development environment version.
|
Optional<String> |
findRuntimeEnvironmentVersion()
Returns the development environment version.
|
Map<String,String> |
getArguments()
Returns the user arguments.
|
File |
getBatchApplicationsInstallationPath()
Returns the path to the batch applications installation location.
|
Map<String,String> |
getBatchArgs()
Returns the batch arguments.
|
Class<?> |
getCallerClass()
Returns the caller class.
|
ClassLoader |
getClassLoader()
Returns the class loader to load testing peripherals.
|
String |
getClusterWorkDir()
Deprecated.
Use
CompilerConstants.getRuntimeWorkingDirectory() instead |
CompilerConfiguration.DebugLevel |
getCompilerDebugLevel()
Returns the compiler debug level.
|
CompilerConfiguration.OptimizeLevel |
getCompilerOptimizeLevel()
Returns the compiler optimization level.
|
Map<String,String> |
getCompilerOptions()
Returns the compiler specific options.
|
File |
getCompilerWorkingDirectory()
Returns the compiler working directory.
|
String |
getCompileWorkBaseDir()
Returns the path to the compiler working directory.
|
UUID |
getContextId()
Returns the context ID.
|
String |
getCurrentBatchId()
Returns the current batch ID.
|
String |
getCurrentExecutionId()
Returns the current execution ID.
|
String |
getCurrentFlowId()
Returns the current flow ID.
|
String |
getDevelopmentEnvironmentVersion()
Returns the development environment version.
|
Map<String,String> |
getEnvironmentVariables()
Returns the environment variables.
|
String |
getExecutionId()
Returns the current execution ID.
|
<T> T |
getExtension(Class<T> type)
Returns the extension object.
|
Set<Class<?>> |
getExtensionTypes()
Returns the registered extension types.
|
Map<String,String> |
getExtraConfigurations()
Returns extra configurations for the runtime.
|
File |
getFrameworkHomePath()
Returns the framework home path.
|
File |
getFrameworkHomePathOrNull()
Returns the framework home path.
|
File |
getJobflowPackageLocation(String batchId)
Returns the path to the jobflow package (*.jar) deployment directory.
|
File |
getLibrariesPackageLocation(String batchId)
Returns the path to the external libraries (*.jar) deployment directory.
|
File |
getLibrariesPath()
Returns the path to the dependency libraries path.
|
String |
getOsUser()
Returns the current user name in OS.
|
TestToolRepository |
getRepository()
Returns the test tool repository.
|
String |
getRuntimeEnvironmentVersion()
Returns the runtime environment version.
|
boolean |
isSkipCleanInput()
Returns whether this test skips to cleanup input data source.
|
boolean |
isSkipCleanOutput()
Returns whether this test skips to cleanup input data source.
|
boolean |
isSkipPrepareInput()
Returns whether this test skips to cleanup input data source.
|
boolean |
isSkipPrepareOutput()
Returns whether this test skips to prepare output data source.
|
boolean |
isSkipRunJobflow()
Returns whether this test skips to execute jobflows.
|
boolean |
isSkipValidateCondition()
Returns whether this test skips to cleanup input data source.
|
boolean |
isSkipVerify()
Returns whether this test skips to verify the testing result.
|
<T> void |
putExtension(Class<T> type,
T object)
Puts the extension object.
|
void |
setBatchApplicationsInstallationPath(File path)
Sets the path to the batch applications installation location.
|
void |
setCompilerDebugLevel(CompilerConfiguration.DebugLevel newValue)
Sets the compiler debug level.
|
void |
setCompilerOptimizeLevel(CompilerConfiguration.OptimizeLevel newValue)
Sets the compiler optimization level.
|
void |
setCompilerWorkingDirectory(File path)
Sets the compiler working directory.
|
void |
setCurrentBatchId(String currentBatchId)
Configures the current batch ID.
|
void |
setCurrentExecutionId(String currentExecutionId)
Returns the current execution ID.
|
void |
setCurrentFlowId(String currentFlowId)
Configures the current flow ID.
|
void |
setFrameworkHomePath(File frameworkHomePath)
Sets the path to the framework installed location.
|
void |
setLibrariesPath(File librariesPath)
Sets the path to the external dependency libraries folder.
|
void |
setSkipCleanInput(boolean skip)
Sets whether this test skips to cleanup input data source (default:
false ). |
void |
setSkipCleanOutput(boolean skip)
Sets whether this test skips to cleanup output data source (default:
false ). |
void |
setSkipPrepareInput(boolean skip)
Sets whether this test skips to prepare input data source (default:
false ). |
void |
setSkipPrepareOutput(boolean skip)
Sets whether this test skips to prepare output data source (default:
false ). |
void |
setSkipRunJobflow(boolean skip)
Sets whether this test skips to execute jobflows (default:
false ). |
void |
setSkipValidateCondition(boolean skip)
Sets whether this test skips to cleanup input data source (default:
false ). |
void |
setSkipVerify(boolean skip)
Sets whether this test skips to verify the testing result (default:
false ). |
void |
useSystemBatchApplicationsInstallationPath(boolean use)
Enable to use the system batch applications installation base location instead of using generated path.
|
void |
validateCompileEnvironment()
Deprecated.
legacy API
|
void |
validateExecutionEnvironment()
Validates current test execution environment.
|
@Deprecated public static final String KEY_RUNTIME_WORKING_DIRECTORY
CompilerConstants.KEY_RUNTIME_WORKING_DIRECTORY
insteadpublic static final String KEY_COMPILER_WORKING_DIRECTORY
public static final String KEY_FRAMEWORK_PATH
public static final String KEY_BATCHAPPS_PATH
public static final String KEY_FORCE_EXEC
validateExecutionEnvironment()
,
Constant Field Valuespublic static final String ENV_FRAMEWORK_PATH
public static final String ENV_BATCHAPPS_PATH
public static final String DEFAULT_BATCHAPPS_PATH
public static final String EXTERNAL_LIBRARIES_PATH
public static final String FRAMEWORK_VERSION_PATH
public static final String KEY_FRAMEWORK_VERSION
public TestDriverContext(Class<?> contextClass)
contextClass
- context class (will use to detect test resources)IllegalArgumentException
- if some parameters were null
public UUID getContextId()
@Deprecated public void validateCompileEnvironment()
AssertionError
- if current test environment is invalidpublic String getDevelopmentEnvironmentVersion()
IllegalStateException
- if the version is not definedpublic String getRuntimeEnvironmentVersion()
null
if it is not definedpublic Optional<String> findRuntimeEnvironmentVersion()
IllegalStateException
- if the version is not definedpublic Optional<String> findDevelopmentEnvironmentVersion()
IllegalStateException
- if the version is not definedpublic void validateExecutionEnvironment()
AssertionError
- if current test environment is invalidpublic void setFrameworkHomePath(File frameworkHomePath)
frameworkHomePath
- the path to the framework install location, or null
to reset locationpublic File getFrameworkHomePath()
ASAKUSA_HOME
IllegalStateException
- if neither the framework home path nor the environmental variable were setpublic File getFrameworkHomePathOrNull()
ASAKUSA_HOME
, or null
public void useSystemBatchApplicationsInstallationPath(boolean use)
use
- true
to use system location, or false
otherwisepublic void setBatchApplicationsInstallationPath(File path)
path
- the path to the batch applications installation location, or null
to reset locationpublic File getBatchApplicationsInstallationPath()
public File getJobflowPackageLocation(String batchId)
framework installed location
.batchId
- target batch IDIllegalArgumentException
- if some parameters were null
setFrameworkHomePath(File)
public File getLibrariesPackageLocation(String batchId)
batchId
- target batch IDIllegalArgumentException
- if some parameters were null
setLibrariesPath(File)
public File getCompilerWorkingDirectory()
public void setCompilerWorkingDirectory(File path)
path
- the compiler working directorypublic String getOsUser()
public String getCompileWorkBaseDir()
@Deprecated public String getClusterWorkDir()
CompilerConstants.getRuntimeWorkingDirectory()
insteadpublic File getLibrariesPath()
public void setLibrariesPath(File librariesPath)
librariesPath
- the libraries folder pathIllegalArgumentException
- if some parameters were null
public Class<?> getCallerClass()
public TestToolRepository getRepository()
public String getExecutionId()
setCurrentExecutionId(String)
public Map<String,String> getExtraConfigurations()
-D <key>=<value>
.public Map<String,String> getBatchArgs()
public Map<String,String> getEnvironmentVariables()
TestContext
getEnvironmentVariables
in interface TestContext
public Map<String,String> getArguments()
TestContext
getArguments
in interface TestContext
public void setCompilerOptimizeLevel(CompilerConfiguration.OptimizeLevel newValue)
newValue
- the compiler optimization levelpublic void setCompilerDebugLevel(CompilerConfiguration.DebugLevel newValue)
newValue
- the compiler debug levelpublic CompilerConfiguration.OptimizeLevel getCompilerOptimizeLevel()
public CompilerConfiguration.DebugLevel getCompilerDebugLevel()
public Map<String,String> getCompilerOptions()
public <T> T getExtension(Class<T> type)
T
- the extension typetype
- the extension typenull
if it is not registeredpublic Set<Class<?>> getExtensionTypes()
getExtension(Class)
public <T> void putExtension(Class<T> type, T object)
T
- the extension typetype
- the extension typeobject
- the extension object, or null
to remove the target extensionpublic ClassLoader getClassLoader()
TestContext
getClassLoader
in interface TestContext
public String getCurrentBatchId()
null
if not setsetCurrentBatchId(String)
public void setCurrentBatchId(String currentBatchId)
currentBatchId
- the IDpublic String getCurrentFlowId()
null
if not setsetCurrentFlowId(String)
public void setCurrentFlowId(String currentFlowId)
currentFlowId
- the IDpublic String getCurrentExecutionId()
null
if not setsetCurrentExecutionId(String)
public void setCurrentExecutionId(String currentExecutionId)
currentExecutionId
- the IDpublic boolean isSkipValidateCondition()
true
to skip, otherwise false
public void setSkipValidateCondition(boolean skip)
false
).skip
- true
to skip, otherwise false
public boolean isSkipCleanInput()
true
to skip, otherwise false
public void setSkipCleanInput(boolean skip)
false
).skip
- true
to skip, otherwise false
public boolean isSkipCleanOutput()
true
to skip, otherwise false
public void setSkipCleanOutput(boolean skip)
false
).skip
- true
to skip, otherwise false
public boolean isSkipPrepareInput()
true
to skip, otherwise false
public void setSkipPrepareInput(boolean skip)
false
).skip
- true
to skip, otherwise false
public boolean isSkipPrepareOutput()
true
to skip, otherwise false
public void setSkipPrepareOutput(boolean skip)
false
).skip
- true
to skip, otherwise false
public boolean isSkipRunJobflow()
true
to skip, otherwise false
public void setSkipRunJobflow(boolean skip)
false
).skip
- true
to skip, otherwise false
public boolean isSkipVerify()
true
to skip, otherwise false
public void setSkipVerify(boolean skip)
false
).skip
- true
to skip, otherwise false
public void cleanUpTemporaryResources()
Copyright © 2011–2019 Asakusa Framework Team. All rights reserved.