protected static void setupBulkLoadConfigsForCluster(Configuration config,
    String clusterReplicationId) throws Exception {
    config.setBoolean(HConstants.REPLICATION_BULKLOAD_ENABLE_KEY, true);
    config.set(REPLICATION_CLUSTER_ID, clusterReplicationId);
    File sourceConfigFolder = testFolder.newFolder(clusterReplicationId);
    File sourceConfigFile = new File(sourceConfigFolder.getAbsolutePath() + "/hbase-site.xml");
    config.writeXml(new FileOutputStream(sourceConfigFile));
    config.set(REPLICATION_CONF_DIR, testFolder.getRoot().getAbsolutePath());
  }
Integration test for bulk load replication. Defines three clusters, with the following
replication topology: "1 <-> 2 <-> 3" (active-active between 1 and 2, and active-active between 2
and 3). For each of defined test clusters, it performs a bulk load, asserting values on bulk
loaded file gets replicated to other two peers. Since we are doing 3 bulk loads, with the given
replication topology all these bulk loads should get replicated only once on each peer. To assert
this, this test defines a preBulkLoad coprocessor and adds it to all test table regions, on each
of the clusters. This CP counts the amount of times bulk load actually gets invoked, certifying
we are not entering the infinite loop condition addressed by HBASE-22380.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestBulkLoadReplication.java