TradefedSandbox
public
class
TradefedSandbox
extends Object
implements
ISandbox
| java.lang.Object | |
| ↳ | com.android.tradefed.sandbox.TradefedSandbox |
可執行 Trade Federation 呼叫的沙箱容器。TODO:允許將選項傳遞至沙箱。
摘要
常數 | |
|---|---|
String |
EXTRA_TARGET_LAB
|
String |
GENERAL_TESTS_ZIP
|
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)
根據測試設定名稱,比對 Sandbox 的額外建構目標中的額外建構目標。 |
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
常數值: "lab"
GENERAL_TESTS_ZIP
public static final String GENERAL_TESTS_ZIP
常數值: "general-tests.zip"
SANDBOX_ENABLED
public static final String SANDBOX_ENABLED
常數值: "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 |
要使用的類別路徑。 |
| 擲回 | |
|---|---|
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)
根據測試設定名稱,比對 Sandbox 的額外建構目標。
| 參數 | |
|---|---|
configName |
String |
| 傳回 | |
|---|---|
|
|
prepareEnvironment
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。 |
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 |
如果發生任何問題,則為 Exception,否則為空值。 |
prepareContext
protected File prepareContext (IInvocationContext context, IConfiguration config)
準備並序列化 IInvocationContext。
| 參數 | |
|---|---|
context |
IInvocationContext:要準備的 IInvocationContext。 |
config |
IConfiguration:沙箱的 IConfiguration。 |
| 傳回 | |
|---|---|
File |
序列化 IInvocationContext。 |
| 擲回 | |
|---|---|
|
IOException |