@Test public void storeExecutionInHistory() throws AecuException { HistoryEntryImpl history = new HistoryEntryImpl(); history.setState(STATE.RUNNING); service.storeExecutionInHistory(history, null); verify(historyUtil, times(1)).storeExecutionInHistory(history, null, resolver); }
@Override public HistoryEntry storeExecutionInHistory(HistoryEntry history, ExecutionResult result) throws AecuException { if ((history == null) || !STATE.RUNNING.equals(history.getState())) { throw new AecuException("Invalid history entry."); } history.getSingleResults().add(result); try (ResourceResolver resolver = resolverService.getServiceResourceResolver()) { historyUtil.storeExecutionInHistory(history, result, resolver); resolver.commit(); return history; } catch (LoginException e) { throw new AecuException(ERR_NO_RESOLVER, e); } catch (PersistenceException e) { throw new AecuException("Unable to add history entry " + history.getRepositoryPath(), e); } }
AecuServiceImpl implements AecuService { @Override public HistoryEntry storeExecutionInHistory(HistoryEntry history, ExecutionResult result) throws AecuException { if ((history == null) || !STATE.RUNNING.equals(history.getState())) { throw new AecuException("Invalid history entry."); } history.getSingleResults().add(result); try (ResourceResolver resolver = resolverService.getServiceResourceResolver()) { historyUtil.storeExecutionInHistory(history, result, resolver); resolver.commit(); return history; } catch (LoginException e) { throw new AecuException(ERR_NO_RESOLVER, e); } catch (PersistenceException e) { throw new AecuException("Unable to add history entry " + history.getRepositoryPath(), e); } } }
AecuServiceImpl implements AecuService { @Override public HistoryEntry storeExecutionInHistory(HistoryEntry history, ExecutionResult result) throws AecuException { if ((history == null) || !STATE.RUNNING.equals(history.getState())) { throw new AecuException("Invalid history entry."); } history.getSingleResults().add(result); try (ResourceResolver resolver = resolverService.getServiceResourceResolver()) { historyUtil.storeExecutionInHistory(history, result, resolver); resolver.commit(); return history; } catch (LoginException e) { throw new AecuException(ERR_NO_RESOLVER, e); } catch (PersistenceException e) { throw new AecuException("Unable to add history entry " + history.getRepositoryPath(), e); } }  }
AecuServiceImpl implements AecuService { @Override public HistoryEntry storeExecutionInHistory(HistoryEntry history, ExecutionResult result) throws AecuException { if ((history == null) || !STATE.RUNNING.equals(history.getState())) { throw new AecuException("Invalid history entry."); } history.getSingleResults().add(result); try (ResourceResolver resolver = resolverService.getServiceResourceResolver()) { historyUtil.storeExecutionInHistory(history, result, resolver); resolver.commit(); return history; } catch (LoginException e) { throw new AecuException(ERR_NO_RESOLVER, e); } catch (PersistenceException e) { throw new AecuException("Unable to add history entry " + history.getRepositoryPath(), e); } }  @Override String getVersion(); @Override List<String> getFiles(String path); @Override boolean matchesRunmodes(String name); @Override boolean isValidScriptName(String name); @Override ExecutionResult execute(String path); @Override HistoryEntry createHistoryEntry(); @Override HistoryEntry finishHistoryEntry(HistoryEntry history); @Override HistoryEntry storeExecutionInHistory(HistoryEntry history, ExecutionResult result); @Override List<HistoryEntry> getHistory(int startIndex, int count); }
AecuServiceImpl implements AecuService { @Override public HistoryEntry storeExecutionInHistory(HistoryEntry history, ExecutionResult result) throws AecuException { if ((history == null) || !STATE.RUNNING.equals(history.getState())) { throw new AecuException("Invalid history entry."); } history.getSingleResults().add(result); try (ResourceResolver resolver = resolverService.getServiceResourceResolver()) { historyUtil.storeExecutionInHistory(history, result, resolver); resolver.commit(); return history; } catch (LoginException e) { throw new AecuException(ERR_NO_RESOLVER, e); } catch (PersistenceException e) { throw new AecuException("Unable to add history entry " + history.getRepositoryPath(), e); } }  @Override String getVersion(); @Override List<String> getFiles(String path); @Override boolean matchesRunmodes(String name); @Override boolean isValidScriptName(String name); @Override ExecutionResult execute(String path); @Override HistoryEntry createHistoryEntry(); @Override HistoryEntry finishHistoryEntry(HistoryEntry history); @Override HistoryEntry storeExecutionInHistory(HistoryEntry history, ExecutionResult result); @Override List<HistoryEntry> getHistory(int startIndex, int count);  }