@Test public void initializeRootTwiceTest() throws Exception { Inode root = mTree.getInodeByPath(new TachyonURI("/")); // initializeRoot call does nothing mTree.initializeRoot(TEST_PERMISSION_STATUS); Inode newRoot = mTree.getInodeByPath(new TachyonURI("/")); Assert.assertEquals(root, newRoot); }
@Test public void getInodeByNonexistingPathTest() throws Exception { mThrown.expect(InvalidPathException.class); mThrown.expectMessage("Path /test does not exist"); mTree.getInodeByPath(TEST_URI); }
@Test public void getInodeByNonexistingNestedPathTest() throws Exception { mThrown.expect(InvalidPathException.class); mThrown.expectMessage("Path /nested/test/file does not exist"); mTree.createPath(NESTED_URI, sNestedDirectoryOptions); mTree.getInodeByPath(NESTED_FILE_URI); }
@Test public void createFileTest() throws Exception { // created nested file mTree.createPath(NESTED_FILE_URI, sNestedFileOptions); Inode nestedFile = mTree.getInodeByPath(NESTED_FILE_URI); Assert.assertEquals("file", nestedFile.getName()); Assert.assertEquals(2, nestedFile.getParentId()); Assert.assertTrue(nestedFile.isFile()); Assert.assertEquals("user1", nestedFile.getUserName()); Assert.assertTrue(nestedFile.getGroupName().isEmpty()); Assert.assertEquals((short) 0644, nestedFile.getPermission()); }
@Test public void createDirectoryTest() throws Exception { // create directory mTree.createPath(TEST_URI, sDirectoryOptions); Inode test = mTree.getInodeByPath(TEST_URI); Assert.assertEquals(TEST_PATH, test.getName()); Assert.assertTrue(test.isDirectory()); Assert.assertEquals("user1", test.getUserName()); Assert.assertTrue(test.getGroupName().isEmpty()); Assert.assertEquals((short) 0755, test.getPermission()); // create nested directory mTree.createPath(NESTED_URI, sNestedDirectoryOptions); Inode nested = mTree.getInodeByPath(NESTED_URI); Assert.assertEquals(TEST_PATH, nested.getName()); Assert.assertEquals(2, nested.getParentId()); Assert.assertTrue(test.isDirectory()); Assert.assertEquals("user1", test.getUserName()); Assert.assertTrue(test.getGroupName().isEmpty()); Assert.assertEquals((short) 0755, test.getPermission()); }