LeakyBucketBasedMasterReplicationListener implements RedisMasterReplication.RedisMasterReplicationObserver { @VisibleForTesting protected void releaseToken() { holdToken.set(false); resourceManager.getLeakyBucket().release(); } LeakyBucketBasedMasterReplicationListener(RedisMasterReplication redisMasterReplication,
                                                     RedisKeeperServer redisKeeperServer,
                                                     KeeperResourceManager resourceManager,
                                                     ScheduledExecutorService scheduled); @Override void onMasterConnected(); @Override boolean canSendPsync(); @Override void onMasterDisconnected(); @Override void endWriteRdb(); @Override void onContinue(String requestReplId, String responseReplId); @Override void onFullSync(); @Override void reFullSync(); @Override void onDumpFinished(); @Override void onDumpFail(); @Override void beginWriteRdb(EofType eofType, long masterRdbOffset);  }
@Test public void testReleaseToken() { listener = spy(listener); listener.releaseToken(); verify(leakyBucket, times(1)).release(); int INIT_STATE = 1; Assert.assertEquals(INIT_STATE, listener.psyncEverSucceed.get()); }