@Override public void copyRecursively( File fromDirectory, File toDirectory ) throws IOException { fs.copyRecursively( fromDirectory, toDirectory ); }
@Override public void copyRecursively( File fromDirectory, File toDirectory ) throws IOException { delegate.copyRecursively( fromDirectory, toDirectory ); }
@Override public void copyRecursively( File fromDirectory, File toDirectory ) throws IOException { adversary.injectFailure( SecurityException.class, IOException.class, NullPointerException.class ); delegate.copyRecursively( fromDirectory, toDirectory ); }
@Override public void copyRecursively( File fromDirectory, File toDirectory ) throws IOException { chooseFileSystem( fromDirectory ).copyRecursively( fromDirectory, toDirectory ); }
private void migrateExplicitIndexes( ProgressReporter progressMonitor ) throws IOException { try { fileSystem.copyRecursively( originalExplicitIndexesRoot, migrationExplicitIndexesRoot ); Path indexRootPath = migrationExplicitIndexesRoot.toPath(); LuceneExplicitIndexUpgrader indexUpgrader = createLuceneExplicitIndexUpgrader( indexRootPath, progressMonitor ); indexUpgrader.upgradeIndexes(); } catch ( ExplicitIndexMigrationException lime ) { log.error( "Migration of explicit indexes failed. Index: " + lime.getFailedIndexName() + " can't be " + "migrated.", lime ); throw new IOException( "Explicit index migration failed.", lime ); } }
public static void prepareSampleLegacyDatabase( String version, FileSystemAbstraction workingFs, File workingDirectory, File prepareDirectory ) throws IOException { if ( !prepareDirectory.exists() ) { throw new IllegalArgumentException( "bad prepare directory" ); } File resourceDirectory = findFormatStoreDirectoryForVersion( version, prepareDirectory ); workingFs.deleteRecursively( workingDirectory ); workingFs.mkdirs( workingDirectory ); workingFs.copyRecursively( resourceDirectory, workingDirectory ); }
@Test public void transferOriginalDataToMigrationDirectory() throws IOException { ExplicitIndexProvider indexProviders = getExplicitIndexProvider(); ExplicitIndexMigrator indexMigrator = new TestExplicitIndexMigrator( fs, indexProviders, logProvider, true ); indexMigrator.migrate( storeLayout, migrationLayout, progressMonitor, StandardV2_3.STORE_VERSION, StandardV3_0.STORE_VERSION ); verify( fs ).copyRecursively( originalIndexStore, migratedIndexStore ); }
@Test public void shouldRefuseToUpgradeIfAllOfTheStoresWereNotShutDownCleanly() throws IOException { File comparisonDirectory = directory.directory( "shouldRefuseToUpgradeIfAllOfTheStoresWereNotShutDownCleanly-comparison" ); removeCheckPointFromTxLog( fileSystem, databaseLayout.databaseDirectory() ); fileSystem.deleteRecursively( comparisonDirectory ); fileSystem.copyRecursively( databaseLayout.databaseDirectory(), comparisonDirectory ); PageCache pageCache = pageCacheRule.getPageCache( fileSystem ); UpgradableDatabase upgradableDatabase = getUpgradableDatabase( pageCache ); try { newUpgrader( upgradableDatabase, pageCache ).migrateIfNeeded( databaseLayout ); fail( "Should throw exception" ); } catch ( StoreUpgrader.UnableToUpgradeException e ) { // expected } verifyFilesHaveSameContent( fileSystem, comparisonDirectory, databaseLayout.databaseDirectory() ); }
@Test public void shouldRefuseToUpgradeIfAnyOfTheStoresWereNotShutDownCleanly() throws IOException { File comparisonDirectory = directory.directory( "shouldRefuseToUpgradeIfAnyOfTheStoresWereNotShutDownCleanly-comparison" ); removeCheckPointFromTxLog( fileSystem, databaseLayout.databaseDirectory() ); fileSystem.deleteRecursively( comparisonDirectory ); fileSystem.copyRecursively( databaseLayout.databaseDirectory(), comparisonDirectory ); PageCache pageCache = pageCacheRule.getPageCache( fileSystem ); UpgradableDatabase upgradableDatabase = getUpgradableDatabase( pageCache ); try { newUpgrader( upgradableDatabase, pageCache ).migrateIfNeeded( databaseLayout ); fail( "Should throw exception" ); } catch ( StoreUpgrader.UnableToUpgradeException e ) { // expected } verifyFilesHaveSameContent( fileSystem, comparisonDirectory, databaseLayout.databaseDirectory() ); }
private void restoreDatabaseFiles( LogFiles backupLogFiles, File[] files ) throws IOException { if ( files != null ) { for ( File file : files ) { if ( file.isDirectory() ) { File destination = new File( databaseDir, file.getName() ); fs.mkdirs( destination ); fs.copyRecursively( file, destination ); } else { fs.copyToDirectory( file, backupLogFiles.isLogFile( file ) ? transactionLogsDirectory : databaseDir ); } } } } }
private void migrateExplicitIndexes( ProgressReporter progressMonitor ) throws IOException { try { fileSystem.copyRecursively( originalExplicitIndexesRoot, migrationExplicitIndexesRoot ); Path indexRootPath = migrationExplicitIndexesRoot.toPath(); LuceneExplicitIndexUpgrader indexUpgrader = createLuceneExplicitIndexUpgrader( indexRootPath, progressMonitor ); indexUpgrader.upgradeIndexes(); } catch ( ExplicitIndexMigrationException lime ) { log.error( "Migration of explicit indexes failed. Index: " + lime.getFailedIndexName() + " can't be " + "migrated.", lime ); throw new IOException( "Explicit index migration failed.", lime ); } }