@Test
  public void testEnableReplicationForExplicitSetTableCfs() throws Exception {
    TableName tableName2 = TableName.valueOf(tableName.getNameAsString() + "2");
    // Only create table in source cluster
    createTableWithDefaultConf(tableName);
    createTableWithDefaultConf(tableName2);
    assertFalse("Table should not exists in the peer cluster", admin2.tableExists(tableName).get());
    assertFalse("Table should not exists in the peer cluster",
      admin2.tableExists(tableName2).get());

    Map<TableName, List<String>> tableCfs = new HashMap<>();
    tableCfs.put(tableName, null);
    ReplicationPeerConfigBuilder rpcBuilder =
      ReplicationPeerConfig.newBuilder(admin.getReplicationPeerConfig(ID_SECOND).get())
        .setReplicateAllUserTables(false).setTableCFsMap(tableCfs);
    try {
      // Only add tableName to replication peer config
      admin.updateReplicationPeerConfig(ID_SECOND, rpcBuilder.build()).join();
      admin.enableTableReplication(tableName2).join();
      assertFalse("Table should not be created if user has set table cfs explicitly for the "
        + "peer and this is not part of that collection", admin2.tableExists(tableName2).get());

      // Add tableName2 to replication peer config, too
      tableCfs.put(tableName2, null);
      rpcBuilder.setTableCFsMap(tableCfs);
      admin.updateReplicationPeerConfig(ID_SECOND, rpcBuilder.build()).join();
      admin.enableTableReplication(tableName2).join();
      assertTrue(
        "Table should be created if user has explicitly added table into table cfs collection",
        admin2.tableExists(tableName2).get());
    } finally {
      rpcBuilder.setTableCFsMap(null).setReplicateAllUserTables(true).build();
      admin.updateReplicationPeerConfig(ID_SECOND, rpcBuilder.build()).join();
    }
  }
Class to test asynchronous replication admin operations when more than 1 cluster
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncReplicationAdminApiWithClusters.java