Example #1
0
 @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);
 }
Example #2
0
  @Test
  public void getInodeByNonexistingPathTest() throws Exception {
    mThrown.expect(InvalidPathException.class);
    mThrown.expectMessage("Path /test does not exist");

    mTree.getInodeByPath(TEST_URI);
  }
Example #3
0
  @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);
  }
Example #4
0
 @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());
 }
Example #5
0
  @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());
  }