ShardListener

public class ShardListener
extends CollectingTestListener

java.lang.Object
   ↳ com.android.tradefed.result.CollectingTestListener
     ↳ com.android.tradefed.invoker.ShardListener


A ITestInvocationListener that collects results from a invocation shard (aka an invocation split to run on multiple resources in parallel), and forwards them to another listener.

Summary

Public constructors

ShardListener(ITestInvocationListener master)

Create a ShardListener.

Public methods

void invocationEnded(long elapsedTime)

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

void invocationFailed(Throwable cause)

Reports an incomplete invocation due to some error condition.

void invocationStarted(IInvocationContext context)

Reports the start of the test invocation.

void testLog(String dataName, LogDataType dataType, InputStreamSource dataStream)

void testLogSaved(String dataName, LogDataType dataType, InputStreamSource dataStream, LogFile logFile)

void testRunEnded(long elapsedTime, runMetrics)

Reports end of test run.

void testRunFailed(String failureMessage)

Reports test run failed to complete due to a fatal error.

Public constructors

ShardListener

public ShardListener (ITestInvocationListener master)

Create a ShardListener.

Parameters
master ITestInvocationListener: the ITestInvocationListener the results should be forwarded. To prevent collisions with other ShardListeners, this object will synchronize on master when forwarding results. And results will only be sent once the invocation shard completes.

Public methods

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

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

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

testLog

public void testLog (String dataName, 
                LogDataType dataType, 
                InputStreamSource dataStream)

Parameters
dataName String

dataType LogDataType

dataStream InputStreamSource

testLogSaved

public void testLogSaved (String dataName, 
                LogDataType dataType, 
                InputStreamSource dataStream, 
                LogFile logFile)

Parameters
dataName String

dataType LogDataType

dataStream InputStreamSource

logFile LogFile

testRunEnded

public void testRunEnded (long elapsedTime, 
                 runMetrics)

Reports end of test run. FIXME: We cannot have two Map<> interfaces with different type, so we have to use HashMap here.

Parameters
elapsedTime long: device reported elapsed time, in milliseconds

runMetrics : key-value pairs reported at the end of a test run with Metric.

testRunFailed

public void testRunFailed (String failureMessage)

Reports test run failed to complete due to a fatal error.

Parameters
failureMessage String: String describing reason for run failure.