Java 类org.apache.hadoop.hdfs.TestDFSUpgradeFromImage.ClusterVerifier 实例源码

项目:hadoop    文件:TestDatanodeStartupFixesLegacyStorageIDs.java   
/**
 * Perform a upgrade using the test image corresponding to
 * testCaseName.
 *
 * @param testCaseName
 * @param expectedStorageId if null, then the upgrade generates a new
 *                          unique storage ID.
 * @throws IOException
 */
private static void runLayoutUpgradeTest(final String testCaseName,
                                         final String expectedStorageId)
    throws IOException {
  TestDFSUpgradeFromImage upgrade = new TestDFSUpgradeFromImage();
  upgrade.unpackStorage(testCaseName + ".tgz", testCaseName + ".txt");
  Configuration conf = new Configuration(TestDFSUpgradeFromImage.upgradeConf);
  initStorageDirs(conf, testCaseName);
  upgradeAndVerify(upgrade, conf, new ClusterVerifier() {
    @Override
    public void verifyClusterPostUpgrade(MiniDFSCluster cluster) throws IOException {
      // Verify that a GUID-based storage ID was generated.
      final String bpid = cluster.getNamesystem().getBlockPoolId();
      StorageReport[] reports =
          cluster.getDataNodes().get(0).getFSDataset().getStorageReports(bpid);
      assertThat(reports.length, is(1));
      final String storageID = reports[0].getStorage().getStorageID();
      assertTrue(DatanodeStorage.isValidStorageId(storageID));

      if (expectedStorageId != null) {
        assertThat(storageID, is(expectedStorageId));
      }
    }
  });
}
项目:aliyun-oss-hadoop-fs    文件:TestDatanodeStartupFixesLegacyStorageIDs.java   
/**
 * Perform a upgrade using the test image corresponding to
 * testCaseName.
 *
 * @param testCaseName
 * @param expectedStorageId if null, then the upgrade generates a new
 *                          unique storage ID.
 * @throws IOException
 */
private static void runLayoutUpgradeTest(final String testCaseName,
                                         final String expectedStorageId)
    throws IOException {
  TestDFSUpgradeFromImage upgrade = new TestDFSUpgradeFromImage();
  upgrade.unpackStorage(testCaseName + ".tgz", testCaseName + ".txt");
  Configuration conf = new Configuration(TestDFSUpgradeFromImage.upgradeConf);
  initStorageDirs(conf, testCaseName);
  upgradeAndVerify(upgrade, conf, new ClusterVerifier() {
    @Override
    public void verifyClusterPostUpgrade(MiniDFSCluster cluster) throws IOException {
      // Verify that a GUID-based storage ID was generated.
      final String bpid = cluster.getNamesystem().getBlockPoolId();
      StorageReport[] reports =
          cluster.getDataNodes().get(0).getFSDataset().getStorageReports(bpid);
      assertThat(reports.length, is(1));
      final String storageID = reports[0].getStorage().getStorageID();
      assertTrue(DatanodeStorage.isValidStorageId(storageID));

      if (expectedStorageId != null) {
        assertThat(storageID, is(expectedStorageId));
      }
    }
  });
}
项目:big-c    文件:TestDatanodeStartupFixesLegacyStorageIDs.java   
/**
 * Perform a upgrade using the test image corresponding to
 * testCaseName.
 *
 * @param testCaseName
 * @param expectedStorageId if null, then the upgrade generates a new
 *                          unique storage ID.
 * @throws IOException
 */
private static void runLayoutUpgradeTest(final String testCaseName,
                                         final String expectedStorageId)
    throws IOException {
  TestDFSUpgradeFromImage upgrade = new TestDFSUpgradeFromImage();
  upgrade.unpackStorage(testCaseName + ".tgz", testCaseName + ".txt");
  Configuration conf = new Configuration(TestDFSUpgradeFromImage.upgradeConf);
  initStorageDirs(conf, testCaseName);
  upgradeAndVerify(upgrade, conf, new ClusterVerifier() {
    @Override
    public void verifyClusterPostUpgrade(MiniDFSCluster cluster) throws IOException {
      // Verify that a GUID-based storage ID was generated.
      final String bpid = cluster.getNamesystem().getBlockPoolId();
      StorageReport[] reports =
          cluster.getDataNodes().get(0).getFSDataset().getStorageReports(bpid);
      assertThat(reports.length, is(1));
      final String storageID = reports[0].getStorage().getStorageID();
      assertTrue(DatanodeStorage.isValidStorageId(storageID));

      if (expectedStorageId != null) {
        assertThat(storageID, is(expectedStorageId));
      }
    }
  });
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestDatanodeStartupFixesLegacyStorageIDs.java   
/**
 * Perform a upgrade using the test image corresponding to
 * testCaseName.
 *
 * @param testCaseName
 * @param expectedStorageId if null, then the upgrade generates a new
 *                          unique storage ID.
 * @throws IOException
 */
private static void runLayoutUpgradeTest(final String testCaseName,
                                         final String expectedStorageId)
    throws IOException {
  TestDFSUpgradeFromImage upgrade = new TestDFSUpgradeFromImage();
  upgrade.unpackStorage(testCaseName + ".tgz", testCaseName + ".txt");
  Configuration conf = new Configuration(TestDFSUpgradeFromImage.upgradeConf);
  initStorageDirs(conf, testCaseName);
  upgradeAndVerify(upgrade, conf, new ClusterVerifier() {
    @Override
    public void verifyClusterPostUpgrade(MiniDFSCluster cluster) throws IOException {
      // Verify that a GUID-based storage ID was generated.
      final String bpid = cluster.getNamesystem().getBlockPoolId();
      StorageReport[] reports =
          cluster.getDataNodes().get(0).getFSDataset().getStorageReports(bpid);
      assertThat(reports.length, is(1));
      final String storageID = reports[0].getStorage().getStorageID();
      assertTrue(DatanodeStorage.isValidStorageId(storageID));

      if (expectedStorageId != null) {
        assertThat(storageID, is(expectedStorageId));
      }
    }
  });
}
项目:hadoop    文件:TestDatanodeStartupFixesLegacyStorageIDs.java   
private static void upgradeAndVerify(final TestDFSUpgradeFromImage upgrade,
                                     final Configuration conf,
                                     final ClusterVerifier verifier)
    throws IOException{
  upgrade.upgradeAndVerify(new MiniDFSCluster.Builder(conf)
                               .numDataNodes(1)
                               .manageDataDfsDirs(false)
                               .manageNameDfsDirs(false), verifier);
}
项目:aliyun-oss-hadoop-fs    文件:TestDatanodeStartupFixesLegacyStorageIDs.java   
private static void upgradeAndVerify(final TestDFSUpgradeFromImage upgrade,
                                     final Configuration conf,
                                     final ClusterVerifier verifier)
    throws IOException{
  upgrade.upgradeAndVerify(new MiniDFSCluster.Builder(conf)
                               .numDataNodes(1)
                               .manageDataDfsDirs(false)
                               .manageNameDfsDirs(false), verifier);
}
项目:big-c    文件:TestDatanodeStartupFixesLegacyStorageIDs.java   
private static void upgradeAndVerify(final TestDFSUpgradeFromImage upgrade,
                                     final Configuration conf,
                                     final ClusterVerifier verifier)
    throws IOException{
  upgrade.upgradeAndVerify(new MiniDFSCluster.Builder(conf)
                               .numDataNodes(1)
                               .manageDataDfsDirs(false)
                               .manageNameDfsDirs(false), verifier);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestDatanodeStartupFixesLegacyStorageIDs.java   
private static void upgradeAndVerify(final TestDFSUpgradeFromImage upgrade,
                                     final Configuration conf,
                                     final ClusterVerifier verifier)
    throws IOException{
  upgrade.upgradeAndVerify(new MiniDFSCluster.Builder(conf)
                               .numDataNodes(1)
                               .manageDataDfsDirs(false)
                               .manageNameDfsDirs(false), verifier);
}