Search in sources :

Example 1 with UncloseableDelegatingFileSystemAbstraction

use of org.neo4j.io.fs.UncloseableDelegatingFileSystemAbstraction in project neo4j by neo4j.

the class RebuildCountsTest method restart.

private void restart(FileSystemAbstraction fs) {
    if (db != null) {
        managementService.shutdown();
    }
    managementService = new TestDatabaseManagementServiceBuilder(databaseLayout).setUserLogProvider(userLogProvider).setInternalLogProvider(internalLogProvider).setFileSystem(new UncloseableDelegatingFileSystemAbstraction(fs)).impermanent().setConfig(index_background_sampling_enabled, false).build();
    db = managementService.database(DEFAULT_DATABASE_NAME);
}
Also used : TestDatabaseManagementServiceBuilder(org.neo4j.test.TestDatabaseManagementServiceBuilder) UncloseableDelegatingFileSystemAbstraction(org.neo4j.io.fs.UncloseableDelegatingFileSystemAbstraction)

Example 2 with UncloseableDelegatingFileSystemAbstraction

use of org.neo4j.io.fs.UncloseableDelegatingFileSystemAbstraction in project neo4j by neo4j.

the class ConsistencyCheckWithCorruptGBPTreeIT method dbmsAction.

/**
 * Open dbms with schemaIndex as default index provider on provided file system abstraction and apply dbSetup to DEFAULT_DATABASE.
 */
private void dbmsAction(Path neo4jHome, FileSystemAbstraction fs, GraphDatabaseSettings.SchemaIndex schemaIndex, Consumer<GraphDatabaseService> dbSetup, Consumer<DatabaseManagementServiceBuilder> dbConfiguration) {
    TestDatabaseManagementServiceBuilder builder = new TestDatabaseManagementServiceBuilder(neo4jHome).setFileSystem(new UncloseableDelegatingFileSystemAbstraction(fs));
    dbConfiguration.accept(builder);
    final DatabaseManagementService dbms = builder.setConfig(GraphDatabaseSettings.default_schema_provider, schemaIndex.providerName()).build();
    try {
        final GraphDatabaseService db = dbms.database(DEFAULT_DATABASE_NAME);
        dbSetup.accept(db);
    } finally {
        dbms.shutdown();
    }
}
Also used : GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) TestDatabaseManagementServiceBuilder(org.neo4j.test.TestDatabaseManagementServiceBuilder) UncloseableDelegatingFileSystemAbstraction(org.neo4j.io.fs.UncloseableDelegatingFileSystemAbstraction) DatabaseManagementService(org.neo4j.dbms.api.DatabaseManagementService)

Example 3 with UncloseableDelegatingFileSystemAbstraction

use of org.neo4j.io.fs.UncloseableDelegatingFileSystemAbstraction in project neo4j by neo4j.

the class TestLogPruning method newDb.

private GraphDatabaseAPI newDb(String logPruning, int rotateEveryNTransactions) {
    this.rotateEveryNTransactions = rotateEveryNTransactions;
    fs = new EphemeralFileSystemAbstraction();
    TestDatabaseManagementServiceBuilder gdf = new TestDatabaseManagementServiceBuilder();
    gdf.setFileSystem(new UncloseableDelegatingFileSystemAbstraction(fs));
    DatabaseManagementServiceBuilder builder = gdf.impermanent();
    builder.setConfig(keep_logical_logs, logPruning);
    managementService = builder.build();
    this.db = (GraphDatabaseAPI) managementService.database(DEFAULT_DATABASE_NAME);
    files = db.getDependencyResolver().resolveDependency(LogFiles.class);
    return db;
}
Also used : TestDatabaseManagementServiceBuilder(org.neo4j.test.TestDatabaseManagementServiceBuilder) EphemeralFileSystemAbstraction(org.neo4j.io.fs.EphemeralFileSystemAbstraction) TestDatabaseManagementServiceBuilder(org.neo4j.test.TestDatabaseManagementServiceBuilder) DatabaseManagementServiceBuilder(org.neo4j.dbms.api.DatabaseManagementServiceBuilder) LogFiles(org.neo4j.kernel.impl.transaction.log.files.LogFiles) UncloseableDelegatingFileSystemAbstraction(org.neo4j.io.fs.UncloseableDelegatingFileSystemAbstraction)

Example 4 with UncloseableDelegatingFileSystemAbstraction

use of org.neo4j.io.fs.UncloseableDelegatingFileSystemAbstraction in project neo4j by neo4j.

the class IndexStatisticsIT method startDb.

private void startDb() {
    managementService = new TestDatabaseManagementServiceBuilder().setInternalLogProvider(logProvider).setFileSystem(new UncloseableDelegatingFileSystemAbstraction(fs)).impermanent().setConfig(index_background_sampling_enabled, false).build();
    db = managementService.database(DEFAULT_DATABASE_NAME);
}
Also used : TestDatabaseManagementServiceBuilder(org.neo4j.test.TestDatabaseManagementServiceBuilder) UncloseableDelegatingFileSystemAbstraction(org.neo4j.io.fs.UncloseableDelegatingFileSystemAbstraction)

Example 5 with UncloseableDelegatingFileSystemAbstraction

use of org.neo4j.io.fs.UncloseableDelegatingFileSystemAbstraction in project neo4j by neo4j.

the class TestReadOnlyNeo4j method createIndex.

private void createIndex() {
    DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder(testDirectory.homePath()).setFileSystem(new UncloseableDelegatingFileSystemAbstraction(fs)).impermanent().build();
    GraphDatabaseService db = managementService.database(DEFAULT_DATABASE_NAME);
    try (Transaction tx = db.beginTx()) {
        tx.schema().indexFor(Label.label("label")).on("prop").create();
        tx.commit();
    }
    try (Transaction tx = db.beginTx()) {
        tx.schema().awaitIndexesOnline(2, TimeUnit.MINUTES);
        tx.commit();
    }
    managementService.shutdown();
}
Also used : GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) TestDatabaseManagementServiceBuilder(org.neo4j.test.TestDatabaseManagementServiceBuilder) Transaction(org.neo4j.graphdb.Transaction) UncloseableDelegatingFileSystemAbstraction(org.neo4j.io.fs.UncloseableDelegatingFileSystemAbstraction) DatabaseManagementService(org.neo4j.dbms.api.DatabaseManagementService)

Aggregations

UncloseableDelegatingFileSystemAbstraction (org.neo4j.io.fs.UncloseableDelegatingFileSystemAbstraction)9 TestDatabaseManagementServiceBuilder (org.neo4j.test.TestDatabaseManagementServiceBuilder)9 DatabaseManagementService (org.neo4j.dbms.api.DatabaseManagementService)4 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)3 BeforeEach (org.junit.jupiter.api.BeforeEach)2 Transaction (org.neo4j.graphdb.Transaction)2 DatabaseManagementServiceBuilder (org.neo4j.dbms.api.DatabaseManagementServiceBuilder)1 Node (org.neo4j.graphdb.Node)1 Relationship (org.neo4j.graphdb.Relationship)1 RelationshipType (org.neo4j.graphdb.RelationshipType)1 EphemeralFileSystemAbstraction (org.neo4j.io.fs.EphemeralFileSystemAbstraction)1 TokenIndexProviderFactory (org.neo4j.kernel.impl.index.schema.TokenIndexProviderFactory)1 LogFiles (org.neo4j.kernel.impl.transaction.log.files.LogFiles)1 DbRepresentation (org.neo4j.test.DbRepresentation)1 LimitedFilesystemAbstraction (org.neo4j.test.limited.LimitedFilesystemAbstraction)1