InvocationContext

public class InvocationContext
extends Object implements IInvocationContext

java.lang.Object
   ↳ com.android.tradefed.invoker.InvocationContext


Generic implementation of a IInvocationContext.

Summary

Public constructors

InvocationContext()

Creates a BuildInfo using default attribute values.

Public methods

void addAllocatedDevice(Map<String, ITestDevice> deviceWithName)

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

void addAllocatedDevice(String devicename, ITestDevice testDevice)

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

void addDeviceBuildInfo(String deviceName, IBuildInfo buildinfo)

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

void addInvocationAttribute(String attributeName, String attributeValue)

Add an Invocation attribute.

MultiMap<String, String> getAttributes()

Returns the map of invocation attributes.

IBuildInfo getBuildInfo(ITestDevice testDevice)

Return the IBuildInfo associated with the ITestDevice

IBuildInfo getBuildInfo(String deviceName)

Return the IBuildInfo associated with the device configuration name provided.

List<IBuildInfo> getBuildInfos()

Return all the IBuildInfo tracked for this invocation.

ITestDevice getDevice(String deviceName)

Return the ITestDevice associated with the device configuration name provided.

Map<ITestDeviceIBuildInfo> getDeviceBuildMap()

Return the map of Device/build info association

ITestDevice getDeviceBySerial(String serial)

Returns the ITestDevice associated with the serial provided.

List<String> getDeviceConfigNames()

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

String getDeviceName(ITestDevice device)

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

List<ITestDevice> getDevices()

Return all the allocated device tracked for this invocation.

int getNumDevicesAllocated()

Return the number of devices allocated for the invocation.

List<String> getSerials()

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

String getTestTag()

Returns the invocation test-tag.

void setRecoveryModeForAllDevices(ITestDevice.RecoveryMode mode)

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

void setTestTag(String testTag)

Sets the invocation test-tag.

Public constructors

InvocationContext

InvocationContext ()

Creates a BuildInfo using default attribute values.

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