public class HadoopUtils
extends java.lang.Object
| Constructor and Description |
|---|
HadoopUtils(XdEnvironment xdEnvironment)
Initializes the hadoop utils with the name node that was specified in the environment.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
fileExists(java.lang.String uri)
Verifies that the file exists.
|
void |
fileRemove(java.lang.String uri)
Recursively removes files in a directory or if only a file just that file.
|
java.lang.String |
getFileContentsFromHdfs(java.lang.String path)
Retrieves the file from the hdfs file system.
|
org.apache.hadoop.fs.FileStatus |
getFileStatus(java.lang.String filePath)
Retrieves the file status for the file path specified.
|
java.util.Collection<org.apache.hadoop.fs.FileStatus> |
listDir(java.lang.String path)
Retrieves a list of entries in the hdfs at the path specified.
|
boolean |
waitForPath(int waitTime,
java.lang.String path)
Waits up to the timeout for the resource to be written to hdfs.
|
public HadoopUtils(XdEnvironment xdEnvironment)
xdEnvironment - the environment for the test.public java.util.Collection<org.apache.hadoop.fs.FileStatus> listDir(java.lang.String path)
path - the pathpublic boolean fileExists(java.lang.String uri)
uri - The uri of the file to verify.public void fileRemove(java.lang.String uri)
uri - Path to the file or directory.public java.lang.String getFileContentsFromHdfs(java.lang.String path)
path - The URI to the file to be retrieved.public boolean waitForPath(int waitTime,
java.lang.String path)
waitTime - The number of millis to wait.path - the path to the resource .public org.apache.hadoop.fs.FileStatus getFileStatus(java.lang.String filePath)
filePath - path/file name of the file to interrogate