FileTriggerTracker { synchronized public DirectorySnapshot trackChanges() { pollForChanges(); DirectorySnapshot changes = changesSinceLastSnapshot; changesSinceLastSnapshot = new DirectorySnapshot(fileTriggerRouter); SnapshotUpdater newListener = new SnapshotUpdater(changesSinceLastSnapshot); fileObserver.addListener(newListener); fileObserver.removeListener(currentListener); currentListener = newListener; lastSnapshot.merge(changes); long runTime = (System.currentTimeMillis() - startTime) / 1000; if (changes.size() > 0) { log.info("Tracked {} files in {} seconds. Found {} files changed.", new Object[] { lastSnapshot.size(), runTime, changes.size() }); } return changes; } FileTriggerTracker(FileTriggerRouter fileTriggerRouter, DirectorySnapshot lastSnapshot, ProcessInfo processInfo,
            boolean useCrc, ISymmetricEngine engine); synchronized DirectorySnapshot trackChanges();  }
@Test public void testTakeSnapshotRecursiveTestDelete() throws Exception { FileTrigger fileTrigger = new FileTrigger(directory.getAbsolutePath(), true, null, null); Router router = new Router(); FileTriggerRouter fileTriggerRouter = new FileTriggerRouter(fileTrigger, router); FileTriggerTracker tracker = new FileTriggerTracker(fileTriggerRouter, null, null, false, null); tracker.trackChanges(); FileUtils.deleteQuietly(fileInDirectory1); DirectorySnapshot snapshot = tracker.trackChanges(); assertEquals(1, snapshot.size()); FileSnapshot change = snapshot.get(0); assertEquals(change.getFileName(), FileSyncUtils.getRelativePath(fileInDirectory1, directory)); assertEquals(change.getLastEventType(), LastEventType.DELETE); }