DefaultKeeperActiveElectAlgorithmManager implements KeeperActiveElectAlgorithmManager { @Override public KeeperActiveElectAlgorithm get(String clusterId, String shardId) { logger.debug("[get][active dc, use default]"); return new DefaultKeeperActiveElectAlgorithm(); }  @Override KeeperActiveElectAlgorithm get(String clusterId, String shardId); void setDcMetaCache(DcMetaCache dcMetaCache);  }
@Test public void testActive(){ when(dcMetaCache.isCurrentDcPrimary(getClusterId(), getShardId())).thenReturn(true); Assert.assertTrue(kaem.get(clusterId, shardId) instanceof DefaultKeeperActiveElectAlgorithm); }
@Test public void testBackup(){ when(dcMetaCache.isCurrentDcPrimary(getClusterId(), getShardId())).thenReturn(false); Assert.assertTrue(kaem.get(clusterId, shardId) instanceof DefaultKeeperActiveElectAlgorithm); }