BackupDeviceAction


interface BackupDeviceAction

Known direct subclasses
AssertStorageAction

Asserts the correctness of restored test data.

PopulateStorageAction

Populates test data inside the application sandbox before a backup.


Runs an action inside the application sandbox on the target device.

Implementations must provide a public no-arg constructor to enable dynamic instantiation.

An action reads its configuration from BackupDeviceActionArgs, whose documented keys are listed in BackupActionInputKeys, and reports its outcome through BackupDeviceActionResult, whose documented keys are listed in BackupActionOutputKeys. Build the outcome with BackupDeviceActionResult.success or BackupDeviceActionResult.failure so that the host can tell the two apart.

Summary

Constants

const Int

The phase of an action that seeds data in the app's storage before a backup.

const Int

The phase of an action that checks restored data in the app's storage after a restore.

Public functions

BackupDeviceActionResult

Runs the action payload.

Public properties

Int

The phase of a backup and restore test in which this action runs: PHASE_POPULATE for an action that seeds data before a backup, or PHASE_VERIFY for an action that checks restored data after a restore.

Constants

PHASE_POPULATE

Added in 1.0.0-alpha03
const val PHASE_POPULATE = 1: Int

The phase of an action that seeds data in the app's storage before a backup.

PHASE_VERIFY

Added in 1.0.0-alpha03
const val PHASE_VERIFY = 2: Int

The phase of an action that checks restored data in the app's storage after a restore.

Public functions

execute

Added in 1.0.0-alpha03
fun execute(context: Context, args: BackupDeviceActionArgs): BackupDeviceActionResult

Runs the action payload.

Implementations should report a recoverable problem, such as a missing argument or a failed assertion, by returning BackupDeviceActionResult.failure rather than by throwing. The host treats a thrown exception as a crash of the action and reports it with a stack trace.

Parameters
context: Context

application context on the target device

args: BackupDeviceActionArgs

input arguments passed from the host orchestrator, keyed by BackupActionInputKeys

Returns
BackupDeviceActionResult

result returned to the host, keyed by BackupActionOutputKeys

Public properties

phase

Added in 1.0.0-alpha03
val phase: Int

The phase of a backup and restore test in which this action runs: PHASE_POPULATE for an action that seeds data before a backup, or PHASE_VERIFY for an action that checks restored data after a restore.

The phase only describes the action. This library doesn't read it, so it doesn't change when or how the action runs.