CurrentInvocation

public class CurrentInvocation
extends Object

java.lang.Object
   ↳ com.android.tradefed.invoker.logger.CurrentInvocation


A class that tracks and provides the current invocation information useful anywhere inside the invocation.

Summary

Public methods

static void addInvocationInfo(CurrentInvocation.InvocationInfo key, File value)

Add one key-value to be tracked at the invocation level.

static void clearInvocationInfos()

Clear the invocation info for an invocation.

static FailureDescription createFailure(String errorMessage, ErrorIdentifier errorIdentifier)

Create a failure associated with the invocation action in progress.

static ActionInProgress getActionInProgress()

Returns the current ActionInProgress for the invocation.

static File getInfo(CurrentInvocation.InvocationInfo key)

Returns the Map of invocation metrics for the invocation in progress.

static IInvocationContext getInvocationContext()

Returns the current IInvocationContext for the invocation.

static ExecutionFiles getInvocationFiles()

Returns the ExecutionFiles for the invocation.

static IInvocationContext getModuleContext()

Returns the module IInvocationContext for the current module.

static File getWorkFolder()

Returns the current work folder for the invocation or null if none set yet.

static CurrentInvocation.IsolationGrade moduleCurrentIsolation()

Returns whether the current suite module executed was isolated or not.

static void registerExecutionFiles(ExecutionFiles invocFiles)

One-time registration of the ExecutionFiles.

static void resetLocalGroup()

Resets the localized context.

static CurrentInvocation.IsolationGrade runCurrentIsolation()

Returns whether the current test run executed was isolated or not.

static void setActionInProgress(ActionInProgress action)

Sets the ActionInProgress for the invocation.

static void setInvocationContext(IInvocationContext context)

Sets the IInvocationContext for the invocation.

static void setLocalGroup(ThreadGroup tg)

Tracks a localized context when using the properties inside the gRPC server

static void setModuleContext(IInvocationContext moduleContext)

Sets the module IInvocationContext of the currently running module.

static void setModuleIsolation(CurrentInvocation.IsolationGrade isolation)

Update whether the suite module is isolated or not.

static void setRunIsolation(CurrentInvocation.IsolationGrade isolation)

Update whether the test run is isolated or not.

Public methods

addInvocationInfo

public static void addInvocationInfo (CurrentInvocation.InvocationInfo key, 
                File value)

Add one key-value to be tracked at the invocation level.

Parameters
key CurrentInvocation.InvocationInfo: The key under which the invocation info will be tracked.

value File: The value of the invocation metric.

clearInvocationInfos

public static void clearInvocationInfos ()

Clear the invocation info for an invocation.

createFailure

public static FailureDescription createFailure (String errorMessage, 
                ErrorIdentifier errorIdentifier)

Create a failure associated with the invocation action in progress. Convenience utility to avoid calling FailureDescription#setActionInProgress(ActionInProgress).

Parameters
errorMessage String

errorIdentifier ErrorIdentifier

Returns
FailureDescription

getActionInProgress

public static ActionInProgress getActionInProgress ()

Returns the current ActionInProgress for the invocation. Can be null.

Returns
ActionInProgress

getInfo

public static File getInfo (CurrentInvocation.InvocationInfo key)

Returns the Map of invocation metrics for the invocation in progress.

Parameters
key CurrentInvocation.InvocationInfo

Returns
File

getInvocationContext

public static IInvocationContext getInvocationContext ()

Returns the current IInvocationContext for the invocation. Can be null.

Returns
IInvocationContext

getInvocationFiles

public static ExecutionFiles getInvocationFiles ()

Returns the ExecutionFiles for the invocation.

Returns
ExecutionFiles

getModuleContext

public static IInvocationContext getModuleContext ()

Returns the module IInvocationContext for the current module. Can be null if out of scope of a module run.

Returns
IInvocationContext

getWorkFolder

public static File getWorkFolder ()

Returns the current work folder for the invocation or null if none set yet.

Returns
File

moduleCurrentIsolation

public static CurrentInvocation.IsolationGrade moduleCurrentIsolation ()

Returns whether the current suite module executed was isolated or not.

Returns
CurrentInvocation.IsolationGrade

registerExecutionFiles

public static void registerExecutionFiles (ExecutionFiles invocFiles)

One-time registration of the ExecutionFiles. This is done by the Test Harness.

Parameters
invocFiles ExecutionFiles: The registered ExecutionFiles.

resetLocalGroup

public static void resetLocalGroup ()

Resets the localized context.

runCurrentIsolation

public static CurrentInvocation.IsolationGrade runCurrentIsolation ()

Returns whether the current test run executed was isolated or not.

Returns
CurrentInvocation.IsolationGrade

setActionInProgress

public static void setActionInProgress (ActionInProgress action)

Sets the ActionInProgress for the invocation.

Parameters
action ActionInProgress

setInvocationContext

public static void setInvocationContext (IInvocationContext context)

Sets the IInvocationContext for the invocation.

Parameters
context IInvocationContext

setLocalGroup

public static void setLocalGroup (ThreadGroup tg)

Tracks a localized context when using the properties inside the gRPC server

Parameters
tg ThreadGroup

setModuleContext

public static void setModuleContext (IInvocationContext moduleContext)

Sets the module IInvocationContext of the currently running module.

Parameters
moduleContext IInvocationContext

setModuleIsolation

public static void setModuleIsolation (CurrentInvocation.IsolationGrade isolation)

Update whether the suite module is isolated or not.

Parameters
isolation CurrentInvocation.IsolationGrade

setRunIsolation

public static void setRunIsolation (CurrentInvocation.IsolationGrade isolation)

Update whether the test run is isolated or not.

Parameters
isolation CurrentInvocation.IsolationGrade