示例#1
0
  @Test
  public void streamToJournalCheckpointTest() throws Exception {
    InodeDirectory root = mTree.getRoot();

    // test root
    verifyJournal(mTree, Lists.<Inode>newArrayList(root));

    // test nested URI
    mTree.createPath(NESTED_FILE_URI, sNestedFileOptions);
    InodeDirectory nested = (InodeDirectory) root.getChild("nested");
    InodeDirectory test = (InodeDirectory) nested.getChild("test");
    Inode file = test.getChild("file");
    verifyJournal(mTree, Lists.newArrayList(root, nested, test, file));

    // add a sibling of test and verify journaling is in correct order (breadth first)
    mTree.createPath(new TachyonURI("/nested/test1/file1"), sNestedFileOptions);
    InodeDirectory test1 = (InodeDirectory) nested.getChild("test1");
    Inode file1 = test1.getChild("file1");
    verifyJournal(mTree, Lists.newArrayList(root, nested, test, test1, file, file1));
  }
示例#2
0
  @Test
  public void addInodeFromJournalTest() throws Exception {
    mTree.createPath(NESTED_FILE_URI, sNestedFileOptions);
    mTree.createPath(new TachyonURI("/nested/test1/file1"), sNestedFileOptions);
    InodeDirectory root = mTree.getRoot();
    InodeDirectory nested = (InodeDirectory) root.getChild("nested");
    InodeDirectory test = (InodeDirectory) nested.getChild("test");
    Inode file = test.getChild("file");
    InodeDirectory test1 = (InodeDirectory) nested.getChild("test1");
    Inode file1 = test1.getChild("file1");

    // reset the tree
    mTree.addInodeFromJournal(root.toJournalEntry());

    // re-init the root since the tree was reset above
    root = mTree.getRoot();

    Assert.assertEquals(0, mTree.getInodeChildrenRecursive(root).size());
    mTree.addInodeFromJournal(nested.toJournalEntry());
    verifyChildrenNames(mTree, root, Sets.newHashSet("nested"));

    mTree.addInodeFromJournal(test.toJournalEntry());
    verifyChildrenNames(mTree, root, Sets.newHashSet("nested", "test"));

    mTree.addInodeFromJournal(test1.toJournalEntry());
    verifyChildrenNames(mTree, root, Sets.newHashSet("nested", "test", "test1"));

    mTree.addInodeFromJournal(file.toJournalEntry());
    verifyChildrenNames(mTree, root, Sets.newHashSet("nested", "test", "test1", "file"));

    mTree.addInodeFromJournal(file1.toJournalEntry());
    verifyChildrenNames(mTree, root, Sets.newHashSet("nested", "test", "test1", "file", "file1"));
  }