private void verifyTableListForPolicy(FileSystem fileSystem, String dumpLocation, String[] tableList) throws Throwable {
    String hiveDumpLocation = dumpLocation + File.separator + ReplUtils.REPL_HIVE_BASE_DIR;
    Path tableListFile = new Path(hiveDumpLocation, ReplUtils.REPL_TABLE_LIST_DIR_NAME);
    tableListFile = new Path(tableListFile, primaryDbName.toLowerCase());

    if (tableList == null) {
      Assert.assertFalse(fileSystem.exists(tableListFile));
      return;
    } else {
      Assert.assertTrue(fileSystem.exists(tableListFile));
    }

    BufferedReader reader = null;
    try {
      InputStream inputStream = fileSystem.open(tableListFile);
      reader = new BufferedReader(new InputStreamReader(inputStream));
      Set tableNames = new HashSet<>(Arrays.asList(tableList));
      int numTable = 0;
      for (String line = reader.readLine(); line != null; line = reader.readLine()) {
        numTable++;
        Assert.assertTrue(tableNames.contains(line));
      }
      Assert.assertEquals(numTable, tableList.length);
    } finally {
      if (reader != null) {
        reader.close();
      }
    }
  }
Test replication scenarios with staging on replica.
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosExclusiveReplica.java