Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSucceedWithUpgradeAfterPreviousAttemptDiedDuringMovingFiles() throws java.io.IOException, org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldSucceedWithUpgradeAfterPreviousAttemptDiedDuringMovingFiles()
        {
            MigrationTestUtils.prepareSampleLegacyDatabase(Version, _fs, _workingDatabaseLayout.databaseDirectory(), _prepareDirectory);
            PageCache                      pageCache            = _pageCacheRule.getPageCache(_fs);
            StoreVersionCheck              check                = new StoreVersionCheck(pageCache);
            UpgradableDatabase             upgradableDatabase   = GetUpgradableDatabase(check);
            SilentMigrationProgressMonitor progressMonitor      = new SilentMigrationProgressMonitor();
            LogService                     logService           = NullLogService.Instance;
            StoreMigrator                  failingStoreMigrator = new StoreMigratorAnonymousInnerClass2(this, _fs, pageCache, _config, logService, _jobScheduler);

            try
            {
                NewUpgrader(upgradableDatabase, pageCache, progressMonitor, CreateIndexMigrator(), failingStoreMigrator).migrateIfNeeded(_workingDatabaseLayout);
                fail("Should throw exception");
            }
            catch (Exception e)
            {
                assertEquals("This upgrade is failing", e.Message);
            }

            assertTrue(checkNeoStoreHasDefaultFormatVersion(check, _workingDatabaseLayout));

            progressMonitor = new SilentMigrationProgressMonitor();
            StoreMigrator migrator = new StoreMigrator(_fs, pageCache, _config, logService, _jobScheduler);

            NewUpgrader(upgradableDatabase, pageCache, progressMonitor, CreateIndexMigrator(), migrator).migrateIfNeeded(_workingDatabaseLayout);

            assertTrue(checkNeoStoreHasDefaultFormatVersion(check, _workingDatabaseLayout));

            pageCache.Close();

            // Since consistency checker is in read only mode we need to start/stop db to generate label scan store.
            StartStopDatabase(_workingDatabaseLayout.databaseDirectory());
            assertConsistentStore(_workingDatabaseLayout);
        }
Пример #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.kernel.impl.storemigration.UpgradableDatabase getUpgradableDatabase(org.neo4j.kernel.impl.storemigration.StoreVersionCheck check) throws java.io.IOException
        private UpgradableDatabase GetUpgradableDatabase(StoreVersionCheck check)
        {
            VersionAwareLogEntryReader <ReadableClosablePositionAwareChannel> logEntryReader = new VersionAwareLogEntryReader <ReadableClosablePositionAwareChannel>();
            LogFiles       logFiles    = LogFilesBuilder.logFilesBasedOnlyBuilder(_workingDatabaseLayout.databaseDirectory(), _fs).build();
            LogTailScanner tailScanner = new LogTailScanner(logFiles, logEntryReader, new Monitors());

            return(new UpgradableDatabase(check, Standard.LATEST_RECORD_FORMATS, tailScanner));
        }
Пример #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Setup()
        {
            _fileSystem = _fileSystemRule.get();
            PageCache pageCache = _pageCacheRule.getPageCache(_fileSystem);

            _workingStoreDir       = _testDir.storeDir("working_" + Version);
            _workingDatabaseLayout = _testDir.databaseLayout(_workingStoreDir);
            _check = new StoreVersionCheck(pageCache);
            File prepareDirectory = _testDir.directory("prepare_" + Version);

            prepareSampleLegacyDatabase(Version, _fileSystem, _workingDatabaseLayout.databaseDirectory(), prepareDirectory);
        }