Example #1
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 #2
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());
  }