Search in sources :

Example 51 with TestDatabaseManagementServiceBuilder

use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.

the class BigStoreIT method startDb.

private void startDb() {
    var builder = new TestDatabaseManagementServiceBuilder(testDirectory.homePath()).setFileSystem(fs);
    managementService = builder.build();
    db = managementService.database(DEFAULT_DATABASE_NAME);
}
Also used : TestDatabaseManagementServiceBuilder(org.neo4j.test.TestDatabaseManagementServiceBuilder)

Example 52 with TestDatabaseManagementServiceBuilder

use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.

the class TestConcurrentRelationshipChainLoadingIssue method tryToTriggerRelationshipLoadingStoppingMidWay.

private void tryToTriggerRelationshipLoadingStoppingMidWay(int denseNodeThreshold) throws Throwable {
    DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder().impermanent().setConfig(dense_node_threshold, denseNodeThreshold).build();
    GraphDatabaseAPI db = (GraphDatabaseAPI) managementService.database(DEFAULT_DATABASE_NAME);
    Node node = createNodeWithRelationships(db);
    checkStateToHelpDiagnoseFlakyTest(db, node);
    long end = currentTimeMillis() + SECONDS.toMillis(5);
    int iterations = 0;
    while (currentTimeMillis() < end && iterations < 100) {
        tryOnce(db, node);
        iterations++;
    }
    managementService.shutdown();
}
Also used : TestDatabaseManagementServiceBuilder(org.neo4j.test.TestDatabaseManagementServiceBuilder) GraphDatabaseAPI(org.neo4j.kernel.internal.GraphDatabaseAPI) Node(org.neo4j.graphdb.Node) DatabaseManagementService(org.neo4j.dbms.api.DatabaseManagementService)

Example 53 with TestDatabaseManagementServiceBuilder

use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.

the class DumpCommandIT method putStoreInDirectory.

private void putStoreInDirectory(Config config, Path databaseDirectory) {
    String databaseName = databaseDirectory.getFileName().toString();
    DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder(databaseDirectory.getParent().getParent().getParent()).setConfig(config).setConfig(default_database, databaseName).build();
    managementService.shutdown();
}
Also used : TestDatabaseManagementServiceBuilder(org.neo4j.test.TestDatabaseManagementServiceBuilder) DatabaseManagementService(org.neo4j.dbms.api.DatabaseManagementService)

Example 54 with TestDatabaseManagementServiceBuilder

use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.

the class DefaultDatabaseManagerUpgradeIT method createDbms.

private void createDbms() {
    TestDatabaseManagementServiceBuilder builder = new TestDatabaseManagementServiceBuilder(neo4jLayout);
    dbms = builder.setConfig(GraphDatabaseSettings.allow_upgrade, false).setUserLogProvider(userLogProvider).build();
}
Also used : TestDatabaseManagementServiceBuilder(org.neo4j.test.TestDatabaseManagementServiceBuilder)

Example 55 with TestDatabaseManagementServiceBuilder

use of org.neo4j.test.TestDatabaseManagementServiceBuilder in project neo4j by neo4j.

the class MemoryRecommendationsCommandTest method createDatabaseWithNativeIndexes.

private static void createDatabaseWithNativeIndexes(Path homeDirectory, String databaseName) {
    // Create one index for every provider that we have
    for (SchemaIndex schemaIndex : SchemaIndex.values()) {
        DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder(homeDirectory).setConfig(default_schema_provider, schemaIndex.providerName()).setConfig(default_database, databaseName).build();
        GraphDatabaseService db = managementService.database(databaseName);
        String key = "key-" + schemaIndex.name();
        try {
            Label labelOne = Label.label("one");
            try (Transaction tx = db.beginTx()) {
                tx.schema().indexFor(labelOne).on(key).create();
                tx.commit();
            }
            try (Transaction tx = db.beginTx()) {
                RandomValues randomValues = RandomValues.create();
                for (int i = 0; i < 10_000; i++) {
                    tx.createNode(labelOne).setProperty(key, randomValues.nextValue().asObject());
                }
                tx.commit();
            }
        } finally {
            managementService.shutdown();
        }
    }
}
Also used : GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) TestDatabaseManagementServiceBuilder(org.neo4j.test.TestDatabaseManagementServiceBuilder) Transaction(org.neo4j.graphdb.Transaction) SchemaIndex(org.neo4j.configuration.GraphDatabaseSettings.SchemaIndex) Label(org.neo4j.graphdb.Label) RandomValues(org.neo4j.values.storable.RandomValues) MemoryRecommendationsCommand.bytesToString(org.neo4j.commandline.dbms.MemoryRecommendationsCommand.bytesToString) DatabaseManagementService(org.neo4j.dbms.api.DatabaseManagementService)

Aggregations

TestDatabaseManagementServiceBuilder (org.neo4j.test.TestDatabaseManagementServiceBuilder)135 DatabaseManagementService (org.neo4j.dbms.api.DatabaseManagementService)74 Test (org.junit.jupiter.api.Test)48 Transaction (org.neo4j.graphdb.Transaction)42 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)38 GraphDatabaseAPI (org.neo4j.kernel.internal.GraphDatabaseAPI)30 Path (java.nio.file.Path)23 BeforeEach (org.junit.jupiter.api.BeforeEach)18 Node (org.neo4j.graphdb.Node)18 EphemeralFileSystemAbstraction (org.neo4j.io.fs.EphemeralFileSystemAbstraction)13 AssertableLogProvider (org.neo4j.logging.AssertableLogProvider)11 PageCache (org.neo4j.io.pagecache.PageCache)10 UncloseableDelegatingFileSystemAbstraction (org.neo4j.io.fs.UncloseableDelegatingFileSystemAbstraction)9 DatabaseLayout (org.neo4j.io.layout.DatabaseLayout)8 KernelTransaction (org.neo4j.kernel.api.KernelTransaction)7 TokenIndexProviderFactory (org.neo4j.kernel.impl.index.schema.TokenIndexProviderFactory)7 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)6 Dependencies (org.neo4j.collection.Dependencies)6 Config (org.neo4j.configuration.Config)6 DatabaseManagementServiceBuilder (org.neo4j.dbms.api.DatabaseManagementServiceBuilder)6