@Test
  public void testBasePeerConfigsForReplicationPeer() throws Exception {
    LOG.info("testBasePeerConfigsForPeerMutations");
    String firstCustomPeerConfigKey = "hbase.xxx.custom_config";
    String firstCustomPeerConfigValue = "test";
    String firstCustomPeerConfigUpdatedValue = "test_updated";

    String secondCustomPeerConfigKey = "hbase.xxx.custom_second_config";
    String secondCustomPeerConfigValue = "testSecond";
    String secondCustomPeerConfigUpdatedValue = "testSecondUpdated";
    try {
      baseConfiguration.set(ReplicationPeerConfigUtil.HBASE_REPLICATION_PEER_BASE_CONFIG,
        firstCustomPeerConfigKey.concat("=").concat(firstCustomPeerConfigValue));
      startMiniClusters(2);
      addPeer("1", 0, 1);
      addPeer("2", 0, 1);
      Admin admin = utilities[0].getAdmin();

      // Validates base configs 1 is present for both peer.
      Assert.assertEquals(firstCustomPeerConfigValue,
        admin.getReplicationPeerConfig("1").getConfiguration().get(firstCustomPeerConfigKey));
      Assert.assertEquals(firstCustomPeerConfigValue,
        admin.getReplicationPeerConfig("2").getConfiguration().get(firstCustomPeerConfigKey));

      // override value of configuration 1 for peer "1".
      ReplicationPeerConfig updatedReplicationConfigForPeer1 =
        ReplicationPeerConfig.newBuilder(admin.getReplicationPeerConfig("1"))
          .putConfiguration(firstCustomPeerConfigKey, firstCustomPeerConfigUpdatedValue).build();

      // add configuration 2 for peer "2".
      ReplicationPeerConfig updatedReplicationConfigForPeer2 =
        ReplicationPeerConfig.newBuilder(admin.getReplicationPeerConfig("2"))
          .putConfiguration(secondCustomPeerConfigKey, secondCustomPeerConfigUpdatedValue).build();

      admin.updateReplicationPeerConfig("1", updatedReplicationConfigForPeer1);
      admin.updateReplicationPeerConfig("2", updatedReplicationConfigForPeer2);

      // validates configuration is overridden by updateReplicationPeerConfig
      Assert.assertEquals(firstCustomPeerConfigUpdatedValue,
        admin.getReplicationPeerConfig("1").getConfiguration().get(firstCustomPeerConfigKey));
      Assert.assertEquals(secondCustomPeerConfigUpdatedValue,
        admin.getReplicationPeerConfig("2").getConfiguration().get(secondCustomPeerConfigKey));

      // Add second config to base config and perform restart.
      utilities[0].getConfiguration().set(
        ReplicationPeerConfigUtil.HBASE_REPLICATION_PEER_BASE_CONFIG,
        firstCustomPeerConfigKey.concat("=").concat(firstCustomPeerConfigValue).concat(";")
          .concat(secondCustomPeerConfigKey).concat("=").concat(secondCustomPeerConfigValue));

      utilities[0].shutdownMiniHBaseCluster();
      utilities[0].restartHBaseCluster(1);
      admin = utilities[0].getAdmin();

      // Configurations should be updated after restart again
      Assert.assertEquals(firstCustomPeerConfigValue,
        admin.getReplicationPeerConfig("1").getConfiguration().get(firstCustomPeerConfigKey));
      Assert.assertEquals(firstCustomPeerConfigValue,
        admin.getReplicationPeerConfig("2").getConfiguration().get(firstCustomPeerConfigKey));

      Assert.assertEquals(secondCustomPeerConfigValue,
        admin.getReplicationPeerConfig("1").getConfiguration().get(secondCustomPeerConfigKey));
      Assert.assertEquals(secondCustomPeerConfigValue,
        admin.getReplicationPeerConfig("2").getConfiguration().get(secondCustomPeerConfigKey));
    } finally {
      shutDownMiniClusters();
      baseConfiguration.unset(ReplicationPeerConfigUtil.HBASE_REPLICATION_PEER_BASE_CONFIG);
    }
  }
Tests that base replication peer configs are applied on peer creation and the configs are
overriden if updated as part of updateReplicationPeerConfig()
hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMasterReplication.java