RemoteFileUtil

public class RemoteFileUtil
extends Object

java.lang.Object
   ↳ com.android.tradefed.device.cloud.RemoteFileUtil


Utility class to handle file from a remote instance

Summary

Public constructors

RemoteFileUtil()

Public methods

static boolean doesRemoteFileExist(GceAvdInfo remoteInstance, TestDeviceOptions options, IRunUtil runUtil, long timeout, String remotePath)

Check if a file (or directory) exists on the remote instance

static File fetchRemoteDir(GceAvdInfo remoteInstance, TestDeviceOptions options, IRunUtil runUtil, long timeout, String remoteDirPath)

Fetch a remote directory from the remote host.

static boolean fetchRemoteDir(GceAvdInfo remoteInstance, TestDeviceOptions options, IRunUtil runUtil, long timeout, String remoteDirPath, File localDir)

Fetch a remote directory from the remote host.

static File fetchRemoteFile(GceAvdInfo remoteInstance, TestDeviceOptions options, IRunUtil runUtil, long timeout, String remoteFilePath)

Fetch a remote file in the container instance.

static boolean fetchRemoteFile(GceAvdInfo remoteInstance, TestDeviceOptions options, IRunUtil runUtil, long timeout, String remoteFilePath, File localFile)

Fetch a remote file in the device or container instance.

static boolean pushFileToRemote(GceAvdInfo remoteInstance, TestDeviceOptions options, scpArgs, IRunUtil runUtil, long timeout, String remoteFilePath, File localFile)

Push a ERROR(/File) from the local host to the remote instance

Public constructors

RemoteFileUtil

public RemoteFileUtil ()

Public methods

doesRemoteFileExist

public static boolean doesRemoteFileExist (GceAvdInfo remoteInstance, 
                TestDeviceOptions options, 
                IRunUtil runUtil, 
                long timeout, 
                String remotePath)

Check if a file (or directory) exists on the remote instance

Parameters
remoteInstance GceAvdInfo: The GceAvdInfo that describe the device.

options TestDeviceOptions: a TestDeviceOptions describing the device options to be used for the GCE device.

runUtil IRunUtil: a IRunUtil to execute commands.

timeout long: in millisecond for the fetch to complete

remotePath String: The remote path where to find the file.

Returns
boolean whether the file exists or not

fetchRemoteDir

public static File fetchRemoteDir (GceAvdInfo remoteInstance, 
                TestDeviceOptions options, 
                IRunUtil runUtil, 
                long timeout, 
                String remoteDirPath)

Fetch a remote directory from the remote host.

Parameters
remoteInstance GceAvdInfo: The GceAvdInfo that describe the device.

options TestDeviceOptions: a TestDeviceOptions describing the device options to be used for the GCE device.

runUtil IRunUtil: a IRunUtil to execute commands.

timeout long: in millisecond for the fetch to complete

remoteDirPath String: The remote path where to find the directory.

Returns
File The pulled directory ERROR(/File) if successful, null otherwise

fetchRemoteDir

public static boolean fetchRemoteDir (GceAvdInfo remoteInstance, 
                TestDeviceOptions options, 
                IRunUtil runUtil, 
                long timeout, 
                String remoteDirPath, 
                File localDir)

Fetch a remote directory from the remote host.

Parameters
remoteInstance GceAvdInfo: The GceAvdInfo that describe the device.

options TestDeviceOptions: a TestDeviceOptions describing the device options to be used for the GCE device.

runUtil IRunUtil: a IRunUtil to execute commands.

timeout long: in millisecond for the fetch to complete

remoteDirPath String: The remote path where to find the directory.

localDir File: The local directory where to put the pulled files.

Returns
boolean True if successful, False otherwise

fetchRemoteFile

public static File fetchRemoteFile (GceAvdInfo remoteInstance, 
                TestDeviceOptions options, 
                IRunUtil runUtil, 
                long timeout, 
                String remoteFilePath)

Fetch a remote file in the container instance.

Parameters
remoteInstance GceAvdInfo: The GceAvdInfo that describe the device.

options TestDeviceOptions: a TestDeviceOptions describing the device options to be used for the GCE device.

runUtil IRunUtil: a IRunUtil to execute commands.

timeout long: in millisecond for the fetch to complete

remoteFilePath String: The remote path where to find the file.

Returns
File The pulled filed if successful, null otherwise

fetchRemoteFile

public static boolean fetchRemoteFile (GceAvdInfo remoteInstance, 
                TestDeviceOptions options, 
                IRunUtil runUtil, 
                long timeout, 
                String remoteFilePath, 
                File localFile)

Fetch a remote file in the device or container instance.

Parameters
remoteInstance GceAvdInfo: The GceAvdInfo that describe the device.

options TestDeviceOptions: a TestDeviceOptions describing the device options to be used for the GCE device.

runUtil IRunUtil: a IRunUtil to execute commands.

timeout long: in millisecond for the fetch to complete

remoteFilePath String: The remote path where to find the file.

localFile File: The local ERROR(/File) where the remote file will be pulled

Returns
boolean True if successful, False otherwise

pushFileToRemote

public static boolean pushFileToRemote (GceAvdInfo remoteInstance, 
                TestDeviceOptions options, 
                 scpArgs, 
                IRunUtil runUtil, 
                long timeout, 
                String remoteFilePath, 
                File localFile)

Push a ERROR(/File) from the local host to the remote instance

Parameters
remoteInstance GceAvdInfo: The GceAvdInfo that describe the device.

options TestDeviceOptions: a TestDeviceOptions describing the device options to be used for the GCE device.

scpArgs : extra args to be passed to the scp command

runUtil IRunUtil: a IRunUtil to execute commands.

timeout long: in millisecond for the fetch to complete

remoteFilePath String: The remote path where to find the file.

localFile File: The local ERROR(/File) where the remote file will be pulled

Returns
boolean True if successful, False otherwise