TestFilePushSetup

public class TestFilePushSetup
extends BaseTargetPreparer

java.lang.Object
   ↳ com.android.tradefed.targetprep.BaseTargetPreparer
     ↳ com.android.tradefed.targetprep.TestFilePushSetup


A ITargetPreparer that pushes one or more files/dirs from a IDeviceBuildInfo#getTestsDir() folder onto device.

This preparer will look in alternate directories if the tests zip does not exist or does not contain the required apk. The search will go in order from the last alternative dir specified to the first.

Summary

Public constructors

TestFilePushSetup()

Public methods

void setUp(ITestDevice device, IBuildInfo buildInfo)

Protected methods

void addTestFileName(String fileName)

Adds a file to the list of items to push

void clearTestFileName()
getFailedToPushFiles()

Returns the set of files that failed to be pushed.

File getLocalPathForFilename(IBuildInfo buildInfo, String fileName, ITestDevice device)

Resolve the host side path based on testing artifact information inside build info.

getTestFileNames()

Retrieves the list of files to be pushed from test zip onto device

void setAltDir(File altDir)

Set an alternate directory.

void setAltDirBehavior(AltDirBehavior behavior)

Set the alternative directory search behavior.

void setThrowIfNoFile(boolean throwIfNoFile)

Public constructors

TestFilePushSetup

public TestFilePushSetup ()

Public methods

setUp

public void setUp (ITestDevice device, 
                IBuildInfo buildInfo)

Parameters
device ITestDevice

buildInfo IBuildInfo

Throws
BuildError
DeviceNotAvailableException
TargetSetupError

Protected methods

addTestFileName

protected void addTestFileName (String fileName)

Adds a file to the list of items to push

clearTestFileName

protected void clearTestFileName ()

getFailedToPushFiles

protected  getFailedToPushFiles ()

Returns the set of files that failed to be pushed. Can only be used if 'throw-if-not-found' is false otherwise the first failed push will throw an exception.

Returns

getLocalPathForFilename

protected File getLocalPathForFilename (IBuildInfo buildInfo, 
                String fileName, 
                ITestDevice device)

Resolve the host side path based on testing artifact information inside build info.

Parameters
buildInfo IBuildInfo: build artifact information

fileName String: filename of artifacts to push

device ITestDevice

Returns
File a ERROR(/File) representing the physical file/path on host

Throws
TargetSetupError

getTestFileNames

protected  getTestFileNames ()

Retrieves the list of files to be pushed from test zip onto device

Returns

setAltDir

protected void setAltDir (File altDir)

Set an alternate directory. Exposed for testing.

Parameters
altDir File

setAltDirBehavior

protected void setAltDirBehavior (AltDirBehavior behavior)

Set the alternative directory search behavior. Exposed for testing.

Parameters
behavior AltDirBehavior

setThrowIfNoFile

protected void setThrowIfNoFile (boolean throwIfNoFile)

Parameters
throwIfNoFile boolean