示例#1
0
  @Test
  public void testRemoveThenRemountFSAndGetEntry() throws Exception {

    if (!config.isReadOnly()) {
      setUp();

      String filename = "a file to test.text";
      FSDirectory rootDir = getFs().getRootEntry().getDirectory();
      /*FSEntry entry =*/ rootDir.addFile(filename);
      FSEntry gotEntry = rootDir.getEntry(filename);
      assertNotNull("must contain the added file", gotEntry);
      assertEquals("returned bad entry", filename, gotEntry.getName());

      rootDir.remove(filename);
      assertNull("must not contain the removed file", rootDir.getEntry(filename));

      remountFS(config, config.isReadOnly());

      FSDirectory rootDir2 = getFs().getRootEntry().getDirectory();
      TestUtils.listEntries(rootDir2.iterator());
      assertFalse("same ref (rootDir) after remount", rootDir == rootDir2);
      FSEntry gotEntry2 = rootDir2.getEntry(filename);
      assertNull("must not contain the removed file", gotEntry2);
    }
  }