Esempio n. 1
0
 /**
  * Verify that the current directory exists and that the previous directory does not exist. Verify
  * that current hasn't been modified by comparing the checksum of all it's containing files with
  * their original checksum. Note that we do not check that previous is removed on the DataNode
  * because its removal is asynchronous therefore we have no reliable way to know when it will
  * happen.
  */
 void checkResult(String[] nameNodeDirs, String[] dataNodeDirs) throws IOException {
   for (int i = 0; i < nameNodeDirs.length; i++) {
     assertTrue(new File(nameNodeDirs[i], "current").isDirectory());
     assertTrue(new File(nameNodeDirs[i], "current/VERSION").isFile());
     assertTrue(new File(nameNodeDirs[i], "current/edits").isFile());
     assertTrue(new File(nameNodeDirs[i], "current/fsimage").isFile());
     assertTrue(new File(nameNodeDirs[i], "current/fstime").isFile());
   }
   for (int i = 0; i < dataNodeDirs.length; i++) {
     assertEquals(
         UpgradeUtilities.checksumContents(DATA_NODE, new File(dataNodeDirs[i], "current")),
         UpgradeUtilities.checksumMasterContents(DATA_NODE));
   }
   for (int i = 0; i < nameNodeDirs.length; i++) {
     assertFalse(new File(nameNodeDirs[i], "previous").isDirectory());
   }
 }