TestZKProcedure.java 文件源码

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

项目:PyroDB 作者:
/**
 * Wait for the coordinator task to complete, and verify all the mocks
 * @param task to wait on
 * @throws Exception on unexpected failure
 */
private void waitAndVerifyProc(Procedure proc, VerificationMode prepare,
    VerificationMode commit, VerificationMode cleanup, VerificationMode finish, boolean opHasError)
    throws Exception {
  boolean caughtError = false;
  try {
    proc.waitForCompleted();
  } catch (ForeignException fe) {
    caughtError = true;
  }
  // make sure that the task called all the expected phases
  Mockito.verify(proc, prepare).sendGlobalBarrierStart();
  Mockito.verify(proc, commit).sendGlobalBarrierReached();
  Mockito.verify(proc, finish).sendGlobalBarrierComplete();
  assertEquals("Operation error state was unexpected", opHasError, proc.getErrorMonitor()
      .hasException());
  assertEquals("Operation error state was unexpected", opHasError, caughtError);

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号