SkyDnsServiceRegistrarTest.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:helios-skydns 作者:
@Test
public void testUnRegistrationNotRefreshedAnyMore() throws Exception {
  final SkyDnsServiceRegistrar registrar = makeRegistrar();
  when(client.set(ETCD_KEY, EXPECTED, TTL))
      .thenReturn(Futures.immediateFuture(response));

  final ServiceRegistrationHandle handle = registrar.register(
      new ServiceRegistration(ENDPOINTS));
  verify(client, timeout(WAIT_TIMEOUT)).set(ETCD_KEY, EXPECTED, TTL);

  when(client.delete(ETCD_KEY)).thenReturn(Futures.immediateFuture(response));
  registrar.unregister(handle);
  verify(client, timeout(WAIT_TIMEOUT)).delete(ETCD_KEY);

  Thread.sleep(2000);
  verify(client, VerificationModeFactory.noMoreInteractions()).set(ETCD_KEY, EXPECTED, TTL);
  registrar.close();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号