Tradefed 沙盒
public class TradefedSandbox
extends Object
implements ISandbox
java.lang.Object | |
↳ | com.android.tradefed.sandbox.TradefedSandbox |
可以运行 Trade Federation 调用的沙盒容器。 TODO:允许将选项传递给沙箱。
概括
公共构造函数 | |
---|---|
TradefedSandbox () |
公共方法 | |
---|---|
String | createClasspath (File workingDir) 根据环境和 |
IConfiguration | createThinLauncherConfig (String[] args, IKeyStoreClient keyStoreClient, IRunUtil runUtil, File globalConfig) 与主运行断开连接的特殊模式:当父项中似乎不存在配置时,我们回退到精简启动器,在那里我们尝试使用当前已知信息设置沙箱并填充工作目录以在版本化目录中完全创建配置. |
File | getTradefedSandboxEnvironment ( IInvocationContext context, IConfiguration nonVersionedConfig, String[] args) 根据命令行参数返回要使用的沙盒环境 TF。 |
Exception | prepareEnvironment ( IInvocationContext context, IConfiguration config, ITestInvocationListener listener) 为沙盒正常运行准备环境。 |
CommandResult | run ( TestInformation info, IConfiguration config, ITestLogger logger) 使用设置的环境运行沙箱。 |
void | tearDown () 清理任何可能已更改的状态、文件或环境。 |
受保护的方法 | |
---|---|
File | dumpGlobalConfig ( IConfiguration config, exclusionPatterns) dumpGlobalConfig ( IConfiguration config, exclusionPatterns) 转储从某些对象过滤的全局配置。 |
Exception | prepareConfiguration ( IInvocationContext context, IConfiguration config, ITestInvocationListener listener) 准备将传递给子进程并将驱动容器执行的 |
File | prepareContext ( IInvocationContext context, IConfiguration config) 准备并序列化 |
公共构造函数
Tradefed 沙盒
public TradefedSandbox ()
公共方法
创建类路径
public String createClasspath (File workingDir)
根据环境和getTradefedSandboxEnvironment(com.android.tradefed.invoker.IInvocationContext, com.android.tradefed.config.IConfiguration, String[])
返回的工作目录创建一个类路径。
参数 | |
---|---|
workingDir | File :沙箱的当前工作目录。 |
退货 | |
---|---|
String | 要使用的类路径。 |
投掷 | |
---|---|
ConfigurationException |
createThinLauncherConfig
public IConfiguration createThinLauncherConfig (String[] args, IKeyStoreClient keyStoreClient, IRunUtil runUtil, File globalConfig)
与主运行断开连接的特殊模式:当父项中似乎不存在配置时,我们回退到精简启动器,在那里我们尝试使用当前已知信息设置沙箱并填充工作目录以在版本化目录中完全创建配置.
参数 | |
---|---|
args | String :原始命令行参数。 |
keyStoreClient | IKeyStoreClient :用于创建配置的当前密钥库客户端。 |
runUtil | IRunUtil :当前运行主机命令的IRunUtil 。 |
globalConfig | File :用于运行 TF 子进程的全局配置。 |
退货 | |
---|---|
IConfiguration | 指向 NON_VERSIONED 对象的 TF 配置 XML 的文件。如果无法创建精简启动器配置,则返回 null。 |
getTradefedSandboxEnvironment
public File getTradefedSandboxEnvironment (IInvocationContext context, IConfiguration nonVersionedConfig, String[] args)
根据命令行参数返回要使用的沙盒环境 TF。
参数 | |
---|---|
context | IInvocationContext :父级的IInvocationContext 。 |
nonVersionedConfig | IConfiguration :表示非版本化对象的IConfiguration 。 |
args | String : 命令行参数。 |
退货 | |
---|---|
File | 包含 TF 沙箱环境 jar 的ERROR(/File) 目录。 |
准备环境
public Exception prepareEnvironment (IInvocationContext context, IConfiguration config, ITestInvocationListener listener)
为沙盒正常运行准备环境。
参数 | |
---|---|
context | IInvocationContext :当前调用IInvocationContext 。 |
config | IConfiguration :要运行的命令的IConfiguration 。 |
listener | ITestInvocationListener :当前调用ITestInvocationListener 最终结果应通过管道传输。 |
退货 | |
---|---|
Exception | 包含失败的Exception 。如果成功,则为 Null。 |
跑
public CommandResult run (TestInformation info, IConfiguration config, ITestLogger logger)
使用设置的环境运行沙箱。
参数 | |
---|---|
info | TestInformation : 描述调用的TestInformation |
config | IConfiguration :要运行的命令的IConfiguration 。 |
logger | ITestLogger :我们可以记录文件的ITestLogger 。 |
退货 | |
---|---|
CommandResult | 带有沙盒运行和日志状态的CommandResult 。 |
拆除
public void tearDown ()
清理任何可能已更改的状态、文件或环境。
受保护的方法
转储全局配置
protected File dumpGlobalConfig (IConfiguration config,exclusionPatterns)
转储从某些对象过滤的全局配置。
参数 | |
---|---|
config | IConfiguration |
exclusionPatterns |
退货 | |
---|---|
File |
投掷 | |
---|---|
ConfigurationException |
准备配置
protected Exception prepareConfiguration (IInvocationContext context, IConfiguration config, ITestInvocationListener listener)
准备将传递给子进程并将驱动容器执行的IConfiguration
。
参数 | |
---|---|
context | IInvocationContext :当前的IInvocationContext 。 |
config | IConfiguration :要准备的IConfiguration 。 |
listener | ITestInvocationListener :当前调用ITestInvocationListener 。 |
退货 | |
---|---|
Exception | 如果出现任何问题,则为异常,否则为 null。 |
准备上下文
protected File prepareContext (IInvocationContext context, IConfiguration config)
准备并序列化IInvocationContext
。
参数 | |
---|---|
context | IInvocationContext :要准备的IInvocationContext 。 |
config | IConfiguration :沙盒的IConfiguration 。 |
退货 | |
---|---|
File | 序列化的IInvocationContext 。 |