TestRaidDfs.createTestFilePartialLastBlock(fileSys, srcPath,
1, 8, 8192L);
TestRaidDfs.createTestFilePartialLastBlock(fileSys, srcPath2,
1, 8, 8192L);
DistributedRaidFileSystem raidFs = getRaidFS();
assertTrue(raidFs.exists(srcPath));
assertTrue(raidFs.exists(srcPath2));
// generate the parity files.
doRaid(srcPath, Codec.getCodec("xor"));
doRaid(srcPath2, Codec.getCodec("xor"));
ParityFilePair parity = ParityFilePair.getParityFile(
Codec.getCodec("xor"),
srcPath,
conf);
Path srcParityPath = parity.getPath();
ParityFilePair parity2 = ParityFilePair.getParityFile(
Codec.getCodec("xor"),
srcPath2,
conf);
Path srcParityPath2 = parity2.getPath();
assertTrue(raidFs.exists(srcParityPath));
assertTrue(raidFs.exists(srcParityPath2));
// do the delete file
assertTrue(raidFs.delete(srcPath));
// verify the results.
assertFalse(raidFs.exists(srcPath));
assertFalse(raidFs.exists(srcParityPath));
assertTrue(raidFs.exists(srcParityPath2));
// do the undelete using non-exist userName
String nonExistedUser = UUID.randomUUID().toString();
assertFalse(raidFs.undelete(srcPath, nonExistedUser));
// verify the results
assertFalse(raidFs.exists(srcPath));
assertFalse(raidFs.exists(srcParityPath));
assertTrue(raidFs.exists(srcParityPath2));
// do the undelete file using current userName
assertTrue(raidFs.undelete(srcPath, null));
//verify the results.
assertTrue(raidFs.exists(srcPath));
assertTrue(raidFs.exists(srcParityPath));
assertTrue(raidFs.exists(srcParityPath2));
// delete the dir
assertTrue(raidFs.delete(srcPath2.getParent()));
// verify the results.
assertFalse(raidFs.exists(srcPath2.getParent()));
assertFalse(raidFs.exists(srcParityPath));
assertFalse(raidFs.exists(srcParityPath2));
assertFalse(raidFs.exists(srcParityPath.getParent()));
// undelete the dir
assertTrue(raidFs.undelete(srcPath2.getParent(), null));
// verify the results.
assertTrue(raidFs.exists(srcPath));
assertTrue(raidFs.exists(srcPath2));
assertTrue(raidFs.exists(srcParityPath));
assertTrue(raidFs.exists(srcParityPath2));
} finally {
stopCluster();
}
}