本文整理汇总了Java中org.apache.hadoop.fs.FileSystemTestHelper.getTestRootPath方法的典型用法代码示例。如果您正苦于以下问题:Java FileSystemTestHelper.getTestRootPath方法的具体用法?Java FileSystemTestHelper.getTestRootPath怎么用?Java FileSystemTestHelper.getTestRootPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.fs.FileSystemTestHelper
的用法示例。
在下文中一共展示了FileSystemTestHelper.getTestRootPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupForViewFileSystem
import org.apache.hadoop.fs.FileSystemTestHelper; //导入方法依赖的package包/类
/**
*
* @param fsTarget - the target fs of the view fs.
* @return return the ViewFS File context to be used for tests
* @throws Exception
*/
static public FileSystem setupForViewFileSystem(Configuration conf, FileSystemTestHelper fileSystemTestHelper, FileSystem fsTarget) throws Exception {
/**
* create the test root on local_fs - the mount table will point here
*/
Path targetOfTests = fileSystemTestHelper.getTestRootPath(fsTarget);
// In case previous test was killed before cleanup
fsTarget.delete(targetOfTests, true);
fsTarget.mkdirs(targetOfTests);
// Set up viewfs link for test dir as described above
String testDir = fileSystemTestHelper.getTestRootPath(fsTarget).toUri()
.getPath();
linkUpFirstComponents(conf, testDir, fsTarget, "test dir");
// Set up viewfs link for home dir as described above
setUpHomeDir(conf, fsTarget);
// the test path may be relative to working dir - we need to make that work:
// Set up viewfs link for wd as described above
String wdDir = fsTarget.getWorkingDirectory().toUri().getPath();
linkUpFirstComponents(conf, wdDir, fsTarget, "working dir");
FileSystem fsView = FileSystem.get(FsConstants.VIEWFS_URI, conf);
fsView.setWorkingDirectory(new Path(wdDir)); // in case testdir relative to wd.
Log.info("Working dir is: " + fsView.getWorkingDirectory());
return fsView;
}
示例2: testWDAbsolute
import org.apache.hadoop.fs.FileSystemTestHelper; //导入方法依赖的package包/类
@Test
@Ignore
@Override
public void testWDAbsolute() throws IOException {
Path absoluteDir = FileSystemTestHelper.getTestRootPath(fSys,
"test/existingDir");
fSys.mkdirs(absoluteDir);
fSys.setWorkingDirectory(absoluteDir);
Assert.assertEquals(absoluteDir, fSys.getWorkingDirectory());
}
示例3: testWDAbsolute
import org.apache.hadoop.fs.FileSystemTestHelper; //导入方法依赖的package包/类
@Test
@Override
public void testWDAbsolute() throws IOException {
Path absoluteDir = FileSystemTestHelper.getTestRootPath(fSys,
"test/existingDir");
fSys.mkdirs(absoluteDir);
fSys.setWorkingDirectory(absoluteDir);
Assert.assertEquals(absoluteDir, fSys.getWorkingDirectory());
}
示例4: tearDown
import org.apache.hadoop.fs.FileSystemTestHelper; //导入方法依赖的package包/类
/**
*
* delete the test directory in the target fs
*/
static public void tearDown(FileSystemTestHelper fileSystemTestHelper, FileSystem fsTarget) throws Exception {
Path targetOfTests = fileSystemTestHelper.getTestRootPath(fsTarget);
fsTarget.delete(targetOfTests, true);
}