IInvocationContext

public interface IInvocationContext

com.android.tradefed.invoker.IInvocationContext
Known Indirect Subclasses
InvocationContext Generic implementation of a IInvocationContext


Holds information about the Invocation for the tests to access if needed. Tests should not modify the context contained here so only getters will be available, except for the context attributes for reporting purpose.

Summary

Public methods

abstract void addAllocatedDevice(Map<String, ITestDevice> deviceWithName)

Track a map of configuration device name associated to a ITestDevice.

abstract void addAllocatedDevice(String deviceName, ITestDevice testDevice)

Add a ITestDevice to be tracked by the meta data when the device is allocated.

abstract void addDeviceBuildInfo(String deviceName, IBuildInfo buildinfo)

Add a IBuildInfo to be tracked with the device configuration name.

abstract void addInvocationAttribute(String attributeName, String attributeValue)

Add an Invocation attribute.

abstract MultiMap<String, String> getAttributes()

Returns the map of invocation attributes.

abstract IBuildInfo getBuildInfo(ITestDevice testDevice)

Return the IBuildInfo associated with the ITestDevice

abstract IBuildInfo getBuildInfo(String deviceName)

Return the IBuildInfo associated with the device configuration name provided.

abstract List<IBuildInfo> getBuildInfos()

Return all the IBuildInfo tracked for this invocation.

abstract ITestDevice getDevice(String deviceName)

Return the ITestDevice associated with the device configuration name provided.

abstract Map<ITestDeviceIBuildInfo> getDeviceBuildMap()

Return the map of Device/build info association

abstract ITestDevice getDeviceBySerial(String serial)

Returns the ITestDevice associated with the serial provided.

abstract List<String> getDeviceConfigNames()

Return the list of device config names of the device tracked in this invocation

abstract String getDeviceName(ITestDevice device)

Returns the name of the device set in the xml configuration from the ITestDevice.

abstract List<ITestDevice> getDevices()

Return all the allocated device tracked for this invocation.

abstract int getNumDevicesAllocated()

Return the number of devices allocated for the invocation.

abstract List<String> getSerials()

Return the list of serials of the device tracked in this invocation

abstract String getTestTag()

Returns the invocation test-tag.

abstract void setRecoveryModeForAllDevices(ITestDevice.RecoveryMode mode)

Sets the ITestDevice.RecoveryMode of all the devices part of the context

abstract void setTestTag(String testTag)

Sets the invocation test-tag.

Public methods

addAllocatedDevice

void addAllocatedDevice (Map<String, ITestDevice> deviceWithName)

Track a map of configuration device name associated to a ITestDevice. Doesn't clear the previous tracking before adding.

Parameters
deviceWithName Map: the Map of additional device to track

addAllocatedDevice

void addAllocatedDevice (String deviceName, 
                ITestDevice testDevice)

Add a ITestDevice to be tracked by the meta data when the device is allocated. will set the build info to null in the map.

Parameters
deviceName String: the device configuration name to associate with the ITestDevice
testDevice ITestDevice: to be added to the allocated devices.

addDeviceBuildInfo

void addDeviceBuildInfo (String deviceName, 
                IBuildInfo buildinfo)

Add a IBuildInfo to be tracked with the device configuration name.

Parameters
deviceName String: the device configuration name
buildinfo IBuildInfo: a IBuildInfo associated to the device configuration name.

addInvocationAttribute

void addInvocationAttribute (String attributeName, 
                String attributeValue)

Add an Invocation attribute.

Parameters
attributeName String
attributeValue String

getAttributes

MultiMap<String, String> getAttributes ()

Returns the map of invocation attributes.

Returns
MultiMap<String, String>

getBuildInfo

IBuildInfo getBuildInfo (ITestDevice testDevice)

Return the IBuildInfo associated with the ITestDevice

Parameters
testDevice ITestDevice
Returns
IBuildInfo

getBuildInfo

IBuildInfo getBuildInfo (String deviceName)

Return the IBuildInfo associated with the device configuration name provided.

Parameters
deviceName String
Returns
IBuildInfo

getBuildInfos

List<IBuildInfo> getBuildInfos ()

Return all the IBuildInfo tracked for this invocation.

Returns
List<IBuildInfo>

getDevice

ITestDevice getDevice (String deviceName)

Return the ITestDevice associated with the device configuration name provided.

Parameters
deviceName String
Returns
ITestDevice

getDeviceBuildMap

Map<ITestDeviceIBuildInfo> getDeviceBuildMap ()

Return the map of Device/build info association

Returns
Map<ITestDeviceIBuildInfo>

getDeviceBySerial

ITestDevice getDeviceBySerial (String serial)

Returns the ITestDevice associated with the serial provided. Refrain from using too much as it's not the fastest lookup.

Parameters
serial String
Returns
ITestDevice

getDeviceConfigNames

List<String> getDeviceConfigNames ()

Return the list of device config names of the device tracked in this invocation

Returns
List<String>

getDeviceName

String getDeviceName (ITestDevice device)

Returns the name of the device set in the xml configuration from the ITestDevice. Returns null, if ITestDevice cannot be matched.

Parameters
device ITestDevice
Returns
String

getDevices

List<ITestDevice> getDevices ()

Return all the allocated device tracked for this invocation.

Returns
List<ITestDevice>

getNumDevicesAllocated

int getNumDevicesAllocated ()

Return the number of devices allocated for the invocation.

Returns
int

getSerials

List<String> getSerials ()

Return the list of serials of the device tracked in this invocation

Returns
List<String>

getTestTag

String getTestTag ()

Returns the invocation test-tag.

Returns
String

setRecoveryModeForAllDevices

void setRecoveryModeForAllDevices (ITestDevice.RecoveryMode mode)

Sets the ITestDevice.RecoveryMode of all the devices part of the context

Parameters
mode ITestDevice.RecoveryMode

setTestTag

void setTestTag (String testTag)

Sets the invocation test-tag.

Parameters
testTag String