沙箱

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 ( TestInformation info, IConfiguration configuration, ITestLogger logger)

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

abstract void tearDown ()

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

公共方法

创建类路径

public abstract String createClasspath (File workingDir)

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

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

退货
String要使用的类路径。

投掷
ConfigurationException

创建ThinLauncherConfig

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

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

参数
args String :原始命令行参数。

keyStoreClient IKeyStoreClient :用于创建配置的当前密钥库客户端。

runUtil IRunUtil :当前要运行主机命令的IRunUtil

globalConfig File :用于运行 TF 子进程的全局配置。

退货
IConfiguration指向 TF 的 NON_VERSIONED 对象的配置 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)目录。

准备环境

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

为沙箱正常运行准备环境。

参数
context IInvocationContext :当前调用IInvocationContext

configuration IConfiguration :要运行的命令的IConfiguration

listener ITestInvocationListener :当前调用ITestInvocationListener最终结果应该通过管道传输。

退货
Exception包含失败的ERROR(/Exception) 。如果成功则为 Null。

跑步

public abstract CommandResult run (TestInformation info, 
                IConfiguration configuration, 
                ITestLogger logger)

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

参数
info TestInformation :描述调用的TestInformation

configuration IConfiguration :要运行的命令的IConfiguration

logger ITestLogger :一个ITestLogger ,我们可以在其中记录文件。

退货
CommandResult具有沙箱运行和日志状态的CommandResult

拆除

public abstract void tearDown ()

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