Tradefed沙箱
public class TradefedSandbox
extends Object
implements ISandbox
java.lang.Object | |
↳ | com.android.tradefed.sandbox.TradefedSandbox |
可以執行 Trade Federation 呼叫的沙箱容器。 TODO:允許將選項傳遞到沙箱。
概括
領域 | |
---|---|
public static final String | SANDBOX_ENABLED
|
公共構造函數 | |
---|---|
TradefedSandbox () |
公共方法 | |
---|---|
String | createClasspath (File workingDir) 根據 |
IConfiguration | createThinLauncherConfig (String[] args, IKeyStoreClient keyStoreClient, IRunUtil runUtil, File globalConfig) 與主運行斷開連接的特殊模式:當父級中似乎不存在配置時,我們會回退到精簡啟動器,在其中嘗試使用當前已知信息設置沙箱並填充工作目錄以在版本化目錄中完全建立配置。 |
File | getTradefedSandboxEnvironment ( IInvocationContext context, IConfiguration nonVersionedConfig, ITestLogger logger, String[] args) |
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) 轉儲從某些物件過濾出來的全域配置。 |
String | getJava () |
Exception | prepareConfiguration ( IInvocationContext context, IConfiguration config, ITestInvocationListener listener) 準備將傳遞給子程序並驅動容器執行的 |
File | prepareContext ( IInvocationContext context, IConfiguration config) 準備並序列化 |
領域
沙盒_啟用
public static final String SANDBOX_ENABLED
公共構造函數
Tradefed沙箱
public TradefedSandbox ()
公共方法
建立類別路徑
public String createClasspath (File workingDir)
根據ISandbox.getTradefedSandboxEnvironment(com.android.tradefed.invoker.IInvocationContext, com.android.tradefed.config.IConfiguration, String[])
傳回的環境和工作目錄建立類別路徑。
參數 | |
---|---|
workingDir | File :沙箱的目前工作目錄。 |
退貨 | |
---|---|
String | 要使用的類別路徑。 |
投擲 | |
---|---|
ConfigurationException |
建立ThinLauncherConfig
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, ITestLogger logger, String[] args)
參數 | |
---|---|
context | IInvocationContext |
nonVersionedConfig | IConfiguration |
logger | ITestLogger |
args | String |
退貨 | |
---|---|
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 |
取得Java
protected String getJava ()
退貨 | |
---|---|
String |
準備配置
protected Exception prepareConfiguration (IInvocationContext context, IConfiguration config, ITestInvocationListener listener)
準備將傳遞給子程序並驅動容器執行的IConfiguration
。
參數 | |
---|---|
context | IInvocationContext :目前的IInvocationContext 。 |
config | IConfiguration :要準備的IConfiguration 。 |
listener | ITestInvocationListener :目前呼叫ITestInvocationListener 。 |
退貨 | |
---|---|
Exception | 如果出現任何問題,則拋出 Exception,否則傳回 null。 |
準備情境
protected File prepareContext (IInvocationContext context, IConfiguration config)
準備並序列化IInvocationContext
。
參數 | |
---|---|
context | IInvocationContext :要準備的IInvocationContext 。 |
config | IConfiguration :沙箱的IConfiguration 。 |
退貨 | |
---|---|
File | 序列化的IInvocationContext 。 |
投擲 | |
---|---|
| IO異常 |