@Test public void execute() throws AecuException { ExecutionResult result = mock(ExecutionResult.class); when(service.execute(FILE1)).thenReturn(result); String out = bean.execute(PATH); verify(service, times(1)).getFiles(PATH); verify(service, times(1)).createHistoryEntry(); verify(service, times(1)).execute(FILE1); verify(service, times(1)).execute(FILE1); verify(service, times(1)).finishHistoryEntry(Mockito.any()); }
@Override public String execute(String path) throws AecuException { HistoryEntry history = aecuService.createHistoryEntry(); List<String> files = aecuService.getFiles(path); StringBuilder result = new StringBuilder("Found " + files.size() + " files to execute\n\n"); for (String file : files) { result.append(file + "\n"); ExecutionResult singleResult = aecuService.execute(file); aecuService.storeExecutionInHistory(history, singleResult); result.append(singleResult.toString()); result.append("\n\n"); } aecuService.finishHistoryEntry(history); return result.toString(); }
AecuServiceMBeanImpl extends AnnotatedStandardMBean implements AecuServiceMBean { @Override public String execute(String path) throws AecuException { HistoryEntry history = aecuService.createHistoryEntry(); List<String> files = aecuService.getFiles(path); StringBuilder result = new StringBuilder("Found " + files.size() + " files to execute\n\n"); for (String file : files) { result.append(file + "\n"); ExecutionResult singleResult = aecuService.execute(file); aecuService.storeExecutionInHistory(history, singleResult); result.append(singleResult.toString()); result.append("\n\n"); } aecuService.finishHistoryEntry(history); return result.toString(); } }
AecuServiceMBeanImpl extends AnnotatedStandardMBean implements AecuServiceMBean { @Override public String execute(String path) throws AecuException { HistoryEntry history = aecuService.createHistoryEntry(); List<String> files = aecuService.getFiles(path); StringBuilder result = new StringBuilder("Found " + files.size() + " files to execute\n\n"); for (String file : files) { result.append(file + "\n"); ExecutionResult singleResult = aecuService.execute(file); aecuService.storeExecutionInHistory(history, singleResult); result.append(singleResult.toString()); result.append("\n\n"); } aecuService.finishHistoryEntry(history); return result.toString(); } AecuServiceMBeanImpl(); }
AecuServiceMBeanImpl extends AnnotatedStandardMBean implements AecuServiceMBean { @Override public String execute(String path) throws AecuException { HistoryEntry history = aecuService.createHistoryEntry(); List<String> files = aecuService.getFiles(path); StringBuilder result = new StringBuilder("Found " + files.size() + " files to execute\n\n"); for (String file : files) { result.append(file + "\n"); ExecutionResult singleResult = aecuService.execute(file); aecuService.storeExecutionInHistory(history, singleResult); result.append(singleResult.toString()); result.append("\n\n"); } aecuService.finishHistoryEntry(history); return result.toString(); } AecuServiceMBeanImpl(); @Override String getVersion(); @Override List<String> getFiles(String path); @Override String execute(String path); @Override String executeWithHistory(String path); @Override String getHistory(int start, int count); }
AecuServiceMBeanImpl extends AnnotatedStandardMBean implements AecuServiceMBean { @Override public String execute(String path) throws AecuException { HistoryEntry history = aecuService.createHistoryEntry(); List<String> files = aecuService.getFiles(path); StringBuilder result = new StringBuilder("Found " + files.size() + " files to execute\n\n"); for (String file : files) { result.append(file + "\n"); ExecutionResult singleResult = aecuService.execute(file); aecuService.storeExecutionInHistory(history, singleResult); result.append(singleResult.toString()); result.append("\n\n"); } aecuService.finishHistoryEntry(history); return result.toString(); } AecuServiceMBeanImpl(); @Override String getVersion(); @Override List<String> getFiles(String path); @Override String execute(String path); @Override String executeWithHistory(String path); @Override String getHistory(int start, int count);  }