@Test public void execute_fail() { HistoryEntryImpl entry = new HistoryEntryImpl(); entry.setState(STATE.FINISHED); ExecutionResult singleResult = new ExecutionResult(ExecutionState.FAILED, "", "", "", null, ""); entry.getSingleResults().add(singleResult); history.add(entry); Result result = check.execute(); assertEquals(Result.Status.CRITICAL, result.getStatus()); }
@Override public Result execute() { final FormattingResultLog resultLog = new FormattingResultLog(); try { List<HistoryEntry> history = aecuService.getHistory(0, 1); if (history.isEmpty()) { resultLog.info("No runs found"); } else { HistoryEntry entry = history.get(0); switch (entry.getResult()) { case FAILURE: resultLog.critical("Last execution failed"); break; case SUCCESS: resultLog.info("Last run was successful"); break; case UNKNOWN: resultLog.warn("Last execution is still running"); break; default: resultLog.warn("Last execution is still ongoing"); } } } catch (AecuException e) { resultLog.critical(e.getMessage()); } return new Result(resultLog); }
LastRunHealthCheck implements HealthCheck { @Override public Result execute() { final FormattingResultLog resultLog = new FormattingResultLog(); try { List<HistoryEntry> history = aecuService.getHistory(0, 1); if (history.isEmpty()) { resultLog.info("No runs found"); } else { HistoryEntry entry = history.get(0); switch (entry.getResult()) { case FAILURE: resultLog.critical("Last execution failed"); break; case SUCCESS: resultLog.info("Last run was successful"); break; case UNKNOWN: resultLog.warn("Last execution is still running"); break; default: resultLog.warn("Last execution is still ongoing"); } } } catch (AecuException e) { resultLog.critical(e.getMessage()); } return new Result(resultLog); } }
LastRunHealthCheck implements HealthCheck { @Override public Result execute() { final FormattingResultLog resultLog = new FormattingResultLog(); try { List<HistoryEntry> history = aecuService.getHistory(0, 1); if (history.isEmpty()) { resultLog.info("No runs found"); } else { HistoryEntry entry = history.get(0); switch (entry.getResult()) { case FAILURE: resultLog.critical("Last execution failed"); break; case SUCCESS: resultLog.info("Last run was successful"); break; case UNKNOWN: resultLog.warn("Last execution is still running"); break; default: resultLog.warn("Last execution is still ongoing"); } } } catch (AecuException e) { resultLog.critical(e.getMessage()); } return new Result(resultLog); }  }
LastRunHealthCheck implements HealthCheck { @Override public Result execute() { final FormattingResultLog resultLog = new FormattingResultLog(); try { List<HistoryEntry> history = aecuService.getHistory(0, 1); if (history.isEmpty()) { resultLog.info("No runs found"); } else { HistoryEntry entry = history.get(0); switch (entry.getResult()) { case FAILURE: resultLog.critical("Last execution failed"); break; case SUCCESS: resultLog.info("Last run was successful"); break; case UNKNOWN: resultLog.warn("Last execution is still running"); break; default: resultLog.warn("Last execution is still ongoing"); } } } catch (AecuException e) { resultLog.critical(e.getMessage()); } return new Result(resultLog); }  @Override Result execute(); }
LastRunHealthCheck implements HealthCheck { @Override public Result execute() { final FormattingResultLog resultLog = new FormattingResultLog(); try { List<HistoryEntry> history = aecuService.getHistory(0, 1); if (history.isEmpty()) { resultLog.info("No runs found"); } else { HistoryEntry entry = history.get(0); switch (entry.getResult()) { case FAILURE: resultLog.critical("Last execution failed"); break; case SUCCESS: resultLog.info("Last run was successful"); break; case UNKNOWN: resultLog.warn("Last execution is still running"); break; default: resultLog.warn("Last execution is still ongoing"); } } } catch (AecuException e) { resultLog.critical(e.getMessage()); } return new Result(resultLog); }  @Override Result execute();  }