LaunchControlProvider

public class LaunchControlProvider
extends Object implements IBuildProvider, IConfigurationReceiver, IDiscoverDependencies, IInvocationContextReceiver, ITestLoggerReceiver

java.lang.Object
   ↳ com.google.android.tradefed.build.LaunchControlProvider


一种 IBuildProvider 实现,用于查询 Google 启动控制服务器以获取要测试的 build。

不建议进行子类化。使用 extra-target-downloads 和 --additional-files-filter 指定要下载的制品。

TODO:重构启动控制客户端和下载逻辑,并将其与未来的“One Common Device Flasher Library To Rule Them All”(tm) 合并

摘要

嵌套的类

class LaunchControlProvider.DownloadFileDescriptor

 

常量

String BUILD_ID_PARAM

String BUILD_NAME_PARAM

String LC_BASE_URL

String MIN_BUILD_ID_PARAM

String QUERY_TYPE_PARAM

String QUERY_WINDOW_PARAM

String TEST_TAG_PARAM

字段

protected boolean mEnableResolveSymlinks

公共构造函数

LaunchControlProvider()

公共方法

void addFileFilter(String filter)
void addOptionalFileFilter(String optionalFilter)
void addRemoteZipFilter(String fileFilter)

添加了可部分下载的远程 zip 文件的过滤条件。

void cleanUp(IBuildInfo info)

清理所有临时 build 文件。

void clearExtraDownloads()
IFileDownloader createLaunchControlDownloader(RemoteBuildInfo remoteBuild)

用于创建下载器以用于启动控制文件的工厂方法。

void decrementTestBuild(String buildId)
IBuildInfo fetchRemoteBuild(RemoteBuildInfo remoteBuild)

将启动控制响应转换为包含所有必要文件的本地 IBuildInfo

void forceUseCas(boolean useCas)
Collection<String> getAdditionalFilesFilters()
String getBranch()

获取当前指定的要查询的分支

IBuildInfo getBuild()

检索被测 build 的数据。

String getBuildArchivePath()

获取 build 工件归档的路径

String getBuildFlavor()

获取要查询的 build-flavor

String getBuildId()

获取要查询的 build ID

String getBuildOs()
IConfiguration getConfiguration()

返回正在使用的注入的 IConfiguration

Set<String> getContentBasedReportingDefault()
IInvocationContext getInvocationContext()
String getLcHostname()

获取要在查询中使用的 Launch Control 主机名

String getLcProtocol()

获取要在查询中使用的启动控制协议

QueryType getQueryType()

获取要使用的查询类型

RemoteBuildInfo getRemoteBuild()

获取启动控制响应,而无需下载所有文件。

Set<String> getRemoteZipFilters()

获取一组可部分下载的 ZIP 文件的过滤器。

boolean getReportContentBasedRollout()
boolean getReportContentInformation()
String getTestConfigOnlyZip()

获取仅包含测试的配置 zip。

ITestLogger getTestLogger()
String getTestTag()

获取要在查询中使用的测试标记

boolean getUseSsoClient()

获取是否应使用 SSO 客户端

static void handleExtraTargetDownloads(IBuildInfo build, List<Entry<String, File>> entries)

处理动态下载以回填其元数据的文件

boolean isChunkingUncompressedDisabled()
boolean isSecondaryParallelDownload()

是否启用了并行下载。

Set<String> reportTestZipFileFilter()
void resetTestBuild()

执行 QueryType.RESET_TEST_BUILD 查询,请求启动控制从“已测试 build”集中移除已配置的 build。

void resetTestBuild(String buildId)

执行 QueryType.RESET_TEST_BUILD 查询,请求启动控制从“已测试 build”集中移除给定 build。

void setAdditionalFilesFilters(Collection<String> additionalFilesFilters)
void setBranch(String branch)

设置要查询的分支

void setBuildArchivePath(String buildArchivePath)

设置 build 制品归档的路径

void setBuildFlavor(String flavor)

设置要查询的 build-flavor

void setBuildId(String buildId)

设置要查询的 build ID

void setBuildOs(String os)
void setConfiguration(IConfiguration configuration)

注入正在使用的 IConfiguration

void setContentBasedReportingDefault(Set<String> contentBasedReportingDefault)
void setEnableResolveSymlinks(boolean enableResolveSymlinks)
void setFetchSigned(boolean fetchSigned)
void setInvocationContext(IInvocationContext invocationContext)

void setLcHostname(String lcHostname)

设置要在查询中使用的 Launch Control 主机名

void setLcProtocol(String lcProtocol)

设置要在查询中使用的启动控制协议

void setMinBuildId(int minBuildId)

设置要使用的最小 build ID。

void setParallelSecondaryDownload(boolean parallel)
void setPartialDownloadForZip(boolean enableZipPartialDownload)
void setQueryType(QueryType queryType)

设置要使用的查询类型

void setReportContentBasedRollout(boolean reportContentBasedRollout)
void setReportContentInformation(boolean reportContentInfo)
void setSkipCloudContent(boolean skipCloudContent)
void setTestLogger(ITestLogger testLogger)

注入 ITestLogger 实例

void setTestTag(String tag)

设置要使用的测试标记。

void setUseBuildApi(boolean useBuildApi)

设置用于控制 build 提供程序是否应使用 Android Build API 的值

void setUseSsoClient(boolean useSsoClient)

设置是否应使用 SSO 客户端

boolean shouldFetchSigned()
boolean shouldReportContentInformation()
boolean shouldUseBuildApi()

返回 build 提供方是否应使用 Android Build API

受保护的方法

void convertBuildToSigned(RemoteBuildInfo remoteBuild)

修改此 RemoteBuildInfo 中的参数以描述已签名的 build。

IHttpHelper createHttpHelper()

用于创建 HttpHelper 的工厂方法。

String createSignedParameter(String param)

修改单个形参以表示带符号的形参。如果形参已采用带符号的格式,则会原封不动地返回。

void deleteCacheEntry(String remoteFilePath)

从缓存中移除文件,以防文件损坏。

void downloadAdditionalFiles(RemoteBuildInfo remoteBuild, IFileDownloader downloader, IBuildInfo localBuild)
IBuildInfo downloadBuildFiles(RemoteBuildInfo remoteBuild, String testTargetName, String buildName, IFileDownloader downloader)

remoteBuild 下载在 --download-build-key 中配置的必要文件密钥,并将其存储在 IBuildInfo 中。

final List<Entry<LaunchControlProvider.DownloadFileDescriptor, File>> downloadFilesNonBlocking(IFileDownloader downloader, List<LaunchControlProvider.DownloadFileDescriptor> toBeDownloaded)

下载文件路径集,并在必要时强制执行。

AndroidBuildArtifactHelper getBuildArtifactHelper()
MultiMap<String, File> getExtraDownloadMap()

返回额外下载的目标的映射。

Set<String> getGlobalDownloadExclusionPatterns()
final File getWorkFolder()

返回当前调用工作文件夹。

final File handleDirectoryDownload(File downloadedFile)
RemoteBuildInfo performBuildApiQuery()
void performValidityCheckForBuildApi()
RemoteBuildInfo queryForBuild(MultiMap<String, String> params)

执行启动控制查询,如果出错则多次重试。

RemoteBuildInfo queryForBuild()

执行启动控制查询,如果出错则多次重试。

RemoteBuildInfo queryForBuildWithBuildApi()

针对 build API 执行 build 查询。

void replaceParamWithSigned(RemoteBuildInfo buildInfo, RemoteBuildInfo.BuildAttributeKey key)
boolean useCasDefaultRollout()

常量

BUILD_ID_PARAM

protected static final String BUILD_ID_PARAM

常量值: "bid"

BUILD_NAME_PARAM

protected static final String BUILD_NAME_PARAM

常量值: “id”

LC_BASE_网址

protected static final String LC_BASE_URL

常量值: "%s://%s/buildbot-update"

MIN_BUILD_ID_PARAM

protected static final String MIN_BUILD_ID_PARAM

常量值: “min_build_id”

QUERY_TYPE_PARAM

protected static final String QUERY_TYPE_PARAM

常量值: "op"

QUERY_WINDOW_PARAM

protected static final String QUERY_WINDOW_PARAM

常量值: "query_window"

TEST_TAG_PARAM

protected static final String TEST_TAG_PARAM

常量值: "test_tag"

字段

protected boolean mEnableResolveSymlinks

公共构造函数

LaunchControlProvider

public LaunchControlProvider ()

公共方法

addFileFilter

public void addFileFilter (String filter)

参数
filter String

addOptionalFileFilter

public void addOptionalFileFilter (String optionalFilter)

参数
optionalFilter String

addRemoteZipFilter

public void addRemoteZipFilter (String fileFilter)

添加了可部分下载的远程 ZIP 文件的过滤条件。

参数
fileFilter String

cleanUp

public void cleanUp (IBuildInfo info)

清理所有临时 build 文件。

参数
info IBuildInfo

clearExtraDownloads

public void clearExtraDownloads ()

createLaunchControlDownloader

public IFileDownloader createLaunchControlDownloader (RemoteBuildInfo remoteBuild)

用于创建下载器以用于启动控制文件的工厂方法。

参数
remoteBuild RemoteBuildInfo

返回
IFileDownloader

decrementTestBuild

public void decrementTestBuild (String buildId)

参数
buildId String

fetchRemoteBuild

public IBuildInfo fetchRemoteBuild (RemoteBuildInfo remoteBuild)

将启动控制响应转换为包含所有必要文件的本地 IBuildInfo

设为公开,以便此软件包之外的专业化可以直接使用它。通常应改用 getBuild()

参数
remoteBuild RemoteBuildInfo:启动控制服务器响应

返回
IBuildInfo 填充了 build 文件本地版本的 IBuildInfo

抛出
BuildRetrievalError 如果无法下载 build 文件

forceUseCas

public void forceUseCas (boolean useCas)

参数
useCas boolean

getAdditionalFilesFilters

public Collection<String> getAdditionalFilesFilters ()

返回
Collection<String>

getBranch

public String getBranch ()

获取当前指定的要查询的分支

返回
String 分支

getBuild

public IBuildInfo getBuild ()

检索被测 build 的数据。

返回
IBuildInfo 受测 build 的 IBuildInfo,如果没有可用于测试的 build,则为 null

抛出
BuildRetrievalError

getBuildArchivePath

public String getBuildArchivePath ()

获取 build 工件归档的路径

返回
String

getBuildFlavor

public String getBuildFlavor ()

获取要查询的 build-flavor

返回
String

getBuildId

public String getBuildId ()

获取要查询的 build ID

返回
String

getBuildOs

public String getBuildOs ()

返回
String

getConfiguration

public IConfiguration getConfiguration ()

返回正在使用的注入的 IConfiguration

返回
IConfiguration

getContentBasedReportingDefault

public Set<String> getContentBasedReportingDefault ()

返回
Set<String>

getInvocationContext

public IInvocationContext getInvocationContext ()

返回
IInvocationContext

getLcHostname

public String getLcHostname ()

获取要在查询中使用的 Launch Control 主机名

返回
String

getLcProtocol

public String getLcProtocol ()

获取要在查询中使用的启动控制协议

返回
String

getQueryType

public QueryType getQueryType ()

获取要使用的查询类型

返回
QueryType

getRemoteBuild

public RemoteBuildInfo getRemoteBuild ()

获取启动控制响应,而无需下载所有文件。

设为公开,以便此软件包之外的专业化可以直接使用它。通常应改用 getBuild()

返回
RemoteBuildInfo 来自启动控制的 RemoteBuildInfo 响应

抛出
BuildRetrievalError 如果因发生意外错误而无法检索 build 信息

getRemoteZipFilters

public Set<String> getRemoteZipFilters ()

获取一组可部分下载的 ZIP 文件的过滤器。

返回
Set<String>

getReportContentBasedRollout

public boolean getReportContentBasedRollout ()

返回
boolean

getReportContentInformation

public boolean getReportContentInformation ()

返回
boolean

getTestConfigOnlyZip

public String getTestConfigOnlyZip ()

获取仅包含测试的配置 zip 文件。

返回
String

getTestLogger

public ITestLogger getTestLogger ()

返回
ITestLogger

getTestTag

public String getTestTag ()

获取要在查询中使用的测试标记

返回
String

getUseSsoClient

public boolean getUseSsoClient ()

获取是否应使用 SSO 客户端

返回
boolean

handleExtraTargetDownloads

public static void handleExtraTargetDownloads (IBuildInfo build, 
                List<Entry<String, File>> entries)

处理动态下载以回填其元数据的文件

参数
build IBuildInfo

entries List

抛出
BuildRetrievalError

isChunkingUncompressedDisabled

public boolean isChunkingUncompressedDisabled ()

返回
boolean

isSecondaryParallelDownload

public boolean isSecondaryParallelDownload ()

是否启用了并行下载。

返回
boolean

reportTestZipFileFilter

public Set<String> reportTestZipFileFilter ()

返回
Set<String>

resetTestBuild

public void resetTestBuild ()

执行 QueryType.RESET_TEST_BUILD 查询,请求启动控制从“已测试 build”集中移除已配置的 build。

错误处理和重试机制有限。由于 LCProxy 已停用,因此该类也已弃用。

resetTestBuild

public void resetTestBuild (String buildId)

执行 QueryType.RESET_TEST_BUILD 查询,请求启动控制从“已测试 build”集中移除给定 build。

错误处理和重试机制有限。由于 LCProxy 已停用,因此该类也已弃用。

参数
buildId String:要重置的 build ID

setAdditionalFilesFilters

public void setAdditionalFilesFilters (Collection<String> additionalFilesFilters)

参数
additionalFilesFilters Collection

setBranch

public void setBranch (String branch)

设置要查询的分支

setBuildArchivePath

public void setBuildArchivePath (String buildArchivePath)

设置 build 制品归档的路径

setBuildFlavor

public void setBuildFlavor (String flavor)

设置要查询的 build-flavor

setBuildId

public void setBuildId (String buildId)

设置要查询的 build ID

setBuildOs

public void setBuildOs (String os)

参数
os String

setConfiguration

public void setConfiguration (IConfiguration configuration)

注入正在使用的 IConfiguration

参数
configuration IConfiguration

setContentBasedReportingDefault

public void setContentBasedReportingDefault (Set<String> contentBasedReportingDefault)

参数
contentBasedReportingDefault Set

setEnableResolveSymlinks

public void setEnableResolveSymlinks (boolean enableResolveSymlinks)

参数
enableResolveSymlinks boolean

setFetchSigned

public void setFetchSigned (boolean fetchSigned)

参数
fetchSigned boolean

setInvocationContext

public void setInvocationContext (IInvocationContext invocationContext)

参数
invocationContext IInvocationContext

setLcHostname

public void setLcHostname (String lcHostname)

设置要在查询中使用的 Launch Control 主机名

参数
lcHostname String

setLcProtocol

public void setLcProtocol (String lcProtocol)

设置要在查询中使用的启动控制协议

setMinBuildId

public void setMinBuildId (int minBuildId)

设置要使用的最小 build ID。

参数
minBuildId int

setParallelSecondaryDownload

public void setParallelSecondaryDownload (boolean parallel)

参数
parallel boolean

setPartialDownloadForZip

public void setPartialDownloadForZip (boolean enableZipPartialDownload)

参数
enableZipPartialDownload boolean

setQueryType

public void setQueryType (QueryType queryType)

设置要使用的查询类型

setReportContentBasedRollout

public void setReportContentBasedRollout (boolean reportContentBasedRollout)

参数
reportContentBasedRollout boolean

setReportContentInformation

public void setReportContentInformation (boolean reportContentInfo)

参数
reportContentInfo boolean

setSkipCloudContent

public void setSkipCloudContent (boolean skipCloudContent)

参数
skipCloudContent boolean

setTestLogger

public void setTestLogger (ITestLogger testLogger)

注入 ITestLogger 实例

参数
testLogger ITestLogger

setTestTag

public void setTestTag (String tag)

设置要使用的测试标记。

参数
tag String

setUseBuildApi

public void setUseBuildApi (boolean useBuildApi)

设置用于控制 build 提供程序是否应使用 Android Build API 的值

参数
useBuildApi boolean

setUseSsoClient

public void setUseSsoClient (boolean useSsoClient)

设置是否应使用 SSO 客户端

参数
useSsoClient boolean

shouldFetchSigned

public boolean shouldFetchSigned ()

返回
boolean

shouldReportContentInformation

public boolean shouldReportContentInformation ()

返回
boolean

shouldUseBuildApi

public boolean shouldUseBuildApi ()

返回 build 提供方是否应使用 Android Build API

返回
boolean

受保护的方法

convertBuildToSigned

protected void convertBuildToSigned (RemoteBuildInfo remoteBuild)

修改此 RemoteBuildInfo 中的参数以描述已签名的 build。

参数
remoteBuild RemoteBuildInfo:要修改的 RemoteBuildInfo

抛出
com.android.tradefed.build.BuildRetrievalError
BuildRetrievalError

createHttpHelper

protected IHttpHelper createHttpHelper ()

用于创建 HttpHelper 的工厂方法。

公开,以便在单元测试中进行模拟。

返回
IHttpHelper

createSignedParameter

protected String createSignedParameter (String param)

修改单个形参以表示带符号的形参。如果形参已采用带符号的格式,则返回时不会进行更改。

参数
param String:初始形参(可以是无符号的,也可以是已签名的)

返回
String 已签名参数

抛出
BuildRetrievalError 如果参数格式错误且无法处理

deleteCacheEntry

protected void deleteCacheEntry (String remoteFilePath)

从缓存中移除文件,以防文件损坏。

参数
remoteFilePath String:与 IFileDownloader.downloadFile(String) 中指定的远程文件相同。

downloadAdditionalFiles

protected void downloadAdditionalFiles (RemoteBuildInfo remoteBuild, 
                IFileDownloader downloader, 
                IBuildInfo localBuild)

参数
remoteBuild RemoteBuildInfo

downloader IFileDownloader

localBuild IBuildInfo

抛出
BuildRetrievalError

downloadBuildFiles

protected IBuildInfo downloadBuildFiles (RemoteBuildInfo remoteBuild, 
                String testTargetName, 
                String buildName, 
                IFileDownloader downloader)

remoteBuild 下载在 --download-build-key 中配置的必要文件密钥,并将它们存储在 IBuildInfo 中。

参数
remoteBuild RemoteBuildInfo:启动控制服务器响应

testTargetName String:测试目标名称

buildName String:由启动控制定义的 build 名称

downloader IFileDownloader:用于下载 build 文件的 IFileDownloader

返回
IBuildInfo 填充了 build 文件本地版本的 IBuildInfo

抛出
BuildRetrievalError 如果无法下载 build 文件

downloadFilesNonBlocking

protected final List<Entry<LaunchControlProvider.DownloadFileDescriptor, File>> downloadFilesNonBlocking (IFileDownloader downloader, 
                List<LaunchControlProvider.DownloadFileDescriptor> toBeDownloaded)

下载文件路径集,并在必要时强制执行。

参数
downloader IFileDownloader

toBeDownloaded List

返回
List<Entry<LaunchControlProvider.DownloadFileDescriptor, File>>

抛出
BuildRetrievalError

getBuildArtifactHelper

protected AndroidBuildArtifactHelper getBuildArtifactHelper ()

返回
AndroidBuildArtifactHelper

抛出
BuildRetrievalError

getExtraDownloadMap

protected MultiMap<String, File> getExtraDownloadMap ()

返回额外下载的目标的映射。

返回
MultiMap<String, File>

getGlobalDownloadExclusionPatterns

protected Set<String> getGlobalDownloadExclusionPatterns ()

返回
Set<String>

getWorkFolder

protected final File getWorkFolder ()

返回当前调用工作文件夹。

返回
File

handleDirectoryDownload

protected final File handleDirectoryDownload (File downloadedFile)

参数
downloadedFile File

返回
File

performBuildApiQuery

protected RemoteBuildInfo performBuildApiQuery ()

返回
RemoteBuildInfo

抛出
BuildRetrievalError

针对 build API 执行有效性检查

protected void performValidityCheckForBuildApi ()

queryForBuild

protected RemoteBuildInfo queryForBuild (MultiMap<String, String> params)

执行启动控制查询,如果出错则多次重试。

参数
params MultiMap:用于启动控制的参数

返回
RemoteBuildInfo 从启动控制中检索到的 RemoteBuildInfo

抛出
BuildRetrievalError

queryForBuild

protected RemoteBuildInfo queryForBuild ()

执行启动控制查询,如果出错则多次重试。

返回
RemoteBuildInfo 从启动控制中检索到的 RemoteBuildInfo

抛出
BuildRetrievalError

queryForBuildWithBuildApi

protected RemoteBuildInfo queryForBuildWithBuildApi ()

针对 build API 执行 build 查询。

注意:输入参数由各种类范围变量隐含

返回
RemoteBuildInfo 从响应中解析的 RemoteBuildInfo

抛出
com.android.tradefed.build.BuildRetrievalError
BuildRetrievalError

replaceParamWithSigned

protected void replaceParamWithSigned (RemoteBuildInfo buildInfo, 
                RemoteBuildInfo.BuildAttributeKey key)

参数
buildInfo RemoteBuildInfo

key RemoteBuildInfo.BuildAttributeKey

抛出
BuildRetrievalError

useCasDefaultRollout

protected boolean useCasDefaultRollout ()

返回
boolean