|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.junit.rules.ExternalResource org.apache.crunch.test.TemporaryPath
public final class TemporaryPath
Creates a temporary directory for a test case and destroys it afterwards.
This provides a temporary directory like JUnit's TemporaryFolder
but
geared towards Hadoop applications. Unlike TemporaryFolder
, it
doesn't create any files or directories except for the root directory itself.
Also, getDefaultConfiguration()
provides you with a configuration that
overrides path properties with temporary directories. You have to specify these
properties via the constructor.
Constructor Summary | |
---|---|
TemporaryPath(String... confKeys)
Construct TemporaryPath . |
Method Summary | |
---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
|
File |
copyResourceFile(String resourceName)
Copy a classpath resource to File . |
String |
copyResourceFileName(String resourceName)
Copy a classpath resource returning its absolute file name. |
org.apache.hadoop.fs.Path |
copyResourcePath(String resourceName)
Copy a classpath resource to a Path . |
org.apache.hadoop.conf.Configuration |
getDefaultConfiguration()
|
File |
getFile(String fileName)
Get a File below the temporary directory. |
String |
getFileName(String fileName)
Get an absolute file name below the temporary directory. |
org.apache.hadoop.fs.Path |
getPath(String fileName)
Get a Path below the temporary directory. |
File |
getRootFile()
Get the root directory which will be deleted automatically. |
String |
getRootFileName()
Get the root directory as an absolute file name. |
org.apache.hadoop.fs.Path |
getRootPath()
Get the root directory as a Path . |
org.apache.hadoop.conf.Configuration |
overridePathProperties(org.apache.hadoop.conf.Configuration config)
Set all keys specified in the constructor to temporary directories. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TemporaryPath(String... confKeys)
TemporaryPath
.
confKeys
- Configuration
keys containing directories to overrideMethod Detail |
---|
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
apply
in interface org.junit.rules.TestRule
apply
in class org.junit.rules.ExternalResource
public File getRootFile()
public org.apache.hadoop.fs.Path getRootPath()
Path
.
public String getRootFileName()
public File getFile(String fileName)
File
below the temporary directory.
public org.apache.hadoop.fs.Path getPath(String fileName)
Path
below the temporary directory.
public String getFileName(String fileName)
public File copyResourceFile(String resourceName) throws IOException
File
.
IOException
public org.apache.hadoop.fs.Path copyResourcePath(String resourceName) throws IOException
Path
.
IOException
public String copyResourceFileName(String resourceName) throws IOException
IOException
public org.apache.hadoop.conf.Configuration getDefaultConfiguration()
public org.apache.hadoop.conf.Configuration overridePathProperties(org.apache.hadoop.conf.Configuration config)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |