DynamicRemoteFileResolver

public class DynamicRemoteFileResolver
extends Object

java.lang.Object
   ↳ com.android.tradefed.config.DynamicRemoteFileResolver


這個類別有助於解析遠端檔案的路徑。

舉例來說,系統會從 GCS 值區下載檔案,以解析 gs://bucket/path/file.txt。

新通訊協定應新增至 META_INF/services。

摘要

巢狀類別

interface DynamicRemoteFileResolver.FileResolverLoader

載入 IRemoteFileResolver 的實作項目。 

常數

String OPTIONAL_KEY

String OPTION_NAME_KEY

String OPTION_PARALLEL_KEY

String UNZIP_KEY

公用建構函式

DynamicRemoteFileResolver()
DynamicRemoteFileResolver(boolean allowParallel)
DynamicRemoteFileResolver(DynamicRemoteFileResolver.FileResolverLoader loader)
DynamicRemoteFileResolver(DynamicRemoteFileResolver.FileResolverLoader loader, boolean allowParallel)

公用方法

void addExtraArgs( extraArgs)

Add extra args for the query.

getParallelDownloads()
void resolvePartialDownloadZip(File destDir, String remoteZipFilePath, includeFilters, excludeFilters)

以遠端 ZIP 檔案的形式,下載符合指定篩選條件的檔案。

void setDevice(ITestDevice device)

設定測試中的裝置

void setOptionMap( optionMap)

設定來自 OptionSetter 的選項對應

static final File unzipIfRequired(File downloadedFile, query)

這項公用程式可檢查檔案是否應解壓縮,並在必要時解壓縮。

final validateRemoteFilePath()

執行所有 ERROR(/File) 選項類型,並檢查是否應解析路徑。

常數

OPTIONAL_KEY

public static final String OPTIONAL_KEY

常數值: "optional"

OPTION_NAME_KEY

public static final String OPTION_NAME_KEY

常數值: "option_name"

OPTION_PARALLEL_KEY

public static final String OPTION_PARALLEL_KEY

常數值: "parallel"

UNZIP_KEY

public static final String UNZIP_KEY

常數值: "unzip"

公用建構函式

DynamicRemoteFileResolver

public DynamicRemoteFileResolver ()

DynamicRemoteFileResolver

public DynamicRemoteFileResolver (boolean allowParallel)

參數
allowParallel boolean

DynamicRemoteFileResolver

public DynamicRemoteFileResolver (DynamicRemoteFileResolver.FileResolverLoader loader)

參數
loader DynamicRemoteFileResolver.FileResolverLoader

DynamicRemoteFileResolver

public DynamicRemoteFileResolver (DynamicRemoteFileResolver.FileResolverLoader loader, 
                boolean allowParallel)

參數
loader DynamicRemoteFileResolver.FileResolverLoader

allowParallel boolean

公用方法

addExtraArgs

public void addExtraArgs ( extraArgs)

為查詢新增額外引數。

參數
extraArgs

getParallelDownloads

public  getParallelDownloads ()

傳回

resolvePartialDownloadZip

public void resolvePartialDownloadZip (File destDir, 
                String remoteZipFilePath, 
                 includeFilters, 
                 excludeFilters)

以遠端 ZIP 檔案的形式,下載符合指定篩選條件的檔案。

只有在路徑符合任何包含篩選器,但不符合排除篩選器時,系統才會下載遠端 ZIP 檔案中的檔案。

參數
destDir File:要將下載內容放入的檔案。

remoteZipFilePath String:要下載的 ZIP 檔案的遠端路徑,與實作專屬根目錄相對。

includeFilters :下載相符檔案的規則運算式字串清單。系統會下載符合任何篩選條件的檔案路徑。

excludeFilters :要略過下載相符檔案的 regex 字串清單。如果檔案路徑符合任何篩選條件,系統就不會下載該檔案。

擲回
BuildRetrievalError 如果無法下載檔案。

setDevice

public void setDevice (ITestDevice device)

設定測試中的裝置

參數
device ITestDevice

setOptionMap

public void setOptionMap ( optionMap)

設定來自 OptionSetter 的選項對應

參數
optionMap

unzipIfRequired

public static final File unzipIfRequired (File downloadedFile, 
                 query)

這項公用程式可檢查檔案是否應解壓縮,並視需要解壓縮檔案。

參數
downloadedFile File

query

傳回
File

validateRemoteFilePath

public final  validateRemoteFilePath ()

遍歷所有 ERROR(/File) 選項型別,並檢查是否應解析路徑。

傳回
以這種方式解決的 ERROR(/File) 清單。

擲回
com.android.tradefed.build.BuildRetrievalError
BuildRetrievalError