AndroidBuildApiLogSaver

public class AndroidBuildApiLogSaver
extends Object implements ILogSaver

java.lang.Object
   ↳ com.google.android.tradefed.result.AndroidBuildApiLogSaver


A class that saves log files to the Android Build API.

Summary

Public constructors

AndroidBuildApiLogSaver()

Public methods

LogFile getLogReportDir()

Get the LogFile containing the path and/or URL of the directory where logs are saved.

void init(IInvocationContext context)

Early notification of initialization, before any build information are available.

void invocationEnded(long elapsedTime)

Reports that the invocation has terminated, whether successfully or due to some error condition.

void invocationStarted(IInvocationContext context)

Reports the start of the test invocation.

LogFile saveLogData(String dataName, LogDataType dataType, InputStream dataStream)

Save the log data.

LogFile saveLogFile(String dataName, LogDataType dataType, File fileToLog)

Save the log file.

Protected methods

IInvocationContext getInvocationContext()
void runUpdate(Androidbuildinternal client, String filePath, String resourceId, String md5, FileContent fileContent, LogDataType type, String contentType)

Public constructors

AndroidBuildApiLogSaver

public AndroidBuildApiLogSaver ()

Public methods

getLogReportDir

public LogFile getLogReportDir ()

Get the LogFile containing the path and/or URL of the directory where logs are saved.

Returns
LogFile The LogFile.

init

public void init (IInvocationContext context)

Early notification of initialization, before any build information are available. This allows to setup any requirements to receive logs.

Parameters
context IInvocationContext: information about the invocation.

invocationEnded

public void invocationEnded (long elapsedTime)

Reports that the invocation has terminated, whether successfully or due to some error condition.

Will be automatically called by the TradeFederation framework after ITestInvocationListener.invocationEnded(long) is called.

Parameters
elapsedTime long: the elapsed time of the invocation in ms

invocationStarted

public void invocationStarted (IInvocationContext context)

Reports the start of the test invocation.

Will be automatically called by the TradeFederation framework before ITestInvocationListener.invocationStarted(IInvocationContext) is called.

Parameters
context IInvocationContext: information about the invocation.

saveLogData

public LogFile saveLogData (String dataName, 
                LogDataType dataType, 
                InputStream dataStream)

Save the log data.

Will be automatically called by the TradeFederation framework whenever ITestLogger.testLog(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource) is called. It may also be used as a helper method to save additional log data.

Depending on the implementation and policy, the logs may be saved in a compressed form. Logs may also be stored in a location inaccessible to Tradefed.

Parameters
dataName String: a String descriptive name of the data. e.g. "device_logcat"

dataType LogDataType: the LogDataType of the file.

dataStream InputStream: the ERROR(/InputStream) of the data.

Returns
LogFile the LogFile containing the path and URL of the saved file.

saveLogFile

public LogFile saveLogFile (String dataName, 
                LogDataType dataType, 
                File fileToLog)

Save the log file.

Will be automatically called by the TradeFederation framework whenever ITestLogger.testLog(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource) is called and the stream references a file.

Depending on the implementation and policy, the logs may be saved in a compressed form. Logs may also be stored in a location inaccessible to Tradefed.

Parameters
dataName String: a String descriptive name of the data. e.g. "device_logcat"

dataType LogDataType: the LogDataType of the file.

fileToLog File: the ERROR(/File) to save.

Returns
LogFile the LogFile containing the path and URL of the saved file.

Protected methods

getInvocationContext

protected IInvocationContext getInvocationContext ()

Returns
IInvocationContext

runUpdate

protected void runUpdate (Androidbuildinternal client, 
                String filePath, 
                String resourceId, 
                String md5, 
                FileContent fileContent, 
                LogDataType type, 
                String contentType)

Parameters
client Androidbuildinternal

filePath String

resourceId String

md5 String

fileContent FileContent

type LogDataType

contentType String