TradefedSandbox
public
class
TradefedSandbox
extends Object
implements
ISandbox
java.lang.Object | |
↳ | com.android.tradefed.sandbox.TradefedSandbox |
可執行 Trade Federation 叫用作業的沙箱容器。TODO:允許將選項傳遞至沙箱。
摘要
欄位 | |
---|---|
public
static
final
String |
EXTRA_TARGET_LAB
|
public
static
final
String |
GENERAL_TESTS_ZIP
|
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)
|
static
|
matchSandboxExtraBuildTargetByConfigName(String configName)
根據測試設定檔名稱,比對沙箱的額外建構目標。 |
Exception
|
prepareEnvironment(IInvocationContext context, IConfiguration config, ITestInvocationListener listener)
準備環境,讓沙箱正常運作。 |
CommandResult
|
run(TestInformation info, IConfiguration config, ITestLogger logger)
使用已設定的環境執行沙箱。 |
void
|
tearDown()
清除所有可能已變更的狀態、檔案或環境。 |
受保護的方法 | |
---|---|
File
|
dumpGlobalConfig(IConfiguration config,
傾印從部分物件篩選出來的全域設定。 |
String
|
getJava()
|
Exception
|
prepareConfiguration(IInvocationContext context, IConfiguration config, ITestInvocationListener listener)
準備將傳遞至子程序的 |
File
|
prepareContext(IInvocationContext context, IConfiguration config)
準備並序列化 |
欄位
EXTRA_TARGET_LAB
public static final String EXTRA_TARGET_LAB
GENERAL_TESTS_ZIP
public static final String GENERAL_TESTS_ZIP
SANDBOX_ENABLED
public static final String SANDBOX_ENABLED
公用建構函式
TradefedSandbox
public TradefedSandbox ()
公用方法
createClasspath
public String createClasspath (File workingDir)
根據環境和 ISandbox.getTradefedSandboxEnvironment(com.android.tradefed.invoker.IInvocationContext, com.android.tradefed.config.IConfiguration, String[])
傳回的工作目錄建立類別路徑。
參數 | |
---|---|
workingDir |
File :沙箱目前的工作目錄。 |
傳回 | |
---|---|
String |
要使用的 classpath。 |
擲回 | |
---|---|
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 的檔案。如果無法建立精簡啟動器設定,則會傳回空值。 |
getTradefedSandboxEnvironment
public File getTradefedSandboxEnvironment (IInvocationContext context, IConfiguration nonVersionedConfig, ITestLogger logger, String[] args)
參數 | |
---|---|
context |
IInvocationContext |
nonVersionedConfig |
IConfiguration |
logger |
ITestLogger |
args |
String |
傳回 | |
---|---|
File |
matchSandboxExtraBuildTargetByConfigName
public staticmatchSandboxExtraBuildTargetByConfigName (String configName)
根據測試設定檔名稱,比對沙箱的額外建構目標。
參數 | |
---|---|
configName |
String |
傳回 | |
---|---|
|
prepareEnvironment
public Exception prepareEnvironment (IInvocationContext context, IConfiguration config, ITestInvocationListener listener)
準備環境,讓沙箱正常運作。
參數 | |
---|---|
context |
IInvocationContext :目前的叫用 IInvocationContext 。 |
config |
IConfiguration :要執行的指令的 IConfiguration 。 |
listener |
ITestInvocationListener :應將最終結果管道傳送至目前的叫用 ITestInvocationListener 。 |
傳回 | |
---|---|
Exception |
包含失敗的 Exception ,如果成功則為空值。 |
得分
public CommandResult run (TestInformation info, IConfiguration config, ITestLogger logger)
使用已設定的環境執行沙箱。
參數 | |
---|---|
info |
TestInformation :描述叫用的 TestInformation |
config |
IConfiguration :要執行的指令的 IConfiguration 。 |
logger |
ITestLogger :可記錄檔案的 ITestLogger 。 |
傳回 | |
---|---|
CommandResult |
CommandResult ,其中包含沙箱執行狀態和記錄。 |
tearDown
public void tearDown ()
清理所有可能已變更的狀態、檔案或環境。
受保護的方法
dumpGlobalConfig
protected File dumpGlobalConfig (IConfiguration config,exclusionPatterns)
傾印從部分物件篩選出來的全域設定。
參數 | |
---|---|
config |
IConfiguration |
exclusionPatterns |
|
傳回 | |
---|---|
File |
擲回 | |
---|---|
ConfigurationException |
getJava
protected String getJava ()
傳回 | |
---|---|
String |
prepareConfiguration
protected Exception prepareConfiguration (IInvocationContext context, IConfiguration config, ITestInvocationListener listener)
準備將傳遞至子程序的 IConfiguration
,並驅動容器執行作業。
參數 | |
---|---|
context |
IInvocationContext :目前的 IInvocationContext 。 |
config |
IConfiguration :要準備的 IConfiguration 。 |
listener |
ITestInvocationListener :目前的叫用 ITestInvocationListener 。 |
傳回 | |
---|---|
Exception |
如果發生任何錯誤,則傳回例外狀況,否則傳回空值。 |
prepareContext
protected File prepareContext (IInvocationContext context, IConfiguration config)
準備並序列化 IInvocationContext
。
參數 | |
---|---|
context |
IInvocationContext :要準備的 IInvocationContext 。 |
config |
IConfiguration :沙箱的 IConfiguration 。 |
傳回 | |
---|---|
File |
已序列化的 IInvocationContext 。 |
擲回 | |
---|---|
|
IOException |