@Test public void getQualityStatus_should_return_CRASHED_when_DONE_execution_has_empty_qualityThresholds() { long projectId = 1; when(executionRepository.findByProjectIdAndJobUrl(projectId, "url")).thenReturn(new Execution() .withStatus(JobStatus.DONE) .withBlockingValidation(Boolean.TRUE) .withQualitySeverities("any") .withQualityThresholds("") .withQualityStatus(QualityStatus.WARNING)); String status = cut.getQualityStatus(projectId, "url"); assertThat(status).isEqualTo("CRASHED"); }
public String getQualityStatus(long projectId, String jobUrl) { final Execution execution = executionRepository.findByProjectIdAndJobUrl(projectId, jobUrl); if (execution == null) { return STILL_COMPUTING; } if (execution.getStatus() != JobStatus.DONE) { final Optional<ExecutionCompletionRequest> request = executionCompletionRequestRepository.findById(jobUrl); if (request.isPresent()) { return STILL_COMPUTING; } } if (crashed(execution)) { return "CRASHED"; } else if (execution.getBlockingValidation() != Boolean.TRUE) { return "NOT_BLOCKING"; } else if (StringUtils.isNotEmpty(execution.getDiscardReason())) { return "DISCARDED"; } return (execution.getQualityStatus() == null ? QualityStatus.INCOMPLETE : execution.getQualityStatus()).name(); }
ExecutionService { public String getQualityStatus(long projectId, String jobUrl) { final Execution execution = executionRepository.findByProjectIdAndJobUrl(projectId, jobUrl); if (execution == null) { return STILL_COMPUTING; } if (execution.getStatus() != JobStatus.DONE) { final Optional<ExecutionCompletionRequest> request = executionCompletionRequestRepository.findById(jobUrl); if (request.isPresent()) { return STILL_COMPUTING; } } if (crashed(execution)) { return "CRASHED"; } else if (execution.getBlockingValidation() != Boolean.TRUE) { return "NOT_BLOCKING"; } else if (StringUtils.isNotEmpty(execution.getDiscardReason())) { return "DISCARDED"; } return (execution.getQualityStatus() == null ? QualityStatus.INCOMPLETE : execution.getQualityStatus()).name(); } }
ExecutionService { public String getQualityStatus(long projectId, String jobUrl) { final Execution execution = executionRepository.findByProjectIdAndJobUrl(projectId, jobUrl); if (execution == null) { return STILL_COMPUTING; } if (execution.getStatus() != JobStatus.DONE) { final Optional<ExecutionCompletionRequest> request = executionCompletionRequestRepository.findById(jobUrl); if (request.isPresent()) { return STILL_COMPUTING; } } if (crashed(execution)) { return "CRASHED"; } else if (execution.getBlockingValidation() != Boolean.TRUE) { return "NOT_BLOCKING"; } else if (StringUtils.isNotEmpty(execution.getDiscardReason())) { return "DISCARDED"; } return (execution.getQualityStatus() == null ? QualityStatus.INCOMPLETE : execution.getQualityStatus()).name(); }  }
ExecutionService { public String getQualityStatus(long projectId, String jobUrl) { final Execution execution = executionRepository.findByProjectIdAndJobUrl(projectId, jobUrl); if (execution == null) { return STILL_COMPUTING; } if (execution.getStatus() != JobStatus.DONE) { final Optional<ExecutionCompletionRequest> request = executionCompletionRequestRepository.findById(jobUrl); if (request.isPresent()) { return STILL_COMPUTING; } } if (crashed(execution)) { return "CRASHED"; } else if (execution.getBlockingValidation() != Boolean.TRUE) { return "NOT_BLOCKING"; } else if (StringUtils.isNotEmpty(execution.getDiscardReason())) { return "DISCARDED"; } return (execution.getQualityStatus() == null ? QualityStatus.INCOMPLETE : execution.getQualityStatus()).name(); }  @Transactional(readOnly = true) Page<ExecutionWithHandlingCountsDTO> findAll(long projectId, Pageable pageable); @Transactional(readOnly = true) ExecutionWithCountryDeploymentsAndRunsAndExecutedScenariosAndTeamIdsAndErrorsAndProblemsDTO findOneWithRuns(long projectId, long id, ExecutionCriteriaDTO criteria); ExecutionDTO discard(long projectId, long id, String discardReason); ExecutionDTO unDiscard(long projectId, long id); void requestCompletion(long projectId, String jobUrl); String getQualityStatus(long projectId, String jobUrl); List<ExecutionDTO> getLatestEligibleVersions(long projectId); void uploadExecutionReport(long projectId, String projectCode, String branch, String cycle, MultipartFile zipFile); void processSpecificDirectory(CycleDefinition cycleDefinition, File executionDirectory); }
ExecutionService { public String getQualityStatus(long projectId, String jobUrl) { final Execution execution = executionRepository.findByProjectIdAndJobUrl(projectId, jobUrl); if (execution == null) { return STILL_COMPUTING; } if (execution.getStatus() != JobStatus.DONE) { final Optional<ExecutionCompletionRequest> request = executionCompletionRequestRepository.findById(jobUrl); if (request.isPresent()) { return STILL_COMPUTING; } } if (crashed(execution)) { return "CRASHED"; } else if (execution.getBlockingValidation() != Boolean.TRUE) { return "NOT_BLOCKING"; } else if (StringUtils.isNotEmpty(execution.getDiscardReason())) { return "DISCARDED"; } return (execution.getQualityStatus() == null ? QualityStatus.INCOMPLETE : execution.getQualityStatus()).name(); }  @Transactional(readOnly = true) Page<ExecutionWithHandlingCountsDTO> findAll(long projectId, Pageable pageable); @Transactional(readOnly = true) ExecutionWithCountryDeploymentsAndRunsAndExecutedScenariosAndTeamIdsAndErrorsAndProblemsDTO findOneWithRuns(long projectId, long id, ExecutionCriteriaDTO criteria); ExecutionDTO discard(long projectId, long id, String discardReason); ExecutionDTO unDiscard(long projectId, long id); void requestCompletion(long projectId, String jobUrl); String getQualityStatus(long projectId, String jobUrl); List<ExecutionDTO> getLatestEligibleVersions(long projectId); void uploadExecutionReport(long projectId, String projectCode, String branch, String cycle, MultipartFile zipFile); void processSpecificDirectory(CycleDefinition cycleDefinition, File executionDirectory);  }