DefaultReplicationStoreManager extends AbstractLifecycleObservable implements ReplicationStoreManager { public long getGcCount() { return gcCount.get(); } DefaultReplicationStoreManager(KeeperConfig keeperConfig, String clusterName, String shardName, String keeperRunid, File baseDir, KeeperMonitor keeperMonitor); @Override synchronized ReplicationStore createIfNotExist(); @Override synchronized ReplicationStore create(); @Override synchronized ReplicationStore getCurrent(); @Override String getClusterName(); @Override String getShardName(); @Override void destroy(); long getGcCount(); @Override String toString(); File getBaseDir();  }
@Test public void testCancelGc() throws Exception { DefaultReplicationStoreManager replicationStoreManager = (DefaultReplicationStoreManager) createReplicationStoreManager( keeperConfig); LifecycleHelper.initializeIfPossible(replicationStoreManager); LifecycleHelper.startIfPossible(replicationStoreManager); sleep(replicationStoreGcIntervalSeconds * 2000); LifecycleHelper.stopIfPossible(replicationStoreManager); LifecycleHelper.disposeIfPossible(replicationStoreManager); long gcCount = replicationStoreManager.getGcCount(); Assert.assertTrue(gcCount > 0); sleep(replicationStoreGcIntervalSeconds * 2000); Assert.assertEquals(gcCount, replicationStoreManager.getGcCount()); }