Пример #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 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);
        }
Пример #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 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.");
        }
Пример #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 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.");
        }
Пример #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.");
        }