Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldDetectOldVersionAsDifferentFromCurrent()
            public virtual void ShouldDetectOldVersionAsDifferentFromCurrent()
            {
                // given
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final UpgradableDatabase upgradableDatabase = getUpgradableDatabase();
                UpgradableDatabase upgradableDatabase = UpgradableDatabase;
                // when
                bool currentVersion = upgradableDatabase.HasCurrentVersion(DatabaseLayout);

                // then
                assertFalse(currentVersion);
            }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Parameterized.Parameters(name = "Migrate: {0}->{1}") public static Iterable<Object[]> data() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public static IEnumerable <object[]> Data()
        {
            FileSystemAbstraction fs            = _fileSystemRule.get();
            PageCache             pageCache     = _pageCacheRule.getPageCache(fs);
            TestDirectory         testDirectory = TestDirectory.testDirectory();

            testDirectory.PrepareDirectory(typeof(StoreMigrationIT), "migration");
            DatabaseLayout    databaseLayout    = testDirectory.DatabaseLayout();
            StoreVersionCheck storeVersionCheck = new StoreVersionCheck(pageCache);
            VersionAwareLogEntryReader <ReadableClosablePositionAwareChannel> logEntryReader = new VersionAwareLogEntryReader <ReadableClosablePositionAwareChannel>();
            LogFiles             logFiles      = LogFilesBuilder.logFilesBasedOnlyBuilder(databaseLayout.DatabaseDirectory(), fs).withLogEntryReader(logEntryReader).build();
            LogTailScanner       tailScanner   = new LogTailScanner(logFiles, logEntryReader, new Monitors());
            IList <object[]>     data          = new List <object[]>();
            List <RecordFormats> recordFormats = new List <RecordFormats>();

            RecordFormatSelector.allFormats().forEach(f => addIfNotThere(f, recordFormats));
            foreach (RecordFormats toFormat in recordFormats)
            {
                UpgradableDatabase upgradableDatabase = new UpgradableDatabase(storeVersionCheck, toFormat, tailScanner);
                foreach (RecordFormats fromFormat in recordFormats)
                {
                    try
                    {
                        CreateDb(fromFormat, databaseLayout.DatabaseDirectory());
                        if (!upgradableDatabase.HasCurrentVersion(databaseLayout))
                        {
                            upgradableDatabase.CheckUpgradable(databaseLayout);
                            data.Add(new object[] { fromFormat, toFormat });
                        }
                    }
                    catch (Exception)
                    {
                        //This means that the combination is not migratable.
                    }
                    fs.DeleteRecursively(databaseLayout.DatabaseDirectory());
                }
            }

            return(data);
        }