@Test void bootstrap() { ImportRun importRun = mock(ImportRun.class); @SuppressWarnings("unchecked") Query<ImportRun> query = mock(Query.class, RETURNS_DEEP_STUBS); when(query.eq("status", "RUNNING")).thenReturn(query); when(query.findAll()).thenReturn(Stream.of(importRun)); when(dataService.query("sys_ImportRun", ImportRun.class)).thenReturn(query); importBootstrapper.bootstrap(); verify(importRun).setStatus("FAILED"); verify(importRun).setMessage("Application terminated unexpectedly"); verify(dataService).update("sys_ImportRun", importRun); }
public void bootstrap() { LOG.trace("Failing import runs that were left running..."); dataService .query(ImportRunMetadata.IMPORT_RUN, ImportRun.class) .eq(ImportRunMetadata.STATUS, ImportStatus.RUNNING.toString()) .findAll() .forEach(this::setFailed); LOG.debug("Failed import runs that were left running."); }
ImportBootstrapper { public void bootstrap() { LOG.trace("Failing import runs that were left running..."); dataService .query(ImportRunMetadata.IMPORT_RUN, ImportRun.class) .eq(ImportRunMetadata.STATUS, ImportStatus.RUNNING.toString()) .findAll() .forEach(this::setFailed); LOG.debug("Failed import runs that were left running."); } }
ImportBootstrapper { public void bootstrap() { LOG.trace("Failing import runs that were left running..."); dataService .query(ImportRunMetadata.IMPORT_RUN, ImportRun.class) .eq(ImportRunMetadata.STATUS, ImportStatus.RUNNING.toString()) .findAll() .forEach(this::setFailed); LOG.debug("Failed import runs that were left running."); } ImportBootstrapper(DataService dataService); }
ImportBootstrapper { public void bootstrap() { LOG.trace("Failing import runs that were left running..."); dataService .query(ImportRunMetadata.IMPORT_RUN, ImportRun.class) .eq(ImportRunMetadata.STATUS, ImportStatus.RUNNING.toString()) .findAll() .forEach(this::setFailed); LOG.debug("Failed import runs that were left running."); } ImportBootstrapper(DataService dataService); void bootstrap(); }
ImportBootstrapper { public void bootstrap() { LOG.trace("Failing import runs that were left running..."); dataService .query(ImportRunMetadata.IMPORT_RUN, ImportRun.class) .eq(ImportRunMetadata.STATUS, ImportStatus.RUNNING.toString()) .findAll() .forEach(this::setFailed); LOG.debug("Failed import runs that were left running."); } ImportBootstrapper(DataService dataService); void bootstrap();  }