ITestStorageClient

public interface ITestStorageClient

com.google.android.tradefed.result.teststorage.ITestStorageClient


Interface for communicating with Android Test Storage backend. The interface contains methods to create and update invocations and work units and upload test results. In order to create or update work units or test results, they must belong to an invocation that was either created by this client or the invocation must be added using addInvocation method.

Summary

Public methods

abstract Invocation createInvocation(Invocation invocation)

Creates an invocation in Test Storage using the data in the provided invocation.

abstract Build createLocalBuild(Build localBuild)

Insert a local build in the backend.

abstract WorkUnit createWorkUnit(WorkUnit workUnit)

Creates a work unit in Test Storage.

abstract ImmutableList<WorkUnit> createWorkUnits( workUnits)

Creates all work units in a provided list in TestStorage.

abstract File fetchTestArtifact(String invocationId, String resourceId)

Fetches and return the actually test artifact file requested.

abstract void finalizeTestResults()

Waits until all test results are uploaded.

abstract Invocation getInvocation(String invocationId)

Returns an invocation that has the provided invocation id.

abstract BuildArtifactMetadata getTestArtifact(String invocationId, String resourceId)

Returns a test artifact matching provided invocation and resource id.

abstract WorkUnit getWorkUnit(String workUnitId)

Returns a workunit matching the provided id.

abstract TestArtifactListResponse listTestArtifact(String invocationId, String artifactType)

Searches and list all test artifacts matching the type provided.

abstract Invocation updateInvocation(Invocation invocation)

Updates an invocation in Test Storage using the data in the provided invocation.

abstract BuildArtifactMetadata updateTestArtifact(String invocationId, String workUnitId, String testResultId, BuildArtifactMetadata artifact, long legacyId)

Updates the provided artifact.

abstract BuildArtifactMetadata updateTestArtifact(BuildArtifactMetadata artifact, long legacyId, AbstractInputStreamContent content)

Updates the provided artifact and uploads provided content.

abstract WorkUnit updateWorkUnit(WorkUnit workUnit)

Updates a provided work unit in Test Storage.

abstract void uploadAssociations( associations, int poolSize)

Uploads associations between logs and tests/work units.

abstract void uploadResult(TestResult result)

Upload provided test result to Test Storage.

Public methods

createInvocation

public abstract Invocation createInvocation (Invocation invocation)

Creates an invocation in Test Storage using the data in the provided invocation.

Parameters
invocation Invocation: - describes the invocation to be created.

Returns
Invocation invocation that was created in Test Storage.

Throws
IOException

createLocalBuild

public abstract Build createLocalBuild (Build localBuild)

Insert a local build in the backend.

Parameters
localBuild Build: description of the local build

Returns
Build a Build

Throws
IOException

createWorkUnit

public abstract WorkUnit createWorkUnit (WorkUnit workUnit)

Creates a work unit in Test Storage.

Parameters
workUnit WorkUnit: - describes the work unit to create.

Returns
WorkUnit a new work unit.

Throws
IOException

createWorkUnits

public abstract ImmutableList<WorkUnit> createWorkUnits ( workUnits)

Creates all work units in a provided list in TestStorage.

Parameters
workUnits : - list of work units to create.

Returns
ImmutableList<WorkUnit> a list of workunits that were created.

Throws
IOException

fetchTestArtifact

public abstract File fetchTestArtifact (String invocationId, 
                String resourceId)

Fetches and return the actually test artifact file requested.

Parameters
invocationId String

resourceId String

Returns
File

finalizeTestResults

public abstract void finalizeTestResults ()

Waits until all test results are uploaded.

getInvocation

public abstract Invocation getInvocation (String invocationId)

Returns an invocation that has the provided invocation id.

Parameters
invocationId String: - id of the invocation to return.

Returns
Invocation

Throws
- if the provided invocation is not found or if there is an error communicating with the back end.

getTestArtifact

public abstract BuildArtifactMetadata getTestArtifact (String invocationId, 
                String resourceId)

Returns a test artifact matching provided invocation and resource id.

Parameters
invocationId String

resourceId String

Returns
BuildArtifactMetadata

getWorkUnit

public abstract WorkUnit getWorkUnit (String workUnitId)

Returns a workunit matching the provided id.

Parameters
workUnitId String: - id of the work unit.

Returns
WorkUnit

Throws
- if the provided work unit is not found or there is an error communicating with backend services.

listTestArtifact

public abstract TestArtifactListResponse listTestArtifact (String invocationId, 
                String artifactType)

Searches and list all test artifacts matching the type provided.

Parameters
invocationId String

artifactType String

Returns
TestArtifactListResponse

updateInvocation

public abstract Invocation updateInvocation (Invocation invocation)

Updates an invocation in Test Storage using the data in the provided invocation.

Parameters
invocation Invocation: - invocation with updated data.

Returns
Invocation an updated invocation.

Throws
IOException

updateTestArtifact

public abstract BuildArtifactMetadata updateTestArtifact (String invocationId, 
                String workUnitId, 
                String testResultId, 
                BuildArtifactMetadata artifact, 
                long legacyId)

Updates the provided artifact. This method only updates the association and does not modify the content. When calling this method provide the original invocation id, work unit id, and test result id as the arguments. Put the new work unit, and test result id in the BuildArtifactMetadata object. When work unit id and/or test resutlt as not used in the association they should be set to empty string ("").

Parameters
invocationId String

workUnitId String

testResultId String

artifact BuildArtifactMetadata

legacyId long

Returns
BuildArtifactMetadata

updateTestArtifact

public abstract BuildArtifactMetadata updateTestArtifact (BuildArtifactMetadata artifact, 
                long legacyId, 
                AbstractInputStreamContent content)

Updates the provided artifact and uploads provided content. When uploading content, it is not possible to update association data. Do not modify the work unit id and test result id already set in the BuildArtifactMetadata argument.

Parameters
artifact BuildArtifactMetadata

legacyId long

content AbstractInputStreamContent

Returns
BuildArtifactMetadata

updateWorkUnit

public abstract WorkUnit updateWorkUnit (WorkUnit workUnit)

Updates a provided work unit in Test Storage.

Parameters
workUnit WorkUnit: - work unit to update.

Returns
WorkUnit updated work unit.

Throws
IOException

uploadAssociations

public abstract void uploadAssociations ( associations, 
                int poolSize)

Uploads associations between logs and tests/work units. Associations allow Android Test Storage to keep track of which test produced a log.

Parameters
associations : a list of log files and their associations.

poolSize int: The size of the worker pool used to parallel upload. 0 for no parallel upload.

Throws
IOException

uploadResult

public abstract void uploadResult (TestResult result)

Upload provided test result to Test Storage. Test result must be part of a previously created invocation.

Parameters
result TestResult: - result to upload.

Throws
IOException