TestZKProcedure.java 文件源码

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

项目:HIndex 作者:
/**
 * Wait for the coordinator task to complete, and verify all the mocks
 * @param task to wait on
 * @throws Exception on unexpected failure
 */
private void waitAndVerifySubproc(Subprocedure op, VerificationMode prepare,
    VerificationMode commit, VerificationMode cleanup, VerificationMode finish, boolean opHasError)
    throws Exception {
  boolean caughtError = false;
  try {
    op.waitForLocallyCompleted();
  } catch (ForeignException fe) {
    caughtError = true;
  }
  // make sure that the task called all the expected phases
  Mockito.verify(op, prepare).acquireBarrier();
  Mockito.verify(op, commit).insideBarrier();
  // We cannot guarantee that cleanup has run so we don't check it.

  assertEquals("Operation error state was unexpected", opHasError, op.getErrorCheckable()
      .hasException());
  assertEquals("Operation error state was unexpected", opHasError, caughtError);

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号