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)
新增叫用屬性。 |
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()
傳回裝置/版本資訊關聯的對應表 |
ITestDevice
|
getDeviceBySerial(String serial)
傳回與所提供序列相關聯的 |
|
getDeviceConfigNames()
傳回在這個叫用中追蹤的裝置所屬的裝置設定名稱清單 |
String
|
getDeviceName(ITestDevice device)
從 |
|
getDevices()
傳回為此叫用動作追蹤的所有已指派裝置。 |
String
|
getInvocationId()
|
IInvocationContext
|
getModuleInvocationContext()
在套件執行期間,傳回模組的叫用程序內容。 |
int
|
getNumDevicesAllocated()
傳回為叫用作業分配的裝置數量。 |
|
getSerials()
傳回在這個叫用中追蹤的裝置序號清單 |
|
getShardsSerials()
傳回所有已追蹤序列的 Map,以及分割作業中涉及的分割區。 |
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,以便在裝置分配時由中繼資料追蹤。會將建構資訊設為地圖中的空值。
| 參數 | |
|---|---|
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)新增叫用屬性。
| 參數 | |
|---|---|
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 的區塊索引 |
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,則會傳回空值。
| 參數 | |
|---|---|
deviceName |
String |
| 傳回 | |
|---|---|
IBuildInfo |
|
getBuildInfo
public IBuildInfo getBuildInfo (ITestDevice testDevice)
傳回與 ITestDevice 相關聯的 IBuildInfo
| 參數 | |
|---|---|
testDevice |
ITestDevice |
| 傳回 | |
|---|---|
IBuildInfo |
|
getBuildInfoName
public String getBuildInfoName (IBuildInfo info)
從 IBuildInfo 傳回 XML 設定檔中的裝置組合名稱。如果無法比對 IBuildInfo,就會傳回空值
| 參數 | |
|---|---|
info |
IBuildInfo |
| 傳回 | |
|---|---|
String |
|
getConfigurationDescriptor
public ConfigurationDescriptor getConfigurationDescriptor ()
傳回與啟動叫用作業的測試設定相關聯的描述元
| 傳回 | |
|---|---|
ConfigurationDescriptor |
|
getDevice
public ITestDevice getDevice (String deviceName)
傳回與提供的裝置設定名稱相關聯的 ITestDevice。
| 參數 | |
|---|---|
deviceName |
String |
| 傳回 | |
|---|---|
ITestDevice |
|
getDeviceBuildMap
publicgetDeviceBuildMap ()
傳回裝置/版本資訊關聯的對應表
| 傳回 | |
|---|---|
|
|
getDeviceBySerial
public ITestDevice getDeviceBySerial (String serial)
傳回與所提供序列相關聯的 ITestDevice。請勿過度使用,因為這不是最快的查詢方式。
| 參數 | |
|---|---|
serial |
String |
| 傳回 | |
|---|---|
ITestDevice |
|
getDeviceConfigNames
publicgetDeviceConfigNames ()
傳回在這個呼叫中追蹤的裝置所屬的裝置設定名稱清單
| 傳回 | |
|---|---|
|
|
getDeviceName
public String getDeviceName (ITestDevice device)
從 ITestDevice 傳回 XML 設定檔中裝置組合的名稱。如果無法比對 ITestDevice,則會傳回空值。
| 參數 | |
|---|---|
device |
ITestDevice |
| 傳回 | |
|---|---|
String |
|
getDevices
publicgetDevices ()
傳回為此叫用動作追蹤的所有已分配裝置。
| 傳回 | |
|---|---|
|
|
getInvocationId
public String getInvocationId ()
| 傳回 | |
|---|---|
String |
|
getModuleInvocationContext
public IInvocationContext getModuleInvocationContext ()
在套件執行期間,傳回模組的叫用程序內容。
| 傳回 | |
|---|---|
IInvocationContext |
|
getNumDevicesAllocated
public int getNumDevicesAllocated ()
傳回為叫用作業分配的裝置數量。
| 傳回 | |
|---|---|
int |
|
getSerials
publicgetSerials ()
傳回在這個叫用中追蹤的裝置序號清單
| 傳回 | |
|---|---|
|
|
getShardsSerials
publicgetShardsSerials ()
傳回所有已追蹤序列的 Map,以及分割作業中涉及的分割區。如果不是分割的叫用,則為空白。
| 傳回 | |
|---|---|
|
|
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 |
|