ConfigServiceWithCacheTest.java 文件源码

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

项目:apollo-custom 作者:
@Test
public void testFindLatestActiveReleaseWithReleaseNotFound() throws Exception {
  when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn(null);
  when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn(null);

  Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName,
      someNotificationMessages);
  Release anotherRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName,
      someNamespaceName, someNotificationMessages);

  int retryTimes = 100;

  for (int i = 0; i < retryTimes; i++) {
    configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName,
        someNamespaceName, someNotificationMessages);
  }

  assertNull(release);
  assertNull(anotherRelease);

  verify(releaseMessageService, times(1)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey));
  verify(releaseService, times(1)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号