@Test public void testRun() throws InterruptedException { new Expectations() { { mockScheduledExecutorService.scheduleWithFixedDelay((Runnable) any, anyLong, anyLong, TimeUnit.SECONDS); mockScheduledExecutorService.awaitTermination(anyLong, TimeUnit.SECONDS); } }; testImporterDirectoryWatcher.run(); }
@Override public void run() { logger.info("Processing inbox directory {} every {} seconds.", inbox, timePeriod); executor.scheduleWithFixedDelay(() -> importerProcessor.processDirectory(inbox, backup, failed), 0, timePeriod, TimeUnit.SECONDS); try { executor.awaitTermination(timePeriod, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); logger.error("Directory watcher polling loop interrupted!", e); } }
ImporterDirectoryWatcher implements Runnable { @Override public void run() { logger.info("Processing inbox directory {} every {} seconds.", inbox, timePeriod); executor.scheduleWithFixedDelay(() -> importerProcessor.processDirectory(inbox, backup, failed), 0, timePeriod, TimeUnit.SECONDS); try { executor.awaitTermination(timePeriod, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); logger.error("Directory watcher polling loop interrupted!", e); } } }
ImporterDirectoryWatcher implements Runnable { @Override public void run() { logger.info("Processing inbox directory {} every {} seconds.", inbox, timePeriod); executor.scheduleWithFixedDelay(() -> importerProcessor.processDirectory(inbox, backup, failed), 0, timePeriod, TimeUnit.SECONDS); try { executor.awaitTermination(timePeriod, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); logger.error("Directory watcher polling loop interrupted!", e); } } ImporterDirectoryWatcher(OdeProperties odeProperties, Path dir, Path backupDir, Path failureDir, ImporterFileType fileType, Integer timePeriod); }
ImporterDirectoryWatcher implements Runnable { @Override public void run() { logger.info("Processing inbox directory {} every {} seconds.", inbox, timePeriod); executor.scheduleWithFixedDelay(() -> importerProcessor.processDirectory(inbox, backup, failed), 0, timePeriod, TimeUnit.SECONDS); try { executor.awaitTermination(timePeriod, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); logger.error("Directory watcher polling loop interrupted!", e); } } ImporterDirectoryWatcher(OdeProperties odeProperties, Path dir, Path backupDir, Path failureDir, ImporterFileType fileType, Integer timePeriod); @Override void run(); boolean isWatching(); void setWatching(boolean watching); }
ImporterDirectoryWatcher implements Runnable { @Override public void run() { logger.info("Processing inbox directory {} every {} seconds.", inbox, timePeriod); executor.scheduleWithFixedDelay(() -> importerProcessor.processDirectory(inbox, backup, failed), 0, timePeriod, TimeUnit.SECONDS); try { executor.awaitTermination(timePeriod, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); logger.error("Directory watcher polling loop interrupted!", e); } } ImporterDirectoryWatcher(OdeProperties odeProperties, Path dir, Path backupDir, Path failureDir, ImporterFileType fileType, Integer timePeriod); @Override void run(); boolean isWatching(); void setWatching(boolean watching);  }