cnode.stop();
cnode.join();
cnode = null;
FileStatus srcStat = fileSys.getFileStatus(file1);
LocatedBlocks locations = getBlockLocations(file1, srcStat.getLen());
DistributedFileSystem dfs = (DistributedFileSystem)fileSys;
ClientProtocol namenode = dfs.getClient().namenode;
String[] corruptFiles = DFSUtil.getCorruptFiles(dfs);
assertEquals(corruptFiles.length, 0);
// Corrupt blocks in two different stripes. We can fix them.
TestRaidDfs.corruptBlock(file1, locations.get(0).getBlock(),
NUM_DATANODES, true, dfsCluster); // delete block
TestRaidDfs.corruptBlock(file1, locations.get(4).getBlock(),
NUM_DATANODES, false, dfsCluster); // corrupt block
TestRaidDfs.corruptBlock(file1, locations.get(6).getBlock(),
NUM_DATANODES, true, dfsCluster); // delete last (partial) block
LocatedBlock[] toReport = new LocatedBlock[3];
toReport[0] = locations.get(0);
toReport[1] = locations.get(4);
toReport[2] = locations.get(6);
namenode.reportBadBlocks(toReport);
corruptFiles = DFSUtil.getCorruptFiles(dfs);
assertEquals(corruptFiles.length, 1);
assertEquals(corruptFiles[0], file1.toString());