ZookeeperShardManagerClient implements ShardManagerClient { @Override public boolean waitSlavesApproaching(String shardId, long timeoutMs) throws ShardManagerException, InterruptedException { return waitCondition(shardId, getSlaveApproachingChecker(), timeoutMs); } ZookeeperShardManagerClient(String serviceName, String clientName, String connectString, Config config); @Override void startObserving(String shardId, String observedShardId, long timeoutMs); @Override void stopObserving(String shardId, String observedShardId, long timeoutMs); @Override void migrateBuckets(Range<Integer> splitRange, String fromShardId, String toShardId, long timeoutMs); @Override boolean waitSlavesSynced(String shardId, long timeoutMs); @Override boolean waitSlavesApproaching(String shardId, long timeoutMs); @Override void setBuckets(Range<Integer> splitRange, String fromShardId, String toShardId, boolean migrationComplete); @Override void rollbackBuckets(Range<Integer> splitRange); @Override void stop();  }
@Test public void testWaitSlavesApproaching() throws Exception { for (Config.ConfigMember m : config.getMembersInShard("shard2")) { ShardManager shardManager = shardManagers.get(m.getHostId()); when(shardManager.waitSlavesApproaching(any(), anyLong())).thenReturn(true); } client.startObserving("shard2", "shard1", 1000); assertTrue(client.waitSlavesApproaching("shard2", 1000)); }