/** * Gets the signature of the last status */ @Override public Signature getSignature() { return getLastStatus().getSignature(); } }
/** * Gets the last status of the last run, or <code>null</code> if no run has been performed. */ public ValidationRunStatus getLastStatus() { ValidationRun run = getLastRun(); if (run == null) { return null; } else { return run.getLastStatus(); } }
public boolean isPassed() { return getLastStatus().isPassed(); }
private boolean isPassed(Build build, ValidationStamp validationStamp) { List<ValidationRun> runs = structureService.getValidationRunsForBuildAndValidationStamp( build.getId(), validationStamp.getId(), 0, 1 ); if (runs.isEmpty()) { return false; } else { ValidationRun run = runs.get(0); return Objects.equals( run.getLastStatus().getStatusID(), ValidationRunStatusID.STATUS_PASSED ); } }
@Override public Event newValidationRunStatus(ValidationRun validationRun) { return Event.of(NEW_VALIDATION_RUN_STATUS) .withValidationRun(validationRun) .withValidationRunStatus(validationRun.getLastStatus().getStatusID()) .get(); }
@Override public Event newValidationRun(ValidationRun validationRun) { return Event.of(NEW_VALIDATION_RUN) .withValidationRun(validationRun) .withValidationRunStatus(validationRun.getLastStatus().getStatusID()) .get(); }
private void onNewValidationRun(Event event) { // Passed validation? ValidationRun validationRun = event.getEntity(ProjectEntityType.VALIDATION_RUN); if (Objects.equals( validationRun.getLastStatus().getStatusID(), ValidationRunStatusID.STATUS_PASSED)) { // Branch Branch branch = event.getEntity(ProjectEntityType.BRANCH); // Build Build build = event.getEntity(ProjectEntityType.BUILD); // Gets all promotion levels for this branch List<PromotionLevel> promotionLevels = structureService.getPromotionLevelListForBranch(branch.getId()); // Gets all validation stamps for this branch List<ValidationStamp> validationStamps = structureService.getValidationStampListForBranch(branch.getId()); // Gets the promotion levels which have an auto promotion property promotionLevels.forEach(promotionLevel -> checkPromotionLevel(build, promotionLevel, validationStamps)); } }
public EventBuilder withValidationRun(ValidationRun validationRun) { return withBuild(validationRun.getBuild()).with(validationRun.getValidationStamp()).with(validationRun).with(validationRun.getLastStatus().getSignature()); }