ShardMainResultForwarder
public
class
ShardMainResultForwarder
extends ResultForwarder
implements
ILogSaverListener
| java.lang.Object | ||
| ↳ | com.android.tradefed.result.ResultForwarder | |
| ↳ | com.android.tradefed.invoker.ShardMainResultForwarder | |
ResultForwarder,可合併分片測試調用的結果。只有在所有分片呼叫完成後,才會向監聽器回報呼叫完成。
這個類別並非執行緒安全。預期用戶端會在傳送測試結果時鎖定這個類別,以免系統以錯誤順序呼叫叫用回呼。
摘要
公用建構函式 | |
|---|---|
ShardMainResultForwarder(List<ITestInvocationListener> listeners, int expectedShards)
|
|
公用方法 | |
|---|---|
List<ITestInvocationListener>
|
getListeners()
取得接聽器清單。 |
void
|
invocationEnded(long elapsedTime)
回報是否因某種錯誤狀況而終止呼叫 (無論是否成功)。 |
void
|
invocationEnded(long elapsedTime, IInvocationContext context)
更詳細的回呼,可區分完成的分片。 |
void
|
invocationFailed(FailureDescription failure)
Reports an incomplete invocation due to some error condition. |
void
|
invocationFailed(Throwable cause)
Reports an incomplete invocation due to some error condition. |
void
|
invocationSkipped(SkipReason reason)
回報已略過的叫用 |
void
|
invocationStarted(IInvocationContext context)
Reports the start of the test invocation. |
void
|
logAssociation(String dataName, LogFile logFile)
在某些情況下,記錄必須與測試案例密切相關,但無法在直接 |
void
|
testLogForward(String dataName, LogDataType dataType, InputStreamSource dataStream)
請直接轉寄 testLog,不要先儲存記錄。 |
void
|
testLogSaved(String dataName, LogDataType dataType, InputStreamSource dataStream, LogFile logFile)
測試記錄儲存完畢時呼叫。 |
公用建構函式
ShardMainResultForwarder
public ShardMainResultForwarder (List<ITestInvocationListener> listeners, int expectedShards)
| 參數 | |
|---|---|
listeners |
List:所有分片完成時,要將結果轉送至的 ITestInvocationListener 清單 |
expectedShards |
int:shard 數量 |
公用方法
getListeners
public List<ITestInvocationListener> getListeners ()
取得監聽器清單。
| 傳回 | |
|---|---|
List<ITestInvocationListener> |
ITestInvocationListener 清單。 |
invocationEnded
public void invocationEnded (long elapsedTime)
回報是否因某種錯誤情況而終止呼叫 (無論是否成功)。
TradeFederation 架構會自動呼叫。
| 參數 | |
|---|---|
elapsedTime |
long:以毫秒為單位的呼叫經過時間 |
invocationEnded
public void invocationEnded (long elapsedTime,
IInvocationContext context)更詳細的回呼,可區分完成的分片。
| 參數 | |
|---|---|
elapsedTime |
long |
context |
IInvocationContext |
invocationFailed
public void invocationFailed (FailureDescription failure)
由於發生某些錯誤情況,因此回報不完整的叫用。
TradeFederation 架構會自動呼叫。
| 參數 | |
|---|---|
failure |
FailureDescription:說明失敗原因的 FailureDescription |
invocationFailed
public void invocationFailed (Throwable cause)
由於發生某些錯誤情況,因此回報不完整的叫用。
TradeFederation 架構會自動呼叫。
| 參數 | |
|---|---|
cause |
Throwable:Throwable 失敗的原因 |
invocationStarted
public void invocationStarted (IInvocationContext context)
回報測試呼叫的開始時間。
TradeFederation 架構會自動呼叫這個方法。檢舉者需要覆寫這個方法,才能支援多部裝置回報。
| 參數 | |
|---|---|
context |
IInvocationContext:叫用相關資訊 |
logAssociation
public void logAssociation (String dataName,
LogFile logFile)在某些情況下,記錄必須與測試案例密切相關,但無法在直接 testLogSaved(String,LogDataType,InputStreamSource,LogFile) 回呼中執行此操作。因此,這個回呼可明確提供強關聯。
| 參數 | |
|---|---|
dataName |
String:資料名稱 |
logFile |
LogFile:先前記錄的 LogFile,應與測試案例建立關聯。 |
testLogForward
public void testLogForward (String dataName,
LogDataType dataType,
InputStreamSource dataStream)直接轉寄 testLog,不必先儲存記錄。
| 參數 | |
|---|---|
dataName |
String |
dataType |
LogDataType |
dataStream |
InputStreamSource |
testLogSaved
public void testLogSaved (String dataName,
LogDataType dataType,
InputStreamSource dataStream,
LogFile logFile)測試記錄儲存完畢時呼叫。
應取代 ITestInvocationListener.testLog(String,LogDataType,InputStreamSource) 使用。
| 參數 | |
|---|---|
dataName |
String:資料的String說明名稱,例如「device_logcat」。注意:dataName 在每次呼叫時可能不具唯一性,也就是說,實作者必須能夠處理具有相同 dataName 的多項呼叫。 |
dataType |
LogDataType:資料的 LogDataType |
dataStream |
InputStreamSource:資料的 InputStreamSource。實作者應呼叫 createInputStream 開始讀取資料,並確保在完成時關閉產生的 InputStream。 |
logFile |
LogFile:包含已儲存檔案中繼資料的 LogFile。 |