HistoryUtil { public List<HistoryEntry> getHistory(int startIndex, int count, ResourceResolver resolver) { List<HistoryEntry> entries = new ArrayList<>(); if (count == 0) { return entries; } Resource base = resolver.getResource(HISTORY_BASE); Resource current = getLatestHistoryEntry(base); if (current == null) { return entries; } for (int i = 0; i < startIndex; i++) { current = getPreviousHistoryEntry(current); } for (int i = 0; i < count; i++) { if (current == null) { break; } entries.add(readHistoryEntry(current)); current = getPreviousHistoryEntry(current); } return entries; }  HistoryEntry createHistoryEntry(ResourceResolver resolver); void storeExecutionInHistory(HistoryEntry history, ExecutionResult result, ResourceResolver resolver); void finishHistoryEntry(HistoryEntry history, ResourceResolver resolver); List<HistoryEntry> getHistory(int startIndex, int count, ResourceResolver resolver); Resource getHistoryEntryResource(Resource child); HistoryEntry readHistoryEntry(Resource resource); ExecutionResult readHistorySingleResult(Resource resource); void purgeHistory(ResourceResolver resolver, int daysToKeep); void selfCheck(ResourceResolver resolver); static final String HISTORY_BASE; static final String NODE_FALLBACK; static final String ATTR_PATH; }
@Test public void getHistory() { List<HistoryEntry> entries = historyUtil.getHistory(0, 1, resolver); assertEquals(1, entries.size()); }