@Test( expected = InvalidIdGeneratorException.class ) public void failMigrationWhenNodeIdFileIsBroken() throws Exception { prepareEmpty23Database(); File nodeIdFile = databaseLayout.idNodeStore(); writeFile( nodeIdFile, new byte[]{1, 2, 3} ); indexMigrator.migrate( databaseLayout, migrationLayout, progressReporter, StandardV3_2.STORE_VERSION, StandardV3_2.STORE_VERSION ); }
@Test public void luceneLabelIndexRemovedAfterSuccessfulMigration() throws IOException { prepareEmpty23Database(); indexMigrator.migrate( databaseLayout, migrationLayout, progressReporter, StandardV2_3.STORE_VERSION, StandardV3_2.STORE_VERSION ); indexMigrator.moveMigratedFiles( migrationLayout, databaseLayout, StandardV2_3.STORE_VERSION, StandardV3_2.STORE_VERSION ); assertFalse( fileSystem.fileExists( luceneLabelScanStore ) ); }
@Test public void moveCreatedNativeLabelIndexBackToStoreDirectory() throws IOException { prepareEmpty23Database(); indexMigrator.migrate( databaseLayout, migrationLayout, progressReporter, StandardV2_3.STORE_VERSION, StandardV3_2.STORE_VERSION ); File migrationNativeIndex = migrationLayout.labelScanStore(); ByteBuffer migratedFileContent = writeFile( migrationNativeIndex, new byte[]{5, 4, 3, 2, 1} ); indexMigrator.moveMigratedFiles( migrationLayout, databaseLayout, StandardV2_3.STORE_VERSION, StandardV3_2.STORE_VERSION ); ByteBuffer movedNativeIndex = readFileContent( nativeLabelIndex, 5 ); assertEquals( migratedFileContent, movedNativeIndex ); }
@Test public void clearMigrationDirFromAnyLabelScanStoreBeforeMigrating() throws Exception { // given prepareEmpty23Database(); initializeNativeLabelScanStoreWithContent( migrationLayout ); File toBeDeleted = migrationLayout.labelScanStore(); assertTrue( fileSystem.fileExists( toBeDeleted ) ); // when indexMigrator.migrate( databaseLayout, migrationLayout, progressReporter, StandardV3_2.STORE_VERSION, StandardV3_2.STORE_VERSION ); // then assertNoContentInNativeLabelScanStore( migrationLayout ); }