org.neo4j.io.fs.FileUtils.deleteRecursively()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中org.neo4j.io.fs.FileUtils.deleteRecursively()方法的一些代码示例,展示了FileUtils.deleteRecursively()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.deleteRecursively()方法的具体详情如下:
包路径:org.neo4j.io.fs.FileUtils
类名称:FileUtils
方法名:deleteRecursively

FileUtils.deleteRecursively介绍

暂无

代码示例

代码示例来源:origin: neo4j/neo4j

@Override
public void deleteRecursively( File directory ) throws IOException
{
  FileUtils.deleteRecursively( directory );
}

代码示例来源:origin: neo4j/neo4j

private static void deleteStoreDirectory( File storeDir, String directoryName ) throws IOException
{
  File directory = new File( storeDir, directoryName );
  FileUtils.deleteRecursively( directory );
}

代码示例来源:origin: neo4j/neo4j

@Override
public void close()
{
  server.stop();
  this.connectorPortRegister = null;
  try
  {
    additionalClosable.close();
  }
  catch ( IOException e )
  {
    throw new RuntimeException( e );
  }
  try
  {
    if ( looksLikeMd5Hash( serverFolder.getName() ) )
    {
      FileUtils.deleteRecursively( serverFolder );
    }
  }
  catch ( IOException e )
  {
    throw new RuntimeException( "Failed to clean up test server directory.", e );
  }
}

代码示例来源:origin: neo4j/neo4j

deleteRecursively( toMove );

代码示例来源:origin: neo4j/neo4j

void deleteIndex( IndexIdentifier identifier, boolean recovery ) throws IOException
{
  if ( readOnly )
  {
    throw new IllegalStateException( "Index deletion in read only mode is not supported." );
  }
  closeIndex( identifier );
  FileUtils.deleteRecursively( getFileDirectory( baseStorePath, identifier ) );
  indexTypeMap.remove( identifier );
  boolean removeFromIndexStore =
      !recovery || (indexStore.has( identifier.entityType.entityClass(), identifier.indexName ));
  if ( removeFromIndexStore )
  {
    indexStore.remove( identifier.entityType.entityClass(), identifier.indexName );
  }
  typeCache.invalidate( identifier );
}

代码示例来源:origin: neo4j/neo4j

private static void setupGraphDatabase( String testClassName, boolean requiresPersistentGraphDatabase )
{
  AbstractNeo4jTestCase.requiresPersistentGraphDatabase.set( requiresPersistentGraphDatabase );
  AbstractNeo4jTestCase.currentTestClassName.set( testClassName );
  if ( requiresPersistentGraphDatabase )
  {
    try
    {
      FileUtils.deleteRecursively( getStorePath( "neo-test" ) );
    }
    catch ( IOException e )
    {
      throw new RuntimeException( e );
    }
  }
  threadLocalGraphDb.set( (GraphDatabaseAPI) (requiresPersistentGraphDatabase ?
                        new TestGraphDatabaseFactory().newEmbeddedDatabase( getStorePath(
                            "neo-test" ) ) :
                        new TestGraphDatabaseFactory().newImpermanentDatabase()) );
}

代码示例来源:origin: neo4j/neo4j

@Test
@EnabledOnOs( OS.LINUX )
void exceptionOnDirectoryDeletionIncludeTestDisplayName() throws IOException
{
  CONTEXT.clear();
  FailedTestExecutionListener failedTestListener = new FailedTestExecutionListener();
  execute( "lockFileAndFailToDeleteDirectory", failedTestListener );
  File lockedFile = CONTEXT.getValue( LOCKED_TEST_FILE_KEY );
  assertNotNull( lockedFile );
  assertTrue( lockedFile.setReadable( true, true ) );
  FileUtils.deleteRecursively( lockedFile );
  failedTestListener.assertTestObserver();
}

代码示例来源:origin: neo4j/neo4j

@Test
public void shouldReportMissingSchemaIndex() throws Exception
{
  // given
  DatabaseLayout databaseLayout = testDirectory.databaseLayout();
  GraphDatabaseService gds = getGraphDatabaseService( databaseLayout.databaseDirectory() );
  Label label = Label.label( "label" );
  String propKey = "propKey";
  createIndex( gds, label, propKey );
  gds.shutdown();
  // when
  File schemaDir = findFile( databaseLayout, "schema" );
  FileUtils.deleteRecursively( schemaDir );
  ConsistencyCheckService service = new ConsistencyCheckService();
  Config configuration = Config.defaults( settings() );
  Result result = runFullConsistencyCheck( service, configuration, databaseLayout );
  // then
  assertTrue( result.isSuccessful() );
  File reportFile = result.reportFile();
  assertTrue( "Consistency check report file should be generated.", reportFile.exists() );
  assertThat( "Expected to see report about schema index not being online",
      Files.readAllLines( reportFile.toPath() ).toString(), allOf(
          containsString( "schema rule" ),
          containsString( "not online" )
      ) );
}

代码示例来源:origin: neo4j/neo4j

@Test( timeout = TEST_TIMEOUT )
public void notifyWhenWholeStoreDirectoryRemoved() throws IOException, InterruptedException
{
  assumeFalse( SystemUtils.IS_OS_WINDOWS );
  String fileName = testDirectory.databaseLayout().metadataStore().getName();
  FileWatcher fileWatcher = getFileWatcher( database );
  CheckPointer checkpointer = getCheckpointer( database );
  ModificationEventListener modificationListener = new ModificationEventListener( fileName );
  fileWatcher.addFileWatchEventListener( modificationListener );
  do
  {
    createNode( database );
    forceCheckpoint( checkpointer );
  }
  while ( !modificationListener.awaitModificationNotification() );
  fileWatcher.removeFileWatchEventListener( modificationListener );
  String storeDirectoryName = testDirectory.databaseLayout().databaseDirectory().getName();
  DeletionLatchEventListener eventListener = new DeletionLatchEventListener( storeDirectoryName );
  fileWatcher.addFileWatchEventListener( eventListener );
  FileUtils.deleteRecursively( testDirectory.databaseLayout().databaseDirectory() );
  eventListener.awaitDeletionNotification();
  logProvider.assertContainsMessageContaining(
      "'" + storeDirectoryName + "' which belongs to the store was deleted while database was running." );
}

代码示例来源:origin: neo4j/neo4j

FileUtils.deleteRecursively( IndexDirectoryStructure.baseSchemaIndexFolder( dir ) );
db = new TestGraphDatabaseFactory()
    .removeKernelExtensions( INDEX_PROVIDERS_FILTER )

代码示例来源:origin: neo4j/neo4j

deleteRecursively( storeDir );
GraphDatabaseService db = createTestDatabase( storeDir );
RelationshipType type = withName( "SOME_TYPE" );

代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures

@After
public void tearDown() throws IOException {
  db.shutdown();
  FileUtils.deleteRecursively(STORE_DIR);
}

代码示例来源:origin: org.neo4j/neo4j-io

@Override
public void deleteRecursively( File directory ) throws IOException
{
  FileUtils.deleteRecursively( directory );
}

代码示例来源:origin: org.neo4j/neo4j-causal-clustering

private void deleteClusterStateIn( Path target ) throws UnbindFailureException
{
  try
  {
    FileUtils.deleteRecursively( target.toFile() );
  }
  catch ( IOException e )
  {
    throw new UnbindFailureException( e );
  }
}

代码示例来源:origin: org.neo4j/neo4j-com

public static void cleanStoreDir( File storeDir, PageCache pageCache ) throws IOException
{
  for ( File file : relevantDbFiles( storeDir ) )
  {
    FileUtils.deleteRecursively( file );
  }
  pageCache.getCachedFileSystem().streamFilesRecursive( storeDir )
      .filter( fh -> DEEP_STORE_FILE_FILTER.accept( fh.getFile() ) ).forEach( HANDLE_DELETE );
}

代码示例来源:origin: jexp/batch-import

public static void main(String... args) throws IOException {
  System.err.println("Usage: Importer data/dir nodes.csv relationships.csv [node_index node-index-name fulltext|exact nodes_index.csv rel_index rel-index-name fulltext|exact rels_index.csv ....]");
  System.err.println("Using: Importer "+join(args," "));
  System.err.println();
  final Config config = Config.convertArgumentsToConfig(args);
  File graphDb = new File(config.getGraphDbDirectory());
  if (graphDb.exists() && !config.keepDatabase()) {
    FileUtils.deleteRecursively(graphDb);
  }
  Importer importer = new Importer(graphDb, config);
  importer.doImport();
}

代码示例来源:origin: org.neo4j.examples/neo4j-examples

public static void main( final String[] args ) throws IOException
{
  FileUtils.deleteRecursively( DB_PATH );
  Object output = new Object();
  // START SNIPPET: startDbWithLogProvider
  LogProvider logProvider = new MyCustomLogProvider( output );
  graphDb = new GraphDatabaseFactory().setUserLogProvider( logProvider ).newEmbeddedDatabase( DB_PATH );
  // END SNIPPET: startDbWithLogProvider
  shutdown();
}

代码示例来源:origin: org.neo4j.examples/neo4j-examples

public void setUp() throws IOException
{
  FileUtils.deleteRecursively( MATRIX_DB );
  graphDb = new GraphDatabaseFactory().newEmbeddedDatabase( MATRIX_DB );
  registerShutdownHook();
  createNodespace();
}

代码示例来源:origin: org.neo4j.examples/neo4j-examples

public static void main( String[] args ) throws IOException
{
  FileUtils.deleteRecursively( DB_PATH );
  GraphDatabaseService database = new GraphDatabaseFactory().newEmbeddedDatabase( DB_PATH );
  TraversalExample example = new TraversalExample( database );
  Node joe = example.createData();
  example.run( joe );
}

代码示例来源:origin: org.neo4j.examples/neo4j-examples

@BeforeClass
public static void setUp() throws IOException
{
  if ( OrderedPath.DB_PATH.exists() )
  {
    FileUtils.deleteRecursively( OrderedPath.DB_PATH );
  }
  db = new TestGraphDatabaseFactory().newImpermanentDatabase();
  orderedPath = new OrderedPath( db );
  gen = new JavaDocsGenerator( "ordered-path-java", "dev" );
}

相关文章