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

            migrator.WriteLastTxLogPosition(_directory.databaseLayout(), writtenLogPosition);

            LogPosition readLogPosition = migrator.ReadLastTxLogPosition(_directory.databaseLayout());

            assertEquals(writtenLogPosition, readLogPosition);
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldComputeTheLastTxLogPositionCorrectly() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldComputeTheLastTxLogPositionCorrectly()
        {
            // GIVEN a legacy database
            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 migrating
            migrator.Migrate(databaseLayout, migrationLayout, progressMonitor.StartSection("section"), versionToMigrateFrom, upgradableDatabase.CurrentVersion());

            // THEN it should compute the correct last tx log position
            assertEquals(ExpectedLogPosition, migrator.ReadLastTxLogPosition(migrationLayout));
        }