ISandbox

public interface ISandbox

com.android.tradefed.sandbox.ISandbox


用于定义可用于运行调用的沙盒的接口。

摘要

公共方法

abstract String createClasspath(File workingDir)

根据环境和 getTradefedSandboxEnvironment(com.android.tradefed.invoker.IInvocationContext, com.android.tradefed.config.IConfiguration, String[]) 返回的工作目录创建类路径。

abstract IConfiguration createThinLauncherConfig(String[] args, IKeyStoreClient keyStoreClient, IRunUtil runUtil, File globalConfig)

与主运行作业断开连接的特殊模式:如果父级中似乎不存在配置,我们会回退到精简启动器,在其中尝试使用当前已知的信息设置沙盒,并填充工作目录,以便在版本化目录中完全创建配置。

abstract File getTradefedSandboxEnvironment(IInvocationContext context, IConfiguration nonVersionedConfig, String[] args)

根据命令行参数返回要使用的沙盒环境 TF。

abstract Exception prepareEnvironment(IInvocationContext context, IConfiguration configuration, ITestInvocationListener listener)

准备环境,以便沙盒正常运行。

abstract CommandResult run(IConfiguration configuration, ITestLogger logger)

使用设置的环境运行沙盒。

abstract void tearDown()

清理可能已更改的所有状态、文件或环境。

公共方法

createClasspath

public abstract String createClasspath (File workingDir)

根据环境和 getTradefedSandboxEnvironment(com.android.tradefed.invoker.IInvocationContext, com.android.tradefed.config.IConfiguration, String[]) 返回的工作目录创建类路径。

参数
workingDir File:沙盒的当前工作目录。

返回
String 要使用的类路径。

抛出
ConfigurationException

createThinLauncherConfig

public abstract 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 abstract File getTradefedSandboxEnvironment (IInvocationContext context, 
                IConfiguration nonVersionedConfig, 
                String[] args)

根据命令行参数返回要使用的沙盒环境 TF。

参数
context IInvocationContext:父级的 IInvocationContext

nonVersionedConfig IConfiguration:表示非版本化对象的 IConfiguration

args String:命令行参数。

返回
File 包含 TF 沙盒环境 jar 文件的 ERROR(/File) 目录。

prepareEnvironment

public abstract Exception prepareEnvironment (IInvocationContext context, 
                IConfiguration configuration, 
                ITestInvocationListener listener)

准备环境,以便沙盒正常运行。

参数
context IInvocationContext:当前调用 IInvocationContext

configuration IConfiguration:要运行的命令的 IConfiguration

listener ITestInvocationListener:应将最终结果管道传输到的当前调用 ITestInvocationListener

返回
Exception 包含失败信息的 Exception;如果成功,则为 null。

得分

public abstract CommandResult run (IConfiguration configuration, 
                ITestLogger logger)

使用设置的环境运行沙盒。

参数
configuration IConfiguration:要运行的命令的 IConfiguration

logger ITestLogger:用于记录日志文件的 ITestLogger

返回
CommandResult 包含沙盒运行状态和日志的 CommandResult

tearDown

public abstract void tearDown ()

清理可能已更改的所有状态、文件或环境。