private void verifyTableLocations(String srcDb, Database replDb, List<String> tables, boolean customLocOntgt)
          throws Exception {
    String tgtExtBase = replica.getConf().get(HiveConf.ConfVars.REPL_EXTERNAL_TABLE_BASE_DIR.varname);
    for (String tname: tables) {
      Table table = replica.getTable(replicatedDbName, tname);
      if ("EXTERNAL_TABLE".equals(table.getTableType())) {
        String pathOnSrc = new Path(primary.getTable(srcDb, tname).getSd().getLocation()).toUri().getPath();
        Assert.assertEquals(new Path(table.getSd().getLocation()), new Path(tgtExtBase, pathOnSrc.substring(1)));
      } else {
        //Managed Table case
        Path tblPathOnTgt  = customLocOntgt
                ? new Path(replDb.getManagedLocationUri(), tname)
                : new Path(replica.warehouseRoot, replicatedDbName.toLowerCase()  + ".db" + "/" + tname );
        Assert.assertEquals(new Path(table.getSd().getLocation()), tblPathOnTgt);
      }
    }
  }
Test replication scenarios with staging on replica.
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosExclusiveReplica.java