private void deleteLuceneLabelIndex( File indexRootDirectory ) throws IOException { fileSystem.deleteRecursively( indexRootDirectory ); }
private void deleteIndexes( File indexRootDirectory ) throws IOException { fileSystem.deleteRecursively( indexRootDirectory ); } }
private void deleteSilently( File dir ) { try { fileSystem.deleteRecursively( dir ); } catch ( IOException e ) { log.error( "Unable to delete directory: " + dir, e ); } }
@Override public void cleanup( DatabaseLayout migrationLayout ) throws IOException { fileSystem.deleteRecursively( migrationLayout.databaseDirectory() ); }
@Override public void deleteRecursively( File directory ) throws IOException { fs.deleteRecursively( directory ); }
@Override public void cleanup( DatabaseLayout migrationLayout ) throws IOException { fileSystem.deleteRecursively( migrationLayout.databaseDirectory() ); }
@Override public void cleanup( DatabaseLayout migrationLayout ) throws IOException { if ( isIndexMigrationDirectoryExists() ) { fileSystem.deleteRecursively( migrationExplicitIndexesRoot ); } }
@Override public void deleteRecursively( File directory ) throws IOException { delegate.deleteRecursively( directory ); }
@Override public void moveMigratedFiles( DatabaseLayout migrationLayout, DatabaseLayout directoryLayout, String versionToMigrateFrom, String versionToMigrateTo ) throws IOException { if ( explicitIndexMigrated ) { fileSystem.deleteRecursively( originalExplicitIndexesRoot ); fileSystem.moveToDirectory( migrationExplicitIndexesRoot, originalExplicitIndexesRoot.getParentFile() ); } }
private void cleanup() throws IOException { File tempStoreDirectory = temporaryDatabaseLayout.getStoreLayout().storeDirectory(); if ( !tempStoreDirectory.getParentFile().equals( databaseLayout.databaseDirectory() ) ) { throw new IllegalStateException( "Temporary store is dislocated. It should be located under current database directory but instead located in: " + tempStoreDirectory.getParent() ); } fileSystem.deleteRecursively( tempStoreDirectory ); }
@Override public void deleteRecursively( File directory ) throws IOException { chooseFileSystem( directory ).deleteRecursively( directory ); }
@Override public void deleteRecursively( File directory ) throws IOException { adversary.injectFailure( SecurityException.class, NullPointerException.class, IOException.class ); delegate.deleteRecursively( directory ); }
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 ); }
private static File clean( FileSystemAbstraction fs, File dir ) throws IOException { if ( fs.fileExists( dir ) ) { fs.deleteRecursively( dir ); } fs.mkdirs( dir ); return dir; }
@Test public void skipEmptyIndexStorageMigration() throws IOException { when( fs.listFiles( originalIndexStore ) ).thenReturn( null ); 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, never() ).deleteRecursively( originalIndexStore ); verify( fs, never() ).moveToDirectory( migratedIndexStore, storeLayout.databaseDirectory() ); }
@Test public void cleanupMigrationDirectory() throws IOException { when( fs.fileExists( migratedIndexStore ) ).thenReturn( true ); ExplicitIndexProvider indexProviders = getExplicitIndexProvider(); ExplicitIndexMigrator indexMigrator = new TestExplicitIndexMigrator( fs, indexProviders, logProvider, true ); indexMigrator.migrate( storeLayout, migrationLayout, progressMonitor, StandardV2_3.STORE_VERSION, StandardV3_0.STORE_VERSION ); indexMigrator.cleanup( migrationLayout ); verify( fs ).deleteRecursively( migratedIndexStore ); }
@Test public void transferMigratedIndexesToStoreDirectory() 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 ); reset( fs ); indexMigrator.moveMigratedFiles( migrationLayout, storeLayout, "any", "any" ); verify( fs ).deleteRecursively( originalIndexStore ); verify( fs ).moveToDirectory( migratedIndexStore, storeLayout.databaseDirectory() ); }
@Test void deleteRecursivelyMustDeleteGivenDirectory() throws Exception { fsa.mkdirs( path ); fsa.deleteRecursively( path ); assertFalse( fsa.fileExists( path ) ); }
@Test void deleteRecursivelyMustDeleteGivenFile() throws Exception { fsa.mkdirs( path ); File file = new File( path, "file" ); fsa.create( file ).close(); fsa.deleteRecursively( file ); assertFalse( fsa.fileExists( file ) ); }
@Test public void canRemoveFilesAndReinvokeShutdown() throws IOException { GraphDatabaseAPI databaseAPI = (GraphDatabaseAPI) this.graphDb; FileSystemAbstraction fileSystemAbstraction = getDatabaseFileSystem( databaseAPI ); graphDb.shutdown(); fileSystemAbstraction.deleteRecursively( databaseAPI.databaseLayout().databaseDirectory() ); graphDb.shutdown(); }