@Test public void setPinnedTest() throws Exception { InodeTree.CreatePathResult createResult = mTree.createPath(NESTED_URI, sNestedDirectoryOptions); List<Inode> created = createResult.getCreated(); Inode nested = created.get(created.size() - 1); mTree.createPath(NESTED_FILE_URI, sNestedFileOptions); // no inodes pinned Assert.assertEquals(0, mTree.getPinIdSet().size()); // pin nested folder mTree.setPinned(nested, true); // nested file pinned Assert.assertEquals(1, mTree.getPinIdSet().size()); // unpin nested folder mTree.setPinned(nested, false); Assert.assertEquals(0, mTree.getPinIdSet().size()); }
@Test public void createFileUnderPinnedDirectoryTest() throws Exception { // create nested directory InodeTree.CreatePathResult createResult = mTree.createPath(NESTED_URI, sNestedDirectoryOptions); List<Inode> created = createResult.getCreated(); Inode nested = created.get(created.size() - 1); // pin nested folder mTree.setPinned(nested, true); // create nested file under pinned folder mTree.createPath(NESTED_FILE_URI, sNestedFileOptions); // the nested file is pinned Assert.assertEquals(1, mTree.getPinIdSet().size()); }