Search in sources :

Example 6 with ChRootedFileSystem

use of org.apache.hadoop.fs.viewfs.ChRootedFileSystem in project hadoop by apache.

the class TestChRootedFileSystem method testGetStoragePolicy.

@Test(timeout = 30000)
public void testGetStoragePolicy() throws Exception {
    Path storagePolicyPath = new Path("/storagePolicy");
    Path chRootedStoragePolicyPath = new Path("/a/b/storagePolicy");
    Configuration conf = new Configuration();
    conf.setClass("fs.mockfs.impl", MockFileSystem.class, FileSystem.class);
    URI chrootUri = URI.create("mockfs://foo/a/b");
    ChRootedFileSystem chrootFs = new ChRootedFileSystem(chrootUri, conf);
    FileSystem mockFs = ((FilterFileSystem) chrootFs.getRawFileSystem()).getRawFileSystem();
    chrootFs.getStoragePolicy(storagePolicyPath);
    verify(mockFs).getStoragePolicy(chRootedStoragePolicyPath);
}
Also used : Path(org.apache.hadoop.fs.Path) Configuration(org.apache.hadoop.conf.Configuration) FileSystem(org.apache.hadoop.fs.FileSystem) ChRootedFileSystem(org.apache.hadoop.fs.viewfs.ChRootedFileSystem) FilterFileSystem(org.apache.hadoop.fs.FilterFileSystem) FilterFileSystem(org.apache.hadoop.fs.FilterFileSystem) URI(java.net.URI) ChRootedFileSystem(org.apache.hadoop.fs.viewfs.ChRootedFileSystem) Test(org.junit.Test)

Example 7 with ChRootedFileSystem

use of org.apache.hadoop.fs.viewfs.ChRootedFileSystem in project hadoop by apache.

the class TestChRootedFileSystem method testUnsetStoragePolicy.

@Test(timeout = 30000)
public void testUnsetStoragePolicy() throws Exception {
    Path storagePolicyPath = new Path("/storagePolicy");
    Path chRootedStoragePolicyPath = new Path("/a/b/storagePolicy");
    Configuration conf = new Configuration();
    conf.setClass("fs.mockfs.impl", MockFileSystem.class, FileSystem.class);
    URI chrootUri = URI.create("mockfs://foo/a/b");
    ChRootedFileSystem chrootFs = new ChRootedFileSystem(chrootUri, conf);
    FileSystem mockFs = ((FilterFileSystem) chrootFs.getRawFileSystem()).getRawFileSystem();
    chrootFs.unsetStoragePolicy(storagePolicyPath);
    verify(mockFs).unsetStoragePolicy(chRootedStoragePolicyPath);
}
Also used : Path(org.apache.hadoop.fs.Path) Configuration(org.apache.hadoop.conf.Configuration) FileSystem(org.apache.hadoop.fs.FileSystem) ChRootedFileSystem(org.apache.hadoop.fs.viewfs.ChRootedFileSystem) FilterFileSystem(org.apache.hadoop.fs.FilterFileSystem) FilterFileSystem(org.apache.hadoop.fs.FilterFileSystem) URI(java.net.URI) ChRootedFileSystem(org.apache.hadoop.fs.viewfs.ChRootedFileSystem) Test(org.junit.Test)

Example 8 with ChRootedFileSystem

use of org.apache.hadoop.fs.viewfs.ChRootedFileSystem in project hadoop by apache.

the class TestChRootedFileSystem method testDeleteSnapshot.

@Test(timeout = 30000)
public void testDeleteSnapshot() throws Exception {
    Path snapRootPath = new Path("/snapPath");
    Path chRootedSnapRootPath = new Path("/a/b/snapPath");
    Configuration conf = new Configuration();
    conf.setClass("fs.mockfs.impl", MockFileSystem.class, FileSystem.class);
    URI chrootUri = URI.create("mockfs://foo/a/b");
    ChRootedFileSystem chrootFs = new ChRootedFileSystem(chrootUri, conf);
    FileSystem mockFs = ((FilterFileSystem) chrootFs.getRawFileSystem()).getRawFileSystem();
    chrootFs.deleteSnapshot(snapRootPath, "snap1");
    verify(mockFs).deleteSnapshot(chRootedSnapRootPath, "snap1");
}
Also used : Path(org.apache.hadoop.fs.Path) Configuration(org.apache.hadoop.conf.Configuration) FileSystem(org.apache.hadoop.fs.FileSystem) ChRootedFileSystem(org.apache.hadoop.fs.viewfs.ChRootedFileSystem) FilterFileSystem(org.apache.hadoop.fs.FilterFileSystem) FilterFileSystem(org.apache.hadoop.fs.FilterFileSystem) URI(java.net.URI) ChRootedFileSystem(org.apache.hadoop.fs.viewfs.ChRootedFileSystem) Test(org.junit.Test)

Example 9 with ChRootedFileSystem

use of org.apache.hadoop.fs.viewfs.ChRootedFileSystem in project hadoop by apache.

the class TestChRootedFileSystem method testRenameSnapshot.

@Test(timeout = 30000)
public void testRenameSnapshot() throws Exception {
    Path snapRootPath = new Path("/snapPath");
    Path chRootedSnapRootPath = new Path("/a/b/snapPath");
    Configuration conf = new Configuration();
    conf.setClass("fs.mockfs.impl", MockFileSystem.class, FileSystem.class);
    URI chrootUri = URI.create("mockfs://foo/a/b");
    ChRootedFileSystem chrootFs = new ChRootedFileSystem(chrootUri, conf);
    FileSystem mockFs = ((FilterFileSystem) chrootFs.getRawFileSystem()).getRawFileSystem();
    chrootFs.renameSnapshot(snapRootPath, "snapOldName", "snapNewName");
    verify(mockFs).renameSnapshot(chRootedSnapRootPath, "snapOldName", "snapNewName");
}
Also used : Path(org.apache.hadoop.fs.Path) Configuration(org.apache.hadoop.conf.Configuration) FileSystem(org.apache.hadoop.fs.FileSystem) ChRootedFileSystem(org.apache.hadoop.fs.viewfs.ChRootedFileSystem) FilterFileSystem(org.apache.hadoop.fs.FilterFileSystem) FilterFileSystem(org.apache.hadoop.fs.FilterFileSystem) URI(java.net.URI) ChRootedFileSystem(org.apache.hadoop.fs.viewfs.ChRootedFileSystem) Test(org.junit.Test)

Example 10 with ChRootedFileSystem

use of org.apache.hadoop.fs.viewfs.ChRootedFileSystem in project hadoop by apache.

the class TestChRootedFileSystem method testCreateSnapshot.

@Test(timeout = 30000)
public void testCreateSnapshot() throws Exception {
    Path snapRootPath = new Path("/snapPath");
    Path chRootedSnapRootPath = new Path("/a/b/snapPath");
    Configuration conf = new Configuration();
    conf.setClass("fs.mockfs.impl", MockFileSystem.class, FileSystem.class);
    URI chrootUri = URI.create("mockfs://foo/a/b");
    ChRootedFileSystem chrootFs = new ChRootedFileSystem(chrootUri, conf);
    FileSystem mockFs = ((FilterFileSystem) chrootFs.getRawFileSystem()).getRawFileSystem();
    chrootFs.createSnapshot(snapRootPath, "snap1");
    verify(mockFs).createSnapshot(chRootedSnapRootPath, "snap1");
}
Also used : Path(org.apache.hadoop.fs.Path) Configuration(org.apache.hadoop.conf.Configuration) FileSystem(org.apache.hadoop.fs.FileSystem) ChRootedFileSystem(org.apache.hadoop.fs.viewfs.ChRootedFileSystem) FilterFileSystem(org.apache.hadoop.fs.FilterFileSystem) FilterFileSystem(org.apache.hadoop.fs.FilterFileSystem) URI(java.net.URI) ChRootedFileSystem(org.apache.hadoop.fs.viewfs.ChRootedFileSystem) Test(org.junit.Test)

Aggregations

Configuration (org.apache.hadoop.conf.Configuration)11 ChRootedFileSystem (org.apache.hadoop.fs.viewfs.ChRootedFileSystem)11 URI (java.net.URI)10 Test (org.junit.Test)10 FileSystem (org.apache.hadoop.fs.FileSystem)9 FilterFileSystem (org.apache.hadoop.fs.FilterFileSystem)9 Path (org.apache.hadoop.fs.Path)8 FileStatus (org.apache.hadoop.fs.FileStatus)1 FileSystemTestHelper (org.apache.hadoop.fs.FileSystemTestHelper)1 AclEntry (org.apache.hadoop.fs.permission.AclEntry)1 Before (org.junit.Before)1