ExecutionServiceTest.java 文件源码

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

项目:score 作者:
@Test
// branch is running, and parent is paused by the user -> branch should be paused
public void handlePausedFlow_UserPausedParentTest() throws InterruptedException {
    final Long executionId = 111L;
    final String branch_id = "branch_id";

    Execution exe = getExecutionObjToPause(executionId, branch_id);

    // branch is not paused
    ExecutionSummary branch = new ExecutionSummary();
    branch.setStatus(ExecutionStatus.RUNNING);
    when(workerConfigurationService.isExecutionPaused(executionId, branch_id)).thenReturn(false);

    // parent is paused
    ExecutionSummary parent = new ExecutionSummary();
    parent.setPauseReason(PauseReason.USER_PAUSED);
    parent.setStatus(ExecutionStatus.PENDING_PAUSE);
    when(workerConfigurationService.isExecutionPaused(executionId, null)).thenReturn(true);
    when(pauseResumeService.readPausedExecution(executionId, null)).thenReturn(parent);

    boolean result = executionService.handlePausedFlow(exe);

    Mockito.verify(pauseResumeService, VerificationModeFactory.times(1)).pauseExecution(executionId, branch_id, PauseReason.USER_PAUSED);
    Mockito.verify(pauseResumeService, VerificationModeFactory.times(1)).writeExecutionObject(executionId, branch_id, exe);
    Assert.assertTrue(result);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号