@Test void testFinishImportRun() { String importRunId = "MyImportRunId"; String message = "message"; String importedEntities = "importedEntities"; ImportRun importRun = mock(ImportRun.class); when(dataService.findOneById(IMPORT_RUN, importRunId, ImportRun.class)).thenReturn(importRun); importRunService.finishImportRun(importRunId, message, importedEntities); verify(importRun).setStatus(ImportStatus.FINISHED.toString()); verify(importRun).setEndDate(any()); verify(importRun).setMessage(message); verify(importRun).setImportedEntities(importedEntities); verify(dataService).update(IMPORT_RUN, importRun); }
void finishImportRun(String importRunId, String message, String importedEntities) { ImportRun importRun = dataService.findOneById(IMPORT_RUN, importRunId, ImportRun.class); if (importRun == null) { throw new UnknownEntityException(IMPORT_RUN, importRunId); } try { importRun.setStatus(ImportStatus.FINISHED.toString()); importRun.setEndDate(now()); importRun.setMessage(message); importRun.setImportedEntities(importedEntities); dataService.update(IMPORT_RUN, importRun); } catch (Exception e) { LOG.error("Error updating run status", e); } if (importRun.getNotify()) createAndSendStatusMail(importRun); }
ImportRunService { void finishImportRun(String importRunId, String message, String importedEntities) { ImportRun importRun = dataService.findOneById(IMPORT_RUN, importRunId, ImportRun.class); if (importRun == null) { throw new UnknownEntityException(IMPORT_RUN, importRunId); } try { importRun.setStatus(ImportStatus.FINISHED.toString()); importRun.setEndDate(now()); importRun.setMessage(message); importRun.setImportedEntities(importedEntities); dataService.update(IMPORT_RUN, importRun); } catch (Exception e) { LOG.error("Error updating run status", e); } if (importRun.getNotify()) createAndSendStatusMail(importRun); } }
ImportRunService { void finishImportRun(String importRunId, String message, String importedEntities) { ImportRun importRun = dataService.findOneById(IMPORT_RUN, importRunId, ImportRun.class); if (importRun == null) { throw new UnknownEntityException(IMPORT_RUN, importRunId); } try { importRun.setStatus(ImportStatus.FINISHED.toString()); importRun.setEndDate(now()); importRun.setMessage(message); importRun.setImportedEntities(importedEntities); dataService.update(IMPORT_RUN, importRun); } catch (Exception e) { LOG.error("Error updating run status", e); } if (importRun.getNotify()) createAndSendStatusMail(importRun); } ImportRunService(
      DataService dataService,
      MailSender mailSender,
      UserService userService,
      ContextMessageSource contextMessageSource,
      ImportRunFactory importRunFactory); }
ImportRunService { void finishImportRun(String importRunId, String message, String importedEntities) { ImportRun importRun = dataService.findOneById(IMPORT_RUN, importRunId, ImportRun.class); if (importRun == null) { throw new UnknownEntityException(IMPORT_RUN, importRunId); } try { importRun.setStatus(ImportStatus.FINISHED.toString()); importRun.setEndDate(now()); importRun.setMessage(message); importRun.setImportedEntities(importedEntities); dataService.update(IMPORT_RUN, importRun); } catch (Exception e) { LOG.error("Error updating run status", e); } if (importRun.getNotify()) createAndSendStatusMail(importRun); } ImportRunService(
      DataService dataService,
      MailSender mailSender,
      UserService userService,
      ContextMessageSource contextMessageSource,
      ImportRunFactory importRunFactory); ImportRun addImportRun(String userName, boolean notify); }
ImportRunService { void finishImportRun(String importRunId, String message, String importedEntities) { ImportRun importRun = dataService.findOneById(IMPORT_RUN, importRunId, ImportRun.class); if (importRun == null) { throw new UnknownEntityException(IMPORT_RUN, importRunId); } try { importRun.setStatus(ImportStatus.FINISHED.toString()); importRun.setEndDate(now()); importRun.setMessage(message); importRun.setImportedEntities(importedEntities); dataService.update(IMPORT_RUN, importRun); } catch (Exception e) { LOG.error("Error updating run status", e); } if (importRun.getNotify()) createAndSendStatusMail(importRun); } ImportRunService(
      DataService dataService,
      MailSender mailSender,
      UserService userService,
      ContextMessageSource contextMessageSource,
      ImportRunFactory importRunFactory); ImportRun addImportRun(String userName, boolean notify);  }