@Test
  public void testClaimQueue() throws Exception {
    String peerId = "1";
    addPeerAndWait(peerId, "error", false);
    ServerName serverName = ServerName.valueOf("hostname0.example.org", 12345, 123);
    String walName1 = serverName.toString() + ".1";
    createWALFile(new Path(oldLogDir, walName1));
    ReplicationQueueId queueId = new ReplicationQueueId(serverName, peerId);
    ReplicationQueueStorage queueStorage = manager.getQueueStorage();
    queueStorage.setOffset(queueId, "", new ReplicationGroupOffset(peerId, 0),
      Collections.emptyMap());
    manager.claimQueue(queueId);
    assertThat(manager.getOldSources(), hasSize(1));
  }
Remove a peer and wait for it to get cleaned up
hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManager.java