Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void writeAndReadLastTxInformation() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void WriteAndReadLastTxInformation()
        {
            StoreMigrator migrator    = NewStoreMigrator();
            TransactionId writtenTxId = new TransactionId(_random.nextLong(), _random.nextLong(), _random.nextLong());

            migrator.WriteLastTxInformation(_directory.databaseLayout(), writtenTxId);

            TransactionId readTxId = migrator.ReadLastTxInformation(_directory.databaseLayout());

            assertEquals(writtenTxId, readTxId);
        }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldComputeTheLastTxInfoCorrectly() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldComputeTheLastTxInfoCorrectly()
        {
            // given
            DatabaseLayout databaseLayout = _directory.databaseLayout();
            File           prepare        = _directory.directory("prepare");

            MigrationTestUtils.prepareSampleLegacyDatabase(Version, _fs, databaseLayout.DatabaseDirectory(), prepare);
            // and a state of the migration saying that it has done the actual migration
            LogService         logService         = NullLogService.Instance;
            PageCache          pageCache          = _pageCacheRule.getPageCache(_fs);
            LogTailScanner     tailScanner        = GetTailScanner(databaseLayout.DatabaseDirectory());
            UpgradableDatabase upgradableDatabase = GetUpgradableDatabase(pageCache, tailScanner);

            string versionToMigrateFrom = upgradableDatabase.CheckUpgradable(databaseLayout).storeVersion();
            SilentMigrationProgressMonitor progressMonitor = new SilentMigrationProgressMonitor();
            StoreMigrator  migrator        = new StoreMigrator(_fs, pageCache, _config, logService, _jobScheduler);
            DatabaseLayout migrationLayout = _directory.databaseLayout(StoreUpgrader.MIGRATION_DIRECTORY);

            // when
            migrator.Migrate(databaseLayout, migrationLayout, progressMonitor.StartSection("section"), versionToMigrateFrom, upgradableDatabase.CurrentVersion());

            // then
            assertTrue(TxIdComparator.apply(migrator.ReadLastTxInformation(migrationLayout)));
        }