コード例 #1
0
  private void shouldImportCsvData0(BatchingPageCache.WriterFactory delegateWriterFactory)
      throws Exception {
    // GIVEN
    Configuration config =
        new Configuration.Default() {
          @Override
          public int denseNodeThreshold() {
            return 30;
          }
        };
    BatchImporter inserter =
        new ParallelBatchImporter(
            directory.getAbsolutePath(),
            new DefaultFileSystemAbstraction(),
            config,
            new DetailedExecutionMonitor(),
            new IoQueue(config.numberOfIoThreads(), delegateWriterFactory));

    // WHEN
    int nodeCount = 100_000;
    int relationshipCount = nodeCount * 10;
    inserter.doImport(
        nodes(nodeCount), relationships(relationshipCount, nodeCount), IdMappers.actualIds());
    inserter.shutdown();

    // THEN
    GraphDatabaseService db =
        new GraphDatabaseFactory().newEmbeddedDatabase(directory.getAbsolutePath());
    try (Transaction tx = db.beginTx()) {
      verifyData(nodeCount, db);

      tx.success();
    } finally {
      db.shutdown();
    }
  }