private JSONObject getDiffExtTblLocs(String fileLoc1, String fileLoc2, 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);
    }
    File f1 = new File(fileLoc1);
    File f2 = new File(fileLoc2);
    for (File outFile1 : f1.listFiles()) {
      for (File outFile2 : f2.listFiles()) {
        HiveMetaTool.execute(new String[] {"-diffExtTblLocs", outFile1.getAbsolutePath(), outFile2.getAbsolutePath(), 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