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()
File getLocalPathForFilename(IBuildInfo buildInfo, String fileName, ITestDevice device)

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

Collection<String> 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
TargetSetupError
BuildError
DeviceNotAvailableException

Protected methods

addTestFileName

protected void addTestFileName (String fileName)

Adds a file to the list of items to push

clearTestFileName

protected void clearTestFileName ()

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 File representing the physical file/path on host

Throws
TargetSetupError

getTestFileNames

protected Collection<String> getTestFileNames ()

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

Returns
Collection<String>

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