SubprocessTestResultsParser

public class SubprocessTestResultsParser
extends Object implements Closeable

java.lang.Object
   ↳ com.android.tradefed.util.SubprocessTestResultsParser


Extends FileOutputStream to parse the output before writing to the file so we can generate the test events on the launcher side.

Summary

Nested classes

interface SubprocessTestResultsParser.EventHandler

Interface for event handling  

class SubprocessTestResultsParser.StatusKeys

Relevant test status keys. 

Public constructors

SubprocessTestResultsParser(ITestInvocationListener listener, boolean streaming, IInvocationContext context)

Constructor for the result parser

SubprocessTestResultsParser(ITestInvocationListener listener, IInvocationContext context)

Constructor for the result parser

Public methods

void close()
TestDescription getCurrentTest()

Returns the test that is currently in progress.

int getSocketServerPort()

Returns the socket receiver that was open.

Long getStartTime()

Returns the start time associated with the invocation start event from the subprocess invocation.

boolean joinReceiver(long millis)

If the event receiver is being used, ensure that we wait for it to terminate.

void parseFile(File file)
void processNewLines(String[] lines)

call parse on each line of the array to extract the events if any.

Public constructors

SubprocessTestResultsParser

public SubprocessTestResultsParser (ITestInvocationListener listener, 
                boolean streaming, 
                IInvocationContext context)

Constructor for the result parser

Parameters
listener ITestInvocationListener: ITestInvocationListener where to report the results

streaming boolean: if True, a socket receiver will be open to receive results.

context IInvocationContext: a IInvocationContext information about the invocation

Throws
IOException

SubprocessTestResultsParser

public SubprocessTestResultsParser (ITestInvocationListener listener, 
                IInvocationContext context)

Constructor for the result parser

Parameters
listener ITestInvocationListener: ITestInvocationListener where to report the results

context IInvocationContext: a IInvocationContext information about the invocation

Public methods

close

public void close ()

Throws
IOException

getCurrentTest

public TestDescription getCurrentTest ()

Returns the test that is currently in progress.

Returns
TestDescription

getSocketServerPort

public int getSocketServerPort ()

Returns the socket receiver that was open. -1 if none.

Returns
int

getStartTime

public Long getStartTime ()

Returns the start time associated with the invocation start event from the subprocess invocation.

Returns
Long

joinReceiver

public boolean joinReceiver (long millis)

If the event receiver is being used, ensure that we wait for it to terminate.

Parameters
millis long: timeout in milliseconds.

Returns
boolean True if receiver thread terminate before timeout, False otherwise.

parseFile

public void parseFile (File file)

Parameters
file File

processNewLines

public void processNewLines (String[] lines)

call parse on each line of the array to extract the events if any.

Parameters
lines String