ShardMainResultForwarder
public
class
ShardMainResultForwarder
extends ResultForwarder
implements
ILogSaverListener
java.lang.Object | ||
↳ | com.android.tradefed.result.ResultForwarder | |
↳ | com.android.tradefed.invoker.ShardMainResultForwarder |
A ResultForwarder
that combines the results of a sharded test invocations. It only
reports completion of the invocation to the listeners once all sharded invocations are complete.
This class is not thread safe. It is expected that clients will lock on this class when sending test results, to prevent invocation callbacks from being called out of order.
Summary
Public constructors | |
---|---|
ShardMainResultForwarder(
Create a |
Public methods | |
---|---|
|
getListeners()
Get the list of listeners. |
void
|
invocationEnded(long elapsedTime)
Reports that the invocation has terminated, whether successfully or due to some error condition. |
void
|
invocationEnded(long elapsedTime, IInvocationContext context)
More detailed callback to differentiate which shard finished. |
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)
Reports an invocation as skipped |
void
|
invocationStarted(IInvocationContext context)
Reports the start of the test invocation. |
void
|
logAssociation(String dataName, LogFile logFile)
In some cases, log must be strongly associated with a test cases, but the opportunity to do
so on the direct |
void
|
testLogForward(String dataName, LogDataType dataType, InputStreamSource dataStream)
Only forward the testLog instead of saving the log first. |
void
|
testLogSaved(String dataName, LogDataType dataType, InputStreamSource dataStream, LogFile logFile)
Called when the test log is saved. |
Public constructors
ShardMainResultForwarder
public ShardMainResultForwarder (listeners, int expectedShards)
Create a ShardMainResultForwarder
.
Parameters | |
---|---|
listeners |
: the list of ITestInvocationListener to forward results to when all
shards are completed |
expectedShards |
int : the number of shards |
Public methods
getListeners
publicgetListeners ()
Get the list of listeners. Intended only for use by subclasses.
Returns | |
---|---|
|
The list of ITestInvocationListener s. |
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.Parameters | |
---|---|
elapsedTime |
long : the elapsed time of the invocation in ms |
invocationEnded
public void invocationEnded (long elapsedTime, IInvocationContext context)
More detailed callback to differentiate which shard finished.
Parameters | |
---|---|
elapsedTime |
long |
context |
IInvocationContext |
invocationFailed
public void invocationFailed (FailureDescription failure)
Reports an incomplete invocation due to some error condition.
Will be automatically called by the TradeFederation framework.
Parameters | |
---|---|
failure |
FailureDescription : the FailureDescription describing the cause of the failure |
invocationFailed
public void invocationFailed (Throwable cause)
Reports an incomplete invocation due to some error condition.
Will be automatically called by the TradeFederation framework.Parameters | |
---|---|
cause |
Throwable : the Throwable cause of the failure |
invocationSkipped
public void invocationSkipped (SkipReason reason)
Reports an invocation as skipped
Parameters | |
---|---|
reason |
SkipReason |
invocationStarted
public void invocationStarted (IInvocationContext context)
Reports the start of the test invocation.
Will be automatically called by the TradeFederation framework. Reporters need to override this method to support multiple devices reporting.
Parameters | |
---|---|
context |
IInvocationContext : information about the invocation |
logAssociation
public void logAssociation (String dataName, LogFile logFile)
In some cases, log must be strongly associated with a test cases, but the opportunity to do
so on the direct testLogSaved(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource, com.android.tradefed.result.LogFile)
callback is not possible. Thus, this callback allows to provide a strong association
explicitly.
Parameters | |
---|---|
dataName |
String : The name of the data |
logFile |
LogFile : the LogFile that was logged before and should be associated with the
test case. |
testLogForward
public void testLogForward (String dataName, LogDataType dataType, InputStreamSource dataStream)
Only forward the testLog instead of saving the log first.
Parameters | |
---|---|
dataName |
String |
dataType |
LogDataType |
dataStream |
InputStreamSource |
testLogSaved
public void testLogSaved (String dataName, LogDataType dataType, InputStreamSource dataStream, LogFile logFile)
Called when the test log is saved.
Should be used in place of ITestInvocationListener.testLog(String, LogDataType,
InputStreamSource)
.
Parameters | |
---|---|
dataName |
String : a String descriptive name of the data. e.g. "device_logcat". Note
dataName may not be unique per invocation. ie implementers must be able to handle
multiple calls with same dataName |
dataType |
LogDataType : the LogDataType of the data |
dataStream |
InputStreamSource : the InputStreamSource of the data. Implementers should call
createInputStream to start reading the data, and ensure to close the resulting
InputStream when complete. |
logFile |
LogFile : the LogFile containing the meta data of the saved file. |