private JSONObject getListExtTblLocs(String dbName, String outLocation) throws Exception {
    File f = new File(outLocation);
    if (f.exists()) {
      FileUtil.fullyDelete(f);
    }
    if (!(new File(outLocation).mkdirs())) {
      throw new RuntimeException("Could not create " + outLocation);
    }
    HiveMetaTool.execute(new String[] {"-listExtTblLocs", dbName, outLocation});
    for (File outFile : f.listFiles()) {
      String contents = new String(Files.readAllBytes(Paths.get(outFile.getAbsolutePath())));
      return new JSONObject(contents);
    }
    return null;
  }
Integration tests for the HiveMetaTool program.
itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/tools/metatool/TestHiveMetaTool.java