TestNonAggregatingLogHandler.java 文件源码

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

项目:aliyun-oss-hadoop-fs 作者:
/**
 * Function to verify that the DeletionService object received the right
 * requests.
 * 
 * @param delService the DeletionService mock which we verify against
 * 
 * @param user the user name to use when verifying the deletion
 * 
 * @param timeout amount in milliseconds to wait before we decide the calls
 * didn't come through
 * 
 * @param matchPaths the paths to match in the delete calls
 * 
 * @throws WantedButNotInvoked if the calls could not be verified
 */
static void testDeletionServiceCall(DeletionService delService, String user,
    long timeout, Path... matchPaths) {

  long verifyStartTime = System.currentTimeMillis();
  WantedButNotInvoked notInvokedException = null;
  boolean matched = false;
  while (!matched && System.currentTimeMillis() < verifyStartTime + timeout) {
    try {
      verify(delService).delete(eq(user), (Path) eq(null),
        Mockito.argThat(new DeletePathsMatcher(matchPaths)));
      matched = true;
    } catch (WantedButNotInvoked e) {
      notInvokedException = e;
      try {
        Thread.sleep(50l);
      } catch (InterruptedException i) {
      }
    }
  }
  if (!matched) {
    throw notInvokedException;
  }
  return;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号