示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void pruningStrategyShouldBeDynamic() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void PruningStrategyShouldBeDynamic()
        {
            CheckPointer          checkPointer = GetInstanceFromDb(typeof(CheckPointer));
            Config                config       = GetInstanceFromDb(typeof(Config));
            FileSystemAbstraction fs           = GetInstanceFromDb(typeof(FileSystemAbstraction));

            LogFiles logFiles = LogFilesBuilder.builder(Db.databaseLayout(), fs).withLogVersionRepository(new SimpleLogVersionRepository()).withLastCommittedTransactionIdSupplier(() => 1).withTransactionIdStore(new SimpleTransactionIdStore()).build();

            // Force transaction log rotation
            WriteTransactionsAndRotateTwice();

            // Checkpoint to make sure strategy is evaluated
            checkPointer.ForceCheckPoint(_triggerInfo);

            // Make sure file is still there since we have disable pruning
            assertThat(CountTransactionLogs(logFiles), @is(3));

            // Change pruning to true
            config.UpdateDynamicSetting(keep_logical_logs.name(), "false", "test");

            // Checkpoint to make sure strategy is evaluated
            checkPointer.ForceCheckPoint(_triggerInfo);

            // Make sure file is removed
            assertThat(CountTransactionLogs(logFiles), @is(2));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void scanStoreStartWithoutExistentIndex() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ScanStoreStartWithoutExistentIndex()
        {
            LabelScanStore labelScanStore = LabelScanStore;
            GroupingRecoveryCleanupWorkCollector workCollector = GroupingRecoveryCleanupWorkCollector;

            labelScanStore.Shutdown();
            workCollector.Shutdown();

            DeleteLabelScanStoreFiles(DbRule.databaseLayout());

            workCollector.Init();
            labelScanStore.Init();
            workCollector.Start();
            labelScanStore.Start();

            CheckLabelScanStoreAccessible(labelScanStore);
        }
        private File ArchiveFile()
        {
            File indexDir = nativeIndexDirectoryStructure(Db.databaseLayout()).rootDirectory();

            File[] files = indexDir.listFiles(pathname => pathname.File && pathname.Name.StartsWith("archive-"));
            if (files == null || Files.Length == 0)
            {
                return(null);
            }
            assertEquals(1, Files.Length);
            return(files[0]);
        }