Exemplo n.º 1
0
        private void DeleteCounts(FileSystemAbstraction snapshot)
        {
            DatabaseLayout databaseLayout = TestDirectory.databaseLayout();
            File           alpha          = databaseLayout.CountStoreA();
            File           beta           = databaseLayout.CountStoreB();

            assertTrue(snapshot.DeleteFile(alpha));
            assertTrue(snapshot.DeleteFile(beta));
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotAccidentallyDeleteStoreFilesIfNoMigrationWasRequired() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotAccidentallyDeleteStoreFilesIfNoMigrationWasRequired()
        {
            // given
            CountsMigrator migrator         = new CountsMigrator(_fs, null, Config.defaults());
            DatabaseLayout sourceLayout     = _directory.databaseLayout();
            File           countsStoreFileA = sourceLayout.CountStoreA();
            File           countsStoreFileB = sourceLayout.CountStoreB();

            _fs.create(countsStoreFileA);
            _fs.create(countsStoreFileB);
            DatabaseLayout migrationLayout      = _directory.databaseLayout("migration");
            string         versionToMigrateFrom = StoreVersion.STANDARD_V3_2.versionString();
            string         versionToMigrateTo   = StoreVersion.STANDARD_V3_4.versionString();

            migrator.Migrate(sourceLayout, migrationLayout, SilentProgressReporter.INSTANCE, versionToMigrateFrom, versionToMigrateTo);
            assertEquals("Invalid test assumption: There should not have been migration for those versions", 0, migrationLayout.ListDatabaseFiles((dir, name) => true).Length);

            // when
            migrator.MoveMigratedFiles(migrationLayout, sourceLayout, versionToMigrateFrom, versionToMigrateTo);

            // then
            assertTrue(_fs.fileExists(countsStoreFileA));
            assertTrue(_fs.fileExists(countsStoreFileB));
        }
Exemplo n.º 3
0
 private static System.Predicate <StoreFileMetadata> IsCountFile(DatabaseLayout databaseLayout)
 {
     return(storeFileMetadata => databaseLayout.CountStoreB().Equals(storeFileMetadata.file()) || databaseLayout.CountStoreA().Equals(storeFileMetadata.file()));
 }