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 。 |