use of org.neo4j.io.fs.watcher.FileWatcher in project neo4j by neo4j.
the class FileWatchIT method notifyAboutStoreFileDeletion.
@Test(timeout = TEST_TIMEOUT)
public void notifyAboutStoreFileDeletion() throws Exception {
assumeFalse(SystemUtils.IS_OS_WINDOWS);
String fileName = MetaDataStore.DEFAULT_NAME;
FileWatcher fileWatcher = getFileWatcher(database);
CheckPointer checkpointer = getCheckpointer(database);
DeletionLatchEventListener deletionListener = new DeletionLatchEventListener(fileName);
fileWatcher.addFileWatchEventListener(deletionListener);
do {
createNode(database);
forceCheckpoint(checkpointer);
} while (!deletionListener.awaitModificationNotification());
deleteFile(storeDir, fileName);
deletionListener.awaitDeletionNotification();
logProvider.assertContainsMessageContaining("'" + fileName + "' which belongs to the store was deleted while database was running.");
}
use of org.neo4j.io.fs.watcher.FileWatcher in project neo4j by neo4j.
the class FileWatchIT method notifyAboutLegacyIndexFolderRemoval.
@Test(timeout = TEST_TIMEOUT)
public void notifyAboutLegacyIndexFolderRemoval() throws InterruptedException, IOException {
String monitoredDirectory = getLegacyIndexDirectory(storeDir);
FileWatcher fileWatcher = getFileWatcher(database);
CheckPointer checkPointer = getCheckpointer(database);
DeletionLatchEventListener deletionListener = new DeletionLatchEventListener(monitoredDirectory);
ModificationEventListener modificationEventListener = new ModificationEventListener(MetaDataStore.DEFAULT_NAME);
fileWatcher.addFileWatchEventListener(deletionListener);
fileWatcher.addFileWatchEventListener(modificationEventListener);
do {
createNode(database);
forceCheckpoint(checkPointer);
} while (!modificationEventListener.awaitModificationNotification());
deleteStoreDirectory(storeDir, monitoredDirectory);
deletionListener.awaitDeletionNotification();
logProvider.assertContainsMessageContaining("'" + monitoredDirectory + "' which belongs to the store was deleted while database was running.");
}
Aggregations