// cehck that the checksum file is deleted for Checksum file system.
public void testDeletionOfCheckSum() throws Exception {
Configuration conf = new Configuration();
URI uri = URI.create("ramfs://mapoutput" + "_tmp");
InMemoryFileSystem inMemFs = (InMemoryFileSystem)FileSystem.get(uri, conf);
Path testPath = new Path("/file_1");
inMemFs.reserveSpaceWithCheckSum(testPath, 1024);
FSDataOutputStream fout = inMemFs.create(testPath);
fout.write("testing".getBytes());
fout.close();
assertTrue("checksum exists", inMemFs.exists(inMemFs.getChecksumFile(testPath)));
inMemFs.delete(testPath, true);
assertTrue("checksum deleted", !inMemFs.exists(inMemFs.getChecksumFile(testPath)));
// check for directories getting deleted.
testPath = new Path("/tesdir/file_1");
inMemFs.reserveSpaceWithCheckSum(testPath, 1024);
fout = inMemFs.create(testPath);
fout.write("testing".getBytes());
fout.close();
testPath = new Path("/testdir/file_2");
inMemFs.reserveSpaceWithCheckSum(testPath, 1024);
fout = inMemFs.create(testPath);
fout.write("testing".getBytes());
fout.close();
inMemFs.delete(testPath, true);
// Filesystem is empty
boolean expectedExceptionThrown = false;
try {
inMemFs.listStatus(new Path("/"));
} catch (FileNotFoundException e) {
expectedExceptionThrown = true;
}
assertTrue("Expected exception not thrown", expectedExceptionThrown);
}