Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(timeout = TEST_TIMEOUT) public void notifyWhenWholeStoreDirectoryRemoved() throws java.io.IOException, InterruptedException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void NotifyWhenWholeStoreDirectoryRemoved()
        {
            assumeFalse(SystemUtils.IS_OS_WINDOWS);

            string       fileName     = TestDirectory.databaseLayout().metadataStore().Name;
            FileWatcher  fileWatcher  = GetFileWatcher(_database);
            CheckPointer checkpointer = GetCheckpointer(_database);

            ModificationEventListener modificationListener = new ModificationEventListener(fileName);

            fileWatcher.AddFileWatchEventListener(modificationListener);
            do
            {
                CreateNode(_database);
                ForceCheckpoint(checkpointer);
            } while (!modificationListener.AwaitModificationNotification());
            fileWatcher.RemoveFileWatchEventListener(modificationListener);

            string storeDirectoryName = TestDirectory.databaseLayout().databaseDirectory().Name;
            DeletionLatchEventListener eventListener = new DeletionLatchEventListener(storeDirectoryName);

            fileWatcher.AddFileWatchEventListener(eventListener);
            FileUtils.deleteRecursively(TestDirectory.databaseLayout().databaseDirectory());

            eventListener.AwaitDeletionNotification();

            _logProvider.rawMessageMatcher().assertContains("'" + storeDirectoryName + "' which belongs to the store was deleted while database was running.");
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(timeout = TEST_TIMEOUT) public void doNotMonitorTransactionLogFiles() throws InterruptedException, java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void DoNotMonitorTransactionLogFiles()
        {
            assumeFalse(SystemUtils.IS_OS_WINDOWS);

            FileWatcher  fileWatcher   = GetFileWatcher(_database);
            CheckPointer checkpointer  = GetCheckpointer(_database);
            string       metadataStore = TestDirectory.databaseLayout().metadataStore().Name;
            ModificationEventListener modificationEventListener = new ModificationEventListener(metadataStore);

            fileWatcher.AddFileWatchEventListener(modificationEventListener);

            do
            {
                CreateNode(_database);
                ForceCheckpoint(checkpointer);
            } while (!modificationEventListener.AwaitModificationNotification());

            string fileName = TransactionLogFiles.DEFAULT_NAME + ".0";
            DeletionLatchEventListener deletionListener = new DeletionLatchEventListener(fileName);

            fileWatcher.AddFileWatchEventListener(deletionListener);
            DeleteFile(TestDirectory.storeDir(), fileName);
            deletionListener.AwaitDeletionNotification();

            AssertableLogProvider.LogMatcher logMatcher = AssertableLogProvider.inLog(typeof(DefaultFileDeletionEventListener)).info(containsString(fileName));
            _logProvider.assertNone(logMatcher);
        }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(timeout = TEST_TIMEOUT) public void doNotNotifyAboutLuceneIndexFilesDeletion() throws InterruptedException, java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void DoNotNotifyAboutLuceneIndexFilesDeletion()
        {
            DependencyResolver dependencyResolver = (( GraphDatabaseAPI )_database).DependencyResolver;
            FileWatcher        fileWatcher        = GetFileWatcher(_database);
            CheckPointer       checkPointer       = dependencyResolver.ResolveDependency(typeof(CheckPointer));

            string propertyStoreName = TestDirectory.databaseLayout().propertyStore().Name;
            AccumulativeDeletionEventListener accumulativeListener = new AccumulativeDeletionEventListener();
            ModificationEventListener         modificationListener = new ModificationEventListener(propertyStoreName);

            fileWatcher.AddFileWatchEventListener(modificationListener);
            fileWatcher.AddFileWatchEventListener(accumulativeListener);

            string labelName    = "labelName";
            string propertyName = "propertyName";
            Label  testLabel    = Label.label(labelName);

            CreateIndexes(_database, propertyName, testLabel);
            do
            {
                CreateNode(_database, propertyName, testLabel);
                ForceCheckpoint(checkPointer);
            } while (!modificationListener.AwaitModificationNotification());

            fileWatcher.RemoveFileWatchEventListener(modificationListener);
            ModificationEventListener afterRemovalListener = new ModificationEventListener(propertyStoreName);

            fileWatcher.AddFileWatchEventListener(afterRemovalListener);

            DropAllIndexes(_database);
            do
            {
                CreateNode(_database, propertyName, testLabel);
                ForceCheckpoint(checkPointer);
            } while (!afterRemovalListener.AwaitModificationNotification());

            accumulativeListener.AssertDoesNotHaveAnyDeletions();
        }
Exemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(timeout = TEST_TIMEOUT) public void notifyAboutExplicitIndexFolderRemoval() throws InterruptedException, java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void NotifyAboutExplicitIndexFolderRemoval()
        {
            string monitoredDirectory = GetExplicitIndexDirectory(TestDirectory.databaseLayout());

            FileWatcher  fileWatcher  = GetFileWatcher(_database);
            CheckPointer checkPointer = GetCheckpointer(_database);
            DeletionLatchEventListener deletionListener = new DeletionLatchEventListener(monitoredDirectory);
            string metadataStore = TestDirectory.databaseLayout().metadataStore().Name;
            ModificationEventListener modificationEventListener = new ModificationEventListener(metadataStore);

            fileWatcher.AddFileWatchEventListener(deletionListener);
            fileWatcher.AddFileWatchEventListener(modificationEventListener);

            do
            {
                CreateNode(_database);
                ForceCheckpoint(checkPointer);
            } while (!modificationEventListener.AwaitModificationNotification());

            DeleteStoreDirectory(_storeDir, monitoredDirectory);
            deletionListener.AwaitDeletionNotification();

            _logProvider.rawMessageMatcher().assertContains("'" + monitoredDirectory + "' which belongs to the store was deleted while database was running.");
        }
Exemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(timeout = TEST_TIMEOUT) public void notifyAboutStoreFileDeletion() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void NotifyAboutStoreFileDeletion()
        {
            assumeFalse(SystemUtils.IS_OS_WINDOWS);

            string       fileName     = TestDirectory.databaseLayout().metadataStore().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(TestDirectory.storeDir(), fileName);
            deletionListener.AwaitDeletionNotification();

            _logProvider.rawMessageMatcher().assertContains("'" + fileName + "' which belongs to the store was deleted while database was running.");
        }
Exemplo n.º 6
0
 public override void AddFileWatchEventListener(FileWatchEventListener listener)
 {
     @delegate.AddFileWatchEventListener(listener);
 }