InvocationContext
public
class
InvocationContext
extends Object
implements
IInvocationContext
| java.lang.Object | |
| ↳ | com.android.tradefed.invoker.InvocationContext |
IInvocationContext 的通用实现。
摘要
公共构造函数 | |
|---|---|
InvocationContext()
使用默认属性值创建 |
|
公共方法 | |
|---|---|
void
|
addAllocatedDevice(
跟踪与 |
void
|
addAllocatedDevice(String devicename, ITestDevice testDevice)
添加一个 ITestDevice,以便在分配设备时由元数据跟踪。 |
void
|
addDeviceBuildInfo(String deviceName, IBuildInfo buildinfo)
添加要使用设备配置名称跟踪的 |
void
|
addInvocationAttribute(String attributeName, String attributeValue)
添加 Invocation 属性。 |
void
|
addInvocationAttributes(MultiMap<String, String> attributesMap)
通过 |
void
|
addSerialsFromShard(Integer index,
添加一个序列,以便跟踪分配给运行某些测试的分片之一。 |
static
InvocationContext
|
fromProto(InvocationContext.Context protoContext)
对 |
MultiMap<String, String>
|
getAttributes()
返回包含所有调用属性的映射的副本。 |
IBuildInfo
|
getBuildInfo(String deviceName)
返回与所提供的设备配置名称关联的 |
IBuildInfo
|
getBuildInfo(ITestDevice testDevice)
返回与 |
String
|
getBuildInfoName(IBuildInfo info)
从 |
|
getBuildInfos()
返回为此调用跟踪的所有 |
ConfigurationDescriptor
|
getConfigurationDescriptor()
返回与启动调用的测试配置相关联的描述符 |
ITestDevice
|
getDevice(String deviceName)
返回与所提供的设备配置名称关联的 |
|
getDeviceBuildMap()
返回设备/build 信息关联的映射 |
ITestDevice
|
getDeviceBySerial(String serial)
返回与所提供的序列号关联的 |
|
getDeviceConfigNames()
返回在此调用中跟踪的设备的设备配置名称列表 |
String
|
getDeviceName(ITestDevice device)
从 |
|
getDevices()
返回为此调用跟踪的所有已分配设备。 |
String
|
getInvocationId()
|
IInvocationContext
|
getModuleInvocationContext()
返回模块在作为套件一部分执行时的调用上下文。 |
int
|
getNumDevicesAllocated()
返回为调用分配的设备数量。 |
|
getSerials()
返回在此调用中跟踪的设备的序列号列表 |
|
getShardsSerials()
返回所有已跟踪的序列及其参与分片的分片的映射。 |
String
|
getTestTag()
返回调用测试标记。 |
static
boolean
|
isOnDemand(IInvocationContext context)
返回我们是否根据触发器类型检测了按需测试调用。 |
static
boolean
|
isPresubmit(IInvocationContext context)
返回我们是否根据触发器类型检测预提交内容。 |
void
|
lockAttributes()
锁定上下文以防止添加更多调用属性。 |
void
|
logInvocationMetrics()
将 |
void
|
markReleasedEarly()
标记即将发布的设备。 |
void
|
setConfigurationDescriptor(ConfigurationDescriptor configurationDescriptor)
设置与启动调用的测试配置关联的描述符 |
void
|
setModuleInvocationContext(IInvocationContext invocationContext)
在作为套件的一部分执行时,设置模块的调用上下文。 |
void
|
setRecoveryModeForAllDevices(ITestDevice.RecoveryMode mode)
设置上下文中所有设备的 |
void
|
setTestTag(String testTag)
设置调用测试标记。 |
InvocationContext.Context
|
toProto()
将上下文实例序列化为 protobuf。 |
boolean
|
wasReleasedEarly()
返回设备是否为提前发布且不会再使用。 |
公共构造函数
公共方法
addAllocatedDevice
public void addAllocatedDevice (deviceWithName)
跟踪与 ITestDevice 关联的配置设备名称的映射。在添加之前不会清除之前的跟踪。
| 参数 | |
|---|---|
deviceWithName |
:要跟踪的其他设备的 ERROR(/Map) |
addAllocatedDevice
public void addAllocatedDevice (String devicename,
ITestDevice testDevice)添加一个 ITestDevice,以便在分配设备时由元数据跟踪。 将在映射中将 build 信息设置为 null。
| 参数 | |
|---|---|
devicename |
String:要与 ITestDevice 关联的设备配置名称 |
testDevice |
ITestDevice:要添加到分配的设备。 |
addDeviceBuildInfo
public void addDeviceBuildInfo (String deviceName,
IBuildInfo buildinfo)添加要使用设备配置名称跟踪的 IBuildInfo。
| 参数 | |
|---|---|
deviceName |
String:设备配置名称 |
buildinfo |
IBuildInfo:与设备配置名称关联的 IBuildInfo。 |
addInvocationAttribute
public void addInvocationAttribute (String attributeName,
String attributeValue)添加 Invocation 属性。
| 参数 | |
|---|---|
attributeName |
String |
attributeValue |
String |
addInvocationAttributes
public void addInvocationAttributes (MultiMap<String, String> attributesMap)
通过 UniqueMultiMap 一次添加多个调用属性。
| 参数 | |
|---|---|
attributesMap |
MultiMap |
addSerialsFromShard
public void addSerialsFromShard (Integer index,
serials) 添加一个序列,以便跟踪分配给运行某些测试的分片之一。
| 参数 | |
|---|---|
index |
Integer:使用序列号的分片的索引 |
serials |
:要跟踪的连续剧列表。 |
fromProto
public static InvocationContext fromProto (InvocationContext.Context protoContext)
对 InvocationContext.toProto() 执行反向操作以恢复实例。
| 参数 | |
|---|---|
protoContext |
InvocationContext.Context |
| 返回 | |
|---|---|
InvocationContext |
|
getAttributes
public MultiMap<String, String> getAttributes ()
返回包含所有调用属性的映射的副本。
| 返回 | |
|---|---|
MultiMap<String, String> |
|
getBuildInfo
public IBuildInfo getBuildInfo (String deviceName)
返回与所提供的设备配置名称关联的 IBuildInfo。如果无法匹配 deviceName,则返回 null。
| 参数 | |
|---|---|
deviceName |
String |
| 返回 | |
|---|---|
IBuildInfo |
|
getBuildInfo
public IBuildInfo getBuildInfo (ITestDevice testDevice)
返回与 ITestDevice 关联的 IBuildInfo
| 参数 | |
|---|---|
testDevice |
ITestDevice |
| 返回 | |
|---|---|
IBuildInfo |
|
getBuildInfoName
public String getBuildInfoName (IBuildInfo info)
从 IBuildInfo 返回在 xml 配置中设置的设备名称。如果无法匹配 IBuildInfo,则返回 null
| 参数 | |
|---|---|
info |
IBuildInfo |
| 返回 | |
|---|---|
String |
|
getConfigurationDescriptor
public ConfigurationDescriptor getConfigurationDescriptor ()
返回与启动调用的测试配置关联的描述符
| 返回 | |
|---|---|
ConfigurationDescriptor |
|
getDevice
public ITestDevice getDevice (String deviceName)
返回与所提供的设备配置名称关联的 ITestDevice。
| 参数 | |
|---|---|
deviceName |
String |
| 返回 | |
|---|---|
ITestDevice |
|
getDeviceBuildMap
publicgetDeviceBuildMap ()
返回设备/build 信息关联的映射
| 返回 | |
|---|---|
|
|
getDeviceBySerial
public ITestDevice getDeviceBySerial (String serial)
返回与所提供的序列号关联的 ITestDevice。请勿过多使用此方法,因为它不是最快的查找方法。
| 参数 | |
|---|---|
serial |
String |
| 返回 | |
|---|---|
ITestDevice |
|
getDeviceConfigNames
publicgetDeviceConfigNames ()
返回在此调用中跟踪的设备的设备配置名称列表
| 返回 | |
|---|---|
|
|
getDeviceName
public String getDeviceName (ITestDevice device)
从 ITestDevice 返回在 xml 配置中设置的设备的名称。
如果无法匹配 ITestDevice,则返回 null。
| 参数 | |
|---|---|
device |
ITestDevice |
| 返回 | |
|---|---|
String |
|
getDevices
publicgetDevices ()
返回为此调用跟踪的所有已分配设备。
| 返回 | |
|---|---|
|
|
getInvocationId
public String getInvocationId ()
| 返回 | |
|---|---|
String |
|
getModuleInvocationContext
public IInvocationContext getModuleInvocationContext ()
返回模块在作为套件一部分执行时的调用上下文。
| 返回 | |
|---|---|
IInvocationContext |
|
getNumDevicesAllocated
public int getNumDevicesAllocated ()
返回为调用分配的设备数量。
| 返回 | |
|---|---|
int |
|
getSerials
publicgetSerials ()
返回在此调用中跟踪的设备的序列号列表
| 返回 | |
|---|---|
|
|
getShardsSerials
publicgetShardsSerials ()
返回所有跟踪的序列及其参与分片的分片的映射。如果不是分片调用,则为空。
| 返回 | |
|---|---|
|
|
getTestTag
public String getTestTag ()
返回调用测试标记。
| 返回 | |
|---|---|
String |
|
isOnDemand
public static boolean isOnDemand (IInvocationContext context)
返回我们是否根据触发器类型检测了按需测试调用。
| 参数 | |
|---|---|
context |
IInvocationContext |
| 返回 | |
|---|---|
boolean |
|
isPresubmit
public static boolean isPresubmit (IInvocationContext context)
返回我们是否根据触发器类型检测预提交。
| 参数 | |
|---|---|
context |
IInvocationContext |
| 返回 | |
|---|---|
boolean |
|
lockAttributes
public void lockAttributes ()
锁定上下文,以防止添加更多调用属性。
markReleasedEarly
public void markReleasedEarly ()
标记即将发布的设备。
setConfigurationDescriptor
public void setConfigurationDescriptor (ConfigurationDescriptor configurationDescriptor)
设置与启动调用的测试配置关联的描述符
| 参数 | |
|---|---|
configurationDescriptor |
ConfigurationDescriptor |
setModuleInvocationContext
public void setModuleInvocationContext (IInvocationContext invocationContext)
在作为套件的一部分执行时,设置模块的调用上下文。
| 参数 | |
|---|---|
invocationContext |
IInvocationContext |
setRecoveryModeForAllDevices
public void setRecoveryModeForAllDevices (ITestDevice.RecoveryMode mode)
设置上下文中所有设备的 RecoveryMode
| 参数 | |
|---|---|
mode |
ITestDevice.RecoveryMode |
setTestTag
public void setTestTag (String testTag)
设置调用测试标记。
| 参数 | |
|---|---|
testTag |
String |
toProto
public InvocationContext.Context toProto ()
将上下文实例序列化为 protobuf。
| 返回 | |
|---|---|
InvocationContext.Context |
|
wasReleasedEarly
public boolean wasReleasedEarly ()
返回设备是否为提前发布且不会再使用。
| 返回 | |
|---|---|
boolean |
|