Client

public final class Client
extends Object implements ITestStorageClient

java.lang.Object
   ↳ com.google.android.tradefed.result.teststorage.Client


Android Test storage client that uploads test results to the Test Storage service.

Summary

Public methods

static ITestStorageClient create(String buildEnvironment, boolean useLegacyMigration, boolean enableUploadThread, boolean useBatchApi, int maxBatchSize, int insertBatchSize)
static ITestStorageClient create(Androidbuildinternal client)
static ITestStorageClient create(String buildEnvironment, boolean useLegacyMigration, boolean enableUploadThread, boolean useBatchApi)
static ITestStorageClient create(String buildEnvironment, boolean useLegacyMigration, boolean useBatchApi)
Invocation createInvocation(Invocation invocation)

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

Build createLocalBuild(Build localBuild)

See go/local_build_guide for details.

WorkUnit createWorkUnit(WorkUnit workUnit)

Creates a work unit in Test Storage.

ImmutableList<WorkUnit> createWorkUnits( workUnits)

Creates all work units in a provided list in TestStorage.

File fetchTestArtifact(String invocationId, String resourceId)

Fetches and return the actually test artifact file requested.

void finalizeTestResults()

Waits until all test results are uploaded.

Invocation getInvocation(String invocationId)

Returns an invocation that has the provided invocation id.

BuildArtifactMetadata getTestArtifact(String invocationId, String resourceId)

Returns a test artifact matching provided invocation and resource id.

WorkUnit getWorkUnit(String workUnitId)

Returns a workunit matching the provided id.

TestArtifactListResponse listTestArtifact(String invocationId, String artifactType)

Searches and list all test artifacts matching the type provided.

Invocation updateInvocation(Invocation invocation)

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

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

Updates the provided artifact.

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

Updates the provided artifact and uploads provided content.

WorkUnit updateWorkUnit(WorkUnit workUnit)

Updates a provided work unit in Test Storage.

void uploadAssociations( associations, int poolSize)

Uploads associations between logs and tests/work units.

void uploadResult(TestResult result)

Upload provided test result to Test Storage.

Public methods

create

public static ITestStorageClient create (String buildEnvironment, 
                boolean useLegacyMigration, 
                boolean enableUploadThread, 
                boolean useBatchApi, 
                int maxBatchSize, 
                int insertBatchSize)

Parameters
buildEnvironment String

useLegacyMigration boolean

enableUploadThread boolean

useBatchApi boolean

maxBatchSize int

insertBatchSize int

Returns
ITestStorageClient

create

public static ITestStorageClient create (Androidbuildinternal client)

Parameters
client Androidbuildinternal

Returns
ITestStorageClient

create

public static ITestStorageClient create (String buildEnvironment, 
                boolean useLegacyMigration, 
                boolean enableUploadThread, 
                boolean useBatchApi)

Parameters
buildEnvironment String

useLegacyMigration boolean

enableUploadThread boolean

useBatchApi boolean

Returns
ITestStorageClient

create

public static ITestStorageClient create (String buildEnvironment, 
                boolean useLegacyMigration, 
                boolean useBatchApi)

Parameters
buildEnvironment String

useLegacyMigration boolean

useBatchApi boolean

Returns
ITestStorageClient

createInvocation

public 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.

createLocalBuild

public Build createLocalBuild (Build localBuild)

See go/local_build_guide for details.

Parameters
localBuild Build: description of the local build

Returns
Build a Build

createWorkUnit

public 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.

createWorkUnits

public 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.

fetchTestArtifact

public File fetchTestArtifact (String invocationId, 
                String resourceId)

Fetches and return the actually test artifact file requested.

Parameters
invocationId String

resourceId String

Returns
File

finalizeTestResults

public void finalizeTestResults ()

Waits until all test results are uploaded.

getInvocation

public Invocation getInvocation (String invocationId)

Returns an invocation that has the provided invocation id.

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

Returns
Invocation

getTestArtifact

public 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 WorkUnit getWorkUnit (String workUnitId)

Returns a workunit matching the provided id.

Parameters
workUnitId String: - id of the work unit.

Returns
WorkUnit

listTestArtifact

public 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 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.

updateTestArtifact

public 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 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 WorkUnit updateWorkUnit (WorkUnit workUnit)

Updates a provided work unit in Test Storage.

Parameters
workUnit WorkUnit: - work unit to update.

Returns
WorkUnit updated work unit.

uploadAssociations

public 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.

uploadResult

public 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.