AndroidBuildApiLogSaver

public class AndroidBuildApiLogSaver
extends Object implements ILogSaver

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


這個類別會將記錄檔儲存至 Android Build API。

摘要

公用建構函式

AndroidBuildApiLogSaver()

公用方法

LogFile getLogReportDir()

取得 LogFile,其中包含儲存記錄的目錄路徑和/或網址。

void init(IInvocationContext context)

在提供任何建構資訊之前,先通知初始化作業。

void invocationEnded(long elapsedTime)

回報是否因某種錯誤狀況而終止呼叫 (無論是否成功)。

void invocationStarted(IInvocationContext context)

Reports the start of the test invocation.

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

儲存記錄資料。

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

儲存記錄檔。

受保護的方法

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

公用建構函式

AndroidBuildApiLogSaver

public AndroidBuildApiLogSaver ()

公用方法

getLogReportDir

public LogFile getLogReportDir ()

取得 LogFile,其中包含記錄儲存目錄的路徑和/或網址。

傳回
LogFile LogFile

init

public void init (IInvocationContext context)

在提供任何建構資訊之前,先發送初始化通知。這可讓您設定接收記錄的任何需求。

參數
context IInvocationContext:呼叫相關資訊。

invocationEnded

public void invocationEnded (long elapsedTime)

回報是否因某種錯誤情況而終止呼叫 (無論是否成功)。

在呼叫 ITestInvocationListener.invocationEnded(long) 後,TradeFederation 架構會自動呼叫這個方法。

參數
elapsedTime long:以毫秒為單位的呼叫經過時間

invocationStarted

public void invocationStarted (IInvocationContext context)

回報測試呼叫的開始時間。

TradeFederation 架構會在呼叫 ITestInvocationListener.invocationStarted(IInvocationContext) 之前自動呼叫這個方法。

參數
context IInvocationContext:呼叫相關資訊。

saveLogData

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

儲存記錄資料。

每當呼叫 ITestInvocationListener.testLog(String,LogDataType,InputStreamSource) 時,TradeFederation 架構就會自動呼叫這個方法。這個方法也可用於儲存額外的記錄資料。

視實作方式和政策而定,記錄可能會以壓縮形式儲存。 記錄檔也可能儲存在 Tradefed 無法存取的位置。

參數
dataName String:資料的String說明名稱,例如「device_logcat」。

dataType LogDataType:檔案的 LogDataType

dataStream InputStream:資料的 InputStream

傳回
LogFile 包含儲存檔案路徑和網址的 LogFile

擲回
IOException

saveLogFile

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

儲存記錄檔。

每當呼叫 ITestInvocationListener.testLog(String,LogDataType,InputStreamSource) 且串流參照檔案時,TradeFederation 架構就會自動呼叫這個方法。

視實作方式和政策而定,記錄可能會以壓縮形式儲存。 記錄檔也可能儲存在 Tradefed 無法存取的位置。

參數
dataName String:資料的String說明名稱,例如「device_logcat」。

dataType LogDataType:檔案的 LogDataType

fileToLog File:要儲存的 File

傳回
LogFile 包含儲存檔案路徑和網址的 LogFile

擲回
IOException

受保護的方法

getInvocationContext

protected IInvocationContext getInvocationContext ()

傳回
IInvocationContext

runUpdate

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

參數
client Androidbuildinternal

filePath String

resourceId String

md5 String

fileContent FileContent

type LogDataType

contentType String

擲回
IOException