Skip to content

Commit

Permalink
Remove FileWatcherLifecycleAdapter.
Browse files Browse the repository at this point in the history
It was only used in tests, while the DefaultFileSystemWatcherService was only used in the product code.
The existing test for FileWatcherLifecycleAdapter now tests the DefaultFileSystemWatcherService instead, and has been renamed to match.
  • Loading branch information
chrisvest committed Mar 20, 2018
1 parent e2a5f5d commit bd65172
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 113 deletions.

This file was deleted.

Expand Up @@ -29,11 +29,11 @@
import org.neo4j.io.fs.watcher.FileWatcher; import org.neo4j.io.fs.watcher.FileWatcher;
import org.neo4j.io.fs.watcher.SilentFileWatcher; import org.neo4j.io.fs.watcher.SilentFileWatcher;
import org.neo4j.kernel.impl.scheduler.CentralJobScheduler; import org.neo4j.kernel.impl.scheduler.CentralJobScheduler;
import org.neo4j.kernel.impl.util.watcher.FileWatcherLifecycleAdapter; import org.neo4j.kernel.impl.util.watcher.DefaultFileSystemWatcherService;


import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;


public class FileWatcherLifecycleAdapterTest public class DefaultFileSystemWatcherServiceTest
{ {


private static CentralJobScheduler jobScheduler; private static CentralJobScheduler jobScheduler;
Expand All @@ -56,32 +56,32 @@ public void startMonitoringWhenLifecycleStarting() throws Throwable
{ {
CountDownLatch latch = new CountDownLatch( 1 ); CountDownLatch latch = new CountDownLatch( 1 );
FileWatcher watcher = new TestFileWatcher( latch ); FileWatcher watcher = new TestFileWatcher( latch );
FileWatcherLifecycleAdapter watcherAdapter = new FileWatcherLifecycleAdapter( jobScheduler, watcher ); DefaultFileSystemWatcherService service = new DefaultFileSystemWatcherService( jobScheduler, watcher );
watcherAdapter.init(); service.init();
watcherAdapter.start(); service.start();


latch.await(); latch.await();
} }


@Test @Test
public void stopMonitoringWhenLifecycleStops() throws Throwable public void stopMonitoringWhenLifecycleStops() throws Throwable
{ {
FileWatcherLifecycleAdapter watcherAdapter = new FileWatcherLifecycleAdapter( jobScheduler, fileWatcher ); DefaultFileSystemWatcherService service = new DefaultFileSystemWatcherService( jobScheduler, fileWatcher );
watcherAdapter.init(); service.init();
watcherAdapter.start(); service.start();
watcherAdapter.stop(); service.stop();


verify( fileWatcher ).stopWatching(); verify( fileWatcher ).stopWatching();
} }


@Test @Test
public void closeFileWatcherOnShutdown() throws Throwable public void closeFileWatcherOnShutdown() throws Throwable
{ {
FileWatcherLifecycleAdapter watcherAdapter = new FileWatcherLifecycleAdapter( jobScheduler, fileWatcher ); DefaultFileSystemWatcherService service = new DefaultFileSystemWatcherService( jobScheduler, fileWatcher );
watcherAdapter.init(); service.init();
watcherAdapter.start(); service.start();
watcherAdapter.stop(); service.stop();
watcherAdapter.shutdown(); service.shutdown();


verify( fileWatcher ).close(); verify( fileWatcher ).close();
} }
Expand Down

0 comments on commit bd65172

Please sign in to comment.