|
@@ -19,6 +19,7 @@ package org.apache.hadoop.fs.viewfs;
|
|
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
import java.io.IOException;
|
|
|
+import java.util.List;
|
|
|
|
|
|
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
@@ -31,7 +32,9 @@ import org.apache.hadoop.fs.FsConstants;
|
|
|
import org.apache.hadoop.fs.Path;
|
|
|
import org.apache.hadoop.fs.viewfs.ConfigUtil;
|
|
|
import org.apache.hadoop.fs.viewfs.ViewFileSystem;
|
|
|
+import org.apache.hadoop.fs.viewfs.ViewFileSystem.MountPoint;
|
|
|
import org.apache.hadoop.security.AccessControlException;
|
|
|
+import org.apache.hadoop.security.token.Token;
|
|
|
import org.junit.After;
|
|
|
import org.junit.Assert;
|
|
|
import org.junit.Before;
|
|
@@ -106,6 +109,24 @@ public class ViewFileSystemBaseTest {
|
|
|
fsTarget.delete(FileSystemTestHelper.getTestRootPath(fsTarget), true);
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void testGetMountPoints() {
|
|
|
+ ViewFileSystem viewfs = (ViewFileSystem) fsView;
|
|
|
+ MountPoint[] mountPoints = viewfs.getMountPoints();
|
|
|
+ Assert.assertEquals(7, mountPoints.length);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * This default implementation is when viewfs has mount points
|
|
|
+ * into file systems, such as LocalFs that do no have delegation tokens.
|
|
|
+ * It should be overridden for when mount points into hdfs.
|
|
|
+ */
|
|
|
+ @Test
|
|
|
+ public void testGetDelegationTokens() throws IOException {
|
|
|
+ List<Token<?>> delTokens =
|
|
|
+ fsView.getDelegationTokens("sanjay");
|
|
|
+ Assert.assertEquals(0, delTokens.size());
|
|
|
+ }
|
|
|
|
|
|
@Test
|
|
|
public void testBasicPaths() {
|
|
@@ -136,75 +157,112 @@ public class ViewFileSystemBaseTest {
|
|
|
public void testOperationsThroughMountLinks() throws IOException {
|
|
|
// Create file
|
|
|
FileSystemTestHelper.createFile(fsView, "/user/foo");
|
|
|
- Assert.assertTrue(fsView.isFile(new Path("/user/foo")));
|
|
|
- Assert.assertTrue(fsTarget.isFile(new Path(targetTestRoot,"user/foo")));
|
|
|
+ Assert.assertTrue("Created file should be type file",
|
|
|
+ fsView.isFile(new Path("/user/foo")));
|
|
|
+ Assert.assertTrue("Target of created file should be type file",
|
|
|
+ fsTarget.isFile(new Path(targetTestRoot,"user/foo")));
|
|
|
|
|
|
// Delete the created file
|
|
|
- Assert.assertTrue(fsView.delete(new Path("/user/foo"), false));
|
|
|
- Assert.assertFalse(fsView.exists(new Path("/user/foo")));
|
|
|
- Assert.assertFalse(fsTarget.exists(new Path(targetTestRoot,"user/foo")));
|
|
|
+ Assert.assertTrue("Delete should suceed",
|
|
|
+ fsView.delete(new Path("/user/foo"), false));
|
|
|
+ Assert.assertFalse("File should not exist after delete",
|
|
|
+ fsView.exists(new Path("/user/foo")));
|
|
|
+ Assert.assertFalse("Target File should not exist after delete",
|
|
|
+ fsTarget.exists(new Path(targetTestRoot,"user/foo")));
|
|
|
|
|
|
// Create file with a 2 component dirs
|
|
|
FileSystemTestHelper.createFile(fsView, "/internalDir/linkToDir2/foo");
|
|
|
- Assert.assertTrue(fsView.isFile(new Path("/internalDir/linkToDir2/foo")));
|
|
|
- Assert.assertTrue(fsTarget.isFile(new Path(targetTestRoot,"dir2/foo")));
|
|
|
+ Assert.assertTrue("Created file should be type file",
|
|
|
+ fsView.isFile(new Path("/internalDir/linkToDir2/foo")));
|
|
|
+ Assert.assertTrue("Target of created file should be type file",
|
|
|
+ fsTarget.isFile(new Path(targetTestRoot,"dir2/foo")));
|
|
|
|
|
|
// Delete the created file
|
|
|
- Assert.assertTrue(fsView.delete(new Path("/internalDir/linkToDir2/foo"), false));
|
|
|
- Assert.assertFalse(fsView.exists(new Path("/internalDir/linkToDir2/foo")));
|
|
|
- Assert.assertFalse(fsTarget.exists(new Path(targetTestRoot,"dir2/foo")));
|
|
|
+ Assert.assertTrue("Delete should suceed",
|
|
|
+ fsView.delete(new Path("/internalDir/linkToDir2/foo"), false));
|
|
|
+ Assert.assertFalse("File should not exist after delete",
|
|
|
+ fsView.exists(new Path("/internalDir/linkToDir2/foo")));
|
|
|
+ Assert.assertFalse("Target File should not exist after delete",
|
|
|
+ fsTarget.exists(new Path(targetTestRoot,"dir2/foo")));
|
|
|
|
|
|
|
|
|
// Create file with a 3 component dirs
|
|
|
FileSystemTestHelper.createFile(fsView, "/internalDir/internalDir2/linkToDir3/foo");
|
|
|
- Assert.assertTrue(fsView.isFile(new Path("/internalDir/internalDir2/linkToDir3/foo")));
|
|
|
- Assert.assertTrue(fsTarget.isFile(new Path(targetTestRoot,"dir3/foo")));
|
|
|
+ Assert.assertTrue("Created file should be type file",
|
|
|
+ fsView.isFile(new Path("/internalDir/internalDir2/linkToDir3/foo")));
|
|
|
+ Assert.assertTrue("Target of created file should be type file",
|
|
|
+ fsTarget.isFile(new Path(targetTestRoot,"dir3/foo")));
|
|
|
|
|
|
// Recursive Create file with missing dirs
|
|
|
- FileSystemTestHelper.createFile(fsView, "/internalDir/linkToDir2/missingDir/miss2/foo");
|
|
|
- Assert.assertTrue(fsView.isFile(new Path("/internalDir/linkToDir2/missingDir/miss2/foo")));
|
|
|
- Assert.assertTrue(fsTarget.isFile(new Path(targetTestRoot,"dir2/missingDir/miss2/foo")));
|
|
|
+ FileSystemTestHelper.createFile(fsView,
|
|
|
+ "/internalDir/linkToDir2/missingDir/miss2/foo");
|
|
|
+ Assert.assertTrue("Created file should be type file",
|
|
|
+ fsView.isFile(new Path("/internalDir/linkToDir2/missingDir/miss2/foo")));
|
|
|
+ Assert.assertTrue("Target of created file should be type file",
|
|
|
+ fsTarget.isFile(new Path(targetTestRoot,"dir2/missingDir/miss2/foo")));
|
|
|
|
|
|
|
|
|
// Delete the created file
|
|
|
- Assert.assertTrue(fsView.delete(new Path("/internalDir/internalDir2/linkToDir3/foo"), false));
|
|
|
- Assert.assertFalse(fsView.exists(new Path("/internalDir/internalDir2/linkToDir3/foo")));
|
|
|
- Assert.assertFalse(fsTarget.exists(new Path(targetTestRoot,"dir3/foo")));
|
|
|
+ Assert.assertTrue("Delete should succeed",
|
|
|
+ fsView.delete(
|
|
|
+ new Path("/internalDir/internalDir2/linkToDir3/foo"), false));
|
|
|
+ Assert.assertFalse("File should not exist after delete",
|
|
|
+ fsView.exists(new Path("/internalDir/internalDir2/linkToDir3/foo")));
|
|
|
+ Assert.assertFalse("Target File should not exist after delete",
|
|
|
+ fsTarget.exists(new Path(targetTestRoot,"dir3/foo")));
|
|
|
|
|
|
|
|
|
// mkdir
|
|
|
fsView.mkdirs(FileSystemTestHelper.getTestRootPath(fsView, "/user/dirX"));
|
|
|
- Assert.assertTrue(fsView.isDirectory(new Path("/user/dirX")));
|
|
|
- Assert.assertTrue(fsTarget.isDirectory(new Path(targetTestRoot,"user/dirX")));
|
|
|
+ Assert.assertTrue("New dir should be type dir",
|
|
|
+ fsView.isDirectory(new Path("/user/dirX")));
|
|
|
+ Assert.assertTrue("Target of new dir should be of type dir",
|
|
|
+ fsTarget.isDirectory(new Path(targetTestRoot,"user/dirX")));
|
|
|
|
|
|
- fsView.mkdirs(FileSystemTestHelper.getTestRootPath(fsView, "/user/dirX/dirY"));
|
|
|
- Assert.assertTrue(fsView.isDirectory(new Path("/user/dirX/dirY")));
|
|
|
- Assert.assertTrue(fsTarget.isDirectory(new Path(targetTestRoot,"user/dirX/dirY")));
|
|
|
+ fsView.mkdirs(
|
|
|
+ FileSystemTestHelper.getTestRootPath(fsView, "/user/dirX/dirY"));
|
|
|
+ Assert.assertTrue("New dir should be type dir",
|
|
|
+ fsView.isDirectory(new Path("/user/dirX/dirY")));
|
|
|
+ Assert.assertTrue("Target of new dir should be of type dir",
|
|
|
+ fsTarget.isDirectory(new Path(targetTestRoot,"user/dirX/dirY")));
|
|
|
|
|
|
|
|
|
// Delete the created dir
|
|
|
- Assert.assertTrue(fsView.delete(new Path("/user/dirX/dirY"), false));
|
|
|
- Assert.assertFalse(fsView.exists(new Path("/user/dirX/dirY")));
|
|
|
- Assert.assertFalse(fsTarget.exists(new Path(targetTestRoot,"user/dirX/dirY")));
|
|
|
+ Assert.assertTrue("Delete should succeed",
|
|
|
+ fsView.delete(new Path("/user/dirX/dirY"), false));
|
|
|
+ Assert.assertFalse("File should not exist after delete",
|
|
|
+ fsView.exists(new Path("/user/dirX/dirY")));
|
|
|
+ Assert.assertFalse("Target File should not exist after delete",
|
|
|
+ fsTarget.exists(new Path(targetTestRoot,"user/dirX/dirY")));
|
|
|
|
|
|
- Assert.assertTrue(fsView.delete(new Path("/user/dirX"), false));
|
|
|
- Assert.assertFalse(fsView.exists(new Path("/user/dirX")));
|
|
|
+ Assert.assertTrue("Delete should succeed",
|
|
|
+ fsView.delete(new Path("/user/dirX"), false));
|
|
|
+ Assert.assertFalse("File should not exist after delete",
|
|
|
+ fsView.exists(new Path("/user/dirX")));
|
|
|
Assert.assertFalse(fsTarget.exists(new Path(targetTestRoot,"user/dirX")));
|
|
|
|
|
|
// Rename a file
|
|
|
FileSystemTestHelper.createFile(fsView, "/user/foo");
|
|
|
fsView.rename(new Path("/user/foo"), new Path("/user/fooBar"));
|
|
|
- Assert.assertFalse(fsView.exists(new Path("/user/foo")));
|
|
|
- Assert.assertFalse(fsTarget.exists(new Path(targetTestRoot,"user/foo")));
|
|
|
- Assert.assertTrue(fsView.isFile(FileSystemTestHelper.getTestRootPath(fsView,"/user/fooBar")));
|
|
|
- Assert.assertTrue(fsTarget.isFile(new Path(targetTestRoot,"user/fooBar")));
|
|
|
+ Assert.assertFalse("Renamed src should not exist",
|
|
|
+ fsView.exists(new Path("/user/foo")));
|
|
|
+ Assert.assertFalse("Renamed src should not exist in target",
|
|
|
+ fsTarget.exists(new Path(targetTestRoot,"user/foo")));
|
|
|
+ Assert.assertTrue("Renamed dest should exist as file",
|
|
|
+ fsView.isFile(FileSystemTestHelper.getTestRootPath(fsView,"/user/fooBar")));
|
|
|
+ Assert.assertTrue("Renamed dest should exist as file in target",
|
|
|
+ fsTarget.isFile(new Path(targetTestRoot,"user/fooBar")));
|
|
|
|
|
|
fsView.mkdirs(new Path("/user/dirFoo"));
|
|
|
fsView.rename(new Path("/user/dirFoo"), new Path("/user/dirFooBar"));
|
|
|
- Assert.assertFalse(fsView.exists(new Path("/user/dirFoo")));
|
|
|
- Assert.assertFalse(fsTarget.exists(new Path(targetTestRoot,"user/dirFoo")));
|
|
|
- Assert.assertTrue(fsView.isDirectory(FileSystemTestHelper.getTestRootPath(fsView,"/user/dirFooBar")));
|
|
|
- Assert.assertTrue(fsTarget.isDirectory(new Path(targetTestRoot,"user/dirFooBar")));
|
|
|
+ Assert.assertFalse("Renamed src should not exist",
|
|
|
+ fsView.exists(new Path("/user/dirFoo")));
|
|
|
+ Assert.assertFalse("Renamed src should not exist in target",
|
|
|
+ fsTarget.exists(new Path(targetTestRoot,"user/dirFoo")));
|
|
|
+ Assert.assertTrue("Renamed dest should exist as dir",
|
|
|
+ fsView.isDirectory(FileSystemTestHelper.getTestRootPath(fsView,"/user/dirFooBar")));
|
|
|
+ Assert.assertTrue("Renamed dest should exist as dir in target",
|
|
|
+ fsTarget.isDirectory(new Path(targetTestRoot,"user/dirFooBar")));
|
|
|
|
|
|
}
|
|
|
|
|
@@ -239,7 +297,8 @@ public class ViewFileSystemBaseTest {
|
|
|
FileSystemTestHelper.createFile(fsTarget,
|
|
|
targetFilePath, 10, 1024);
|
|
|
Path viewFilePath = new Path("/data/largeFile");
|
|
|
- Assert.assertTrue(fsView.isFile(viewFilePath));
|
|
|
+ Assert.assertTrue("Created File should be type File",
|
|
|
+ fsView.isFile(viewFilePath));
|
|
|
BlockLocation[] viewBL = fsView.getFileBlockLocations(fsView.getFileStatus(viewFilePath), 0, 10240+100);
|
|
|
Assert.assertEquals(SupportsBlocks ? 10 : 1, viewBL.length);
|
|
|
BlockLocation[] targetBL = fsTarget.getFileBlockLocations(fsTarget.getFileStatus(targetFilePath), 0, 10240+100);
|
|
@@ -284,19 +343,19 @@ public class ViewFileSystemBaseTest {
|
|
|
Assert.assertEquals(6, dirPaths.length);
|
|
|
fs = FileSystemTestHelper.containsPath(fsView, "/user", dirPaths);
|
|
|
Assert.assertNotNull(fs);
|
|
|
- Assert.assertTrue(fs.isSymlink());
|
|
|
+ Assert.assertTrue("A mount should appear as symlink", fs.isSymlink());
|
|
|
fs = FileSystemTestHelper.containsPath(fsView, "/data", dirPaths);
|
|
|
Assert.assertNotNull(fs);
|
|
|
- Assert.assertTrue(fs.isSymlink());
|
|
|
+ Assert.assertTrue("A mount should appear as symlink", fs.isSymlink());
|
|
|
fs = FileSystemTestHelper.containsPath(fsView, "/internalDir", dirPaths);
|
|
|
Assert.assertNotNull(fs);
|
|
|
- Assert.assertTrue(fs.isDirectory());
|
|
|
+ Assert.assertTrue("A mount should appear as symlink", fs.isDirectory());
|
|
|
fs = FileSystemTestHelper.containsPath(fsView, "/danglingLink", dirPaths);
|
|
|
Assert.assertNotNull(fs);
|
|
|
- Assert.assertTrue(fs.isSymlink());
|
|
|
+ Assert.assertTrue("A mount should appear as symlink", fs.isSymlink());
|
|
|
fs = FileSystemTestHelper.containsPath(fsView, "/linkToAFile", dirPaths);
|
|
|
Assert.assertNotNull(fs);
|
|
|
- Assert.assertTrue(fs.isSymlink());
|
|
|
+ Assert.assertTrue("A mount should appear as symlink", fs.isSymlink());
|
|
|
|
|
|
|
|
|
|
|
@@ -306,10 +365,11 @@ public class ViewFileSystemBaseTest {
|
|
|
|
|
|
fs = FileSystemTestHelper.containsPath(fsView, "/internalDir/internalDir2", dirPaths);
|
|
|
Assert.assertNotNull(fs);
|
|
|
- Assert.assertTrue(fs.isDirectory());
|
|
|
- fs = FileSystemTestHelper.containsPath(fsView, "/internalDir/linkToDir2", dirPaths);
|
|
|
+ Assert.assertTrue("A mount should appear as symlink", fs.isDirectory());
|
|
|
+ fs = FileSystemTestHelper.containsPath(fsView, "/internalDir/linkToDir2",
|
|
|
+ dirPaths);
|
|
|
Assert.assertNotNull(fs);
|
|
|
- Assert.assertTrue(fs.isSymlink());
|
|
|
+ Assert.assertTrue("A mount should appear as symlink", fs.isSymlink());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
@@ -319,12 +379,13 @@ public class ViewFileSystemBaseTest {
|
|
|
Assert.assertEquals(0, dirPaths.length);
|
|
|
|
|
|
// add a file
|
|
|
- FileSystemTestHelper.createFile(fsView, "/data/foo");
|
|
|
+ long len = FileSystemTestHelper.createFile(fsView, "/data/foo");
|
|
|
dirPaths = fsView.listStatus(new Path("/data"));
|
|
|
Assert.assertEquals(1, dirPaths.length);
|
|
|
fs = FileSystemTestHelper.containsPath(fsView, "/data/foo", dirPaths);
|
|
|
Assert.assertNotNull(fs);
|
|
|
- Assert.assertTrue(fs.isFile());
|
|
|
+ Assert.assertTrue("Created file shoudl appear as a file", fs.isFile());
|
|
|
+ Assert.assertEquals(len, fs.getLen());
|
|
|
|
|
|
// add a dir
|
|
|
fsView.mkdirs(FileSystemTestHelper.getTestRootPath(fsView, "/data/dirX"));
|
|
@@ -332,10 +393,10 @@ public class ViewFileSystemBaseTest {
|
|
|
Assert.assertEquals(2, dirPaths.length);
|
|
|
fs = FileSystemTestHelper.containsPath(fsView, "/data/foo", dirPaths);
|
|
|
Assert.assertNotNull(fs);
|
|
|
- Assert.assertTrue(fs.isFile());
|
|
|
+ Assert.assertTrue("Created file shoudl appear as a file", fs.isFile());
|
|
|
fs = FileSystemTestHelper.containsPath(fsView, "/data/dirX", dirPaths);
|
|
|
Assert.assertNotNull(fs);
|
|
|
- Assert.assertTrue(fs.isDirectory());
|
|
|
+ Assert.assertTrue("Created dir should appear as a dir", fs.isDirectory());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
@@ -356,15 +417,69 @@ public class ViewFileSystemBaseTest {
|
|
|
fsView.getFileStatus(new Path("/danglingLink"));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Test(expected=FileNotFoundException.class)
|
|
|
public void testgetFSonNonExistingInternalDir() throws IOException {
|
|
|
fsView.getFileStatus(new Path("/internalDir/nonExisting"));
|
|
|
}
|
|
|
+
|
|
|
+ /*
|
|
|
+ * Test resolvePath(p)
|
|
|
+ */
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testResolvePathInternalPaths() throws IOException {
|
|
|
+ Assert.assertEquals(new Path("/"), fsView.resolvePath(new Path("/")));
|
|
|
+ Assert.assertEquals(new Path("/internalDir"),
|
|
|
+ fsView.resolvePath(new Path("/internalDir")));
|
|
|
+ }
|
|
|
+ @Test
|
|
|
+ public void testResolvePathMountPoints() throws IOException {
|
|
|
+ Assert.assertEquals(new Path(targetTestRoot,"user"),
|
|
|
+ fsView.resolvePath(new Path("/user")));
|
|
|
+ Assert.assertEquals(new Path(targetTestRoot,"data"),
|
|
|
+ fsView.resolvePath(new Path("/data")));
|
|
|
+ Assert.assertEquals(new Path(targetTestRoot,"dir2"),
|
|
|
+ fsView.resolvePath(new Path("/internalDir/linkToDir2")));
|
|
|
+ Assert.assertEquals(new Path(targetTestRoot,"dir3"),
|
|
|
+ fsView.resolvePath(new Path("/internalDir/internalDir2/linkToDir3")));
|
|
|
|
|
|
+ }
|
|
|
|
|
|
+ @Test
|
|
|
+ public void testResolvePathThroughMountPoints() throws IOException {
|
|
|
+ FileSystemTestHelper.createFile(fsView, "/user/foo");
|
|
|
+ Assert.assertEquals(new Path(targetTestRoot,"user/foo"),
|
|
|
+ fsView.resolvePath(new Path("/user/foo")));
|
|
|
+
|
|
|
+ fsView.mkdirs(
|
|
|
+ FileSystemTestHelper.getTestRootPath(fsView, "/user/dirX"));
|
|
|
+ Assert.assertEquals(new Path(targetTestRoot,"user/dirX"),
|
|
|
+ fsView.resolvePath(new Path("/user/dirX")));
|
|
|
+
|
|
|
+
|
|
|
+ fsView.mkdirs(
|
|
|
+ FileSystemTestHelper.getTestRootPath(fsView, "/user/dirX/dirY"));
|
|
|
+ Assert.assertEquals(new Path(targetTestRoot,"user/dirX/dirY"),
|
|
|
+ fsView.resolvePath(new Path("/user/dirX/dirY")));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test(expected=FileNotFoundException.class)
|
|
|
+ public void testResolvePathDanglingLink() throws IOException {
|
|
|
+ fsView.resolvePath(new Path("/danglingLink"));
|
|
|
+ }
|
|
|
|
|
|
+ @Test(expected=FileNotFoundException.class)
|
|
|
+ public void testResolvePathMissingThroughMountPoints() throws IOException {
|
|
|
+ fsView.resolvePath(new Path("/user/nonExisting"));
|
|
|
+ }
|
|
|
|
|
|
+
|
|
|
+ @Test(expected=FileNotFoundException.class)
|
|
|
+ public void testResolvePathMissingThroughMountPoints2() throws IOException {
|
|
|
+ fsView.mkdirs(
|
|
|
+ FileSystemTestHelper.getTestRootPath(fsView, "/user/dirX"));
|
|
|
+ fsView.resolvePath(new Path("/user/dirX/nonExisting"));
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* Test modify operations (create, mkdir, rename, etc)
|
|
@@ -375,20 +490,25 @@ public class ViewFileSystemBaseTest {
|
|
|
*/
|
|
|
|
|
|
|
|
|
- // Mkdir on internal mount table should fail
|
|
|
+ // Mkdir on existing internal mount table succeed except for /
|
|
|
@Test(expected=AccessControlException.class)
|
|
|
public void testInternalMkdirSlash() throws IOException {
|
|
|
fsView.mkdirs(FileSystemTestHelper.getTestRootPath(fsView, "/"));
|
|
|
}
|
|
|
|
|
|
- @Test(expected=AccessControlException.class)
|
|
|
public void testInternalMkdirExisting1() throws IOException {
|
|
|
- fsView.mkdirs(FileSystemTestHelper.getTestRootPath(fsView, "/internalDir"));
|
|
|
+ Assert.assertTrue("mkdir of existing dir should succeed",
|
|
|
+ fsView.mkdirs(FileSystemTestHelper.getTestRootPath(fsView,
|
|
|
+ "/internalDir")));
|
|
|
}
|
|
|
- @Test(expected=AccessControlException.class)
|
|
|
+
|
|
|
public void testInternalMkdirExisting2() throws IOException {
|
|
|
- fsView.mkdirs(FileSystemTestHelper.getTestRootPath(fsView, "/internalDir/linkToDir2"));
|
|
|
+ Assert.assertTrue("mkdir of existing dir should succeed",
|
|
|
+ fsView.mkdirs(FileSystemTestHelper.getTestRootPath(fsView,
|
|
|
+ "/internalDir/linkToDir2")));
|
|
|
}
|
|
|
+
|
|
|
+ // Mkdir for new internal mount table should fail
|
|
|
@Test(expected=AccessControlException.class)
|
|
|
public void testInternalMkdirNew() throws IOException {
|
|
|
fsView.mkdirs(FileSystemTestHelper.getTestRootPath(fsView, "/dirNew"));
|
|
@@ -398,7 +518,7 @@ public class ViewFileSystemBaseTest {
|
|
|
fsView.mkdirs(FileSystemTestHelper.getTestRootPath(fsView, "/internalDir/dirNew"));
|
|
|
}
|
|
|
|
|
|
- // Create on internal mount table should fail
|
|
|
+ // Create File on internal mount table should fail
|
|
|
|
|
|
@Test(expected=AccessControlException.class)
|
|
|
public void testInternalCreate1() throws IOException {
|
|
@@ -442,12 +562,19 @@ public class ViewFileSystemBaseTest {
|
|
|
}
|
|
|
@Test(expected=AccessControlException.class)
|
|
|
public void testInternalDeleteExisting2() throws IOException {
|
|
|
- Assert.assertTrue(
|
|
|
fsView.getFileStatus(
|
|
|
- new Path("/internalDir/linkToDir2")).isDirectory());
|
|
|
+ new Path("/internalDir/linkToDir2")).isDirectory();
|
|
|
fsView.delete(new Path("/internalDir/linkToDir2"), false);
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void testMkdirOfMountLink() throws IOException {
|
|
|
+ // data exists - mkdirs returns true even though no permission in internal
|
|
|
+ // mount table
|
|
|
+ Assert.assertTrue("mkdir of existing mount link should succeed",
|
|
|
+ fsView.mkdirs(new Path("/data")));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
// Rename on internal mount table should fail
|
|
|
|
|
@@ -457,8 +584,7 @@ public class ViewFileSystemBaseTest {
|
|
|
}
|
|
|
@Test(expected=AccessControlException.class)
|
|
|
public void testInternalRename2() throws IOException {
|
|
|
- Assert.assertTrue(
|
|
|
- fsView.getFileStatus(new Path("/internalDir/linkToDir2")).isDirectory());
|
|
|
+ fsView.getFileStatus(new Path("/internalDir/linkToDir2")).isDirectory();
|
|
|
fsView.rename(new Path("/internalDir/linkToDir2"),
|
|
|
new Path("/internalDir/dir1"));
|
|
|
}
|