Search in sources :

Example 81 with TestGraphDatabaseFactory

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

the class ConfigurationIT method before.

@Before
public void before() throws Exception {
    db = (GraphDatabaseAPI) new TestGraphDatabaseFactory().newImpermanentDatabaseBuilder().newGraphDatabase();
    server = new GraphDatabaseShellServer(db);
    client = ShellLobby.newClient(server, InterruptSignalHandler.getHandler());
}
Also used : GraphDatabaseShellServer(org.neo4j.shell.kernel.GraphDatabaseShellServer) TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) Before(org.junit.Before)

Example 82 with TestGraphDatabaseFactory

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

the class LegacyIndexesUpgradeTest method startDatabase.

private GraphDatabaseService startDatabase(boolean allowUpgread) {
    GraphDatabaseFactory factory = new TestGraphDatabaseFactory();
    GraphDatabaseBuilder builder = factory.newEmbeddedDatabaseBuilder(testDir.graphDbDir());
    builder.setConfig(GraphDatabaseSettings.allow_store_upgrade, Boolean.toString(allowUpgread));
    builder.setConfig(GraphDatabaseSettings.pagecache_memory, "8m");
    return builder.newGraphDatabase();
}
Also used : GraphDatabaseFactory(org.neo4j.graphdb.factory.GraphDatabaseFactory) TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) GraphDatabaseBuilder(org.neo4j.graphdb.factory.GraphDatabaseBuilder)

Example 83 with TestGraphDatabaseFactory

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

the class LegacyIndexesUpgradeTest method checkIndexData.

private void checkIndexData() {
    GraphDatabaseService db = new TestGraphDatabaseFactory().newEmbeddedDatabase(testDir.graphDbDir());
    try {
        IntFunction<String> keyFactory = basicKeyFactory();
        Factory<Node> readNodes = readNodes(db);
        readIndex(db, nodeIndex(db, "node-1", EXACT_CONFIG), readNodes, keyFactory, stringValues());
        readIndex(db, nodeIndex(db, "node-2", EXACT_CONFIG), readNodes, keyFactory, intValues());
        readIndex(db, nodeIndex(db, "node-3", FULLTEXT_CONFIG), readNodes, keyFactory, stringValues());
        readIndex(db, nodeIndex(db, "node-4", FULLTEXT_CONFIG), readNodes, keyFactory, longValues());
        Factory<Relationship> relationships = readRelationships(db);
        readIndex(db, relationshipIndex(db, "rel-1", EXACT_CONFIG), relationships, keyFactory, stringValues());
        readIndex(db, relationshipIndex(db, "rel-2", EXACT_CONFIG), relationships, keyFactory, floatValues());
        readIndex(db, relationshipIndex(db, "rel-3", FULLTEXT_CONFIG), relationships, keyFactory, stringValues());
        readIndex(db, relationshipIndex(db, "rel-4", FULLTEXT_CONFIG), relationships, keyFactory, doubleValues());
    } finally {
        db.shutdown();
    }
}
Also used : GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) Node(org.neo4j.graphdb.Node) Relationship(org.neo4j.graphdb.Relationship) TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory)

Example 84 with TestGraphDatabaseFactory

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

the class ProcedureIT method shouldLogLikeThereIsNoTomorrow.

@Test
public void shouldLogLikeThereIsNoTomorrow() throws Throwable {
    // Given
    AssertableLogProvider logProvider = new AssertableLogProvider();
    db.shutdown();
    db = new TestGraphDatabaseFactory().setInternalLogProvider(logProvider).setUserLogProvider(logProvider).newImpermanentDatabaseBuilder().setConfig(plugin_dir, plugins.getRoot().getAbsolutePath()).setConfig(procedure_unrestricted, "org.neo4j.procedure.*").newGraphDatabase();
    // When
    try (Transaction ignore = db.beginTx()) {
        Result res = db.execute("CALL org.neo4j.procedure.logAround()");
        while (res.hasNext()) {
            res.next();
        }
    }
    // Then
    AssertableLogProvider.LogMatcherBuilder match = inLog(Procedures.class);
    logProvider.assertAtLeastOnce(match.debug("1"), match.info("2"), match.warn("3"), match.error("4"));
}
Also used : Transaction(org.neo4j.graphdb.Transaction) KernelTransaction(org.neo4j.kernel.api.KernelTransaction) TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) AssertableLogProvider(org.neo4j.logging.AssertableLogProvider) Result(org.neo4j.graphdb.Result) Test(org.junit.Test)

Example 85 with TestGraphDatabaseFactory

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

the class UserAggregationFunctionIT method setUp.

@Before
public void setUp() throws IOException {
    new JarBuilder().createJarFor(plugins.newFile("myFunctions.jar"), ClassWithFunctions.class);
    db = new TestGraphDatabaseFactory().newImpermanentDatabaseBuilder().setConfig(GraphDatabaseSettings.plugin_dir, plugins.getRoot().getAbsolutePath()).newGraphDatabase();
}
Also used : TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) JarBuilder(org.neo4j.kernel.impl.proc.JarBuilder) Before(org.junit.Before)

Aggregations

TestGraphDatabaseFactory (org.neo4j.test.TestGraphDatabaseFactory)154 Test (org.junit.Test)83 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)77 Transaction (org.neo4j.graphdb.Transaction)56 File (java.io.File)40 Node (org.neo4j.graphdb.Node)32 GraphDatabaseAPI (org.neo4j.kernel.internal.GraphDatabaseAPI)25 Before (org.junit.Before)23 Result (org.neo4j.graphdb.Result)13 EphemeralFileSystemAbstraction (org.neo4j.graphdb.mockfs.EphemeralFileSystemAbstraction)11 Relationship (org.neo4j.graphdb.Relationship)9 GraphDatabaseBuilder (org.neo4j.graphdb.factory.GraphDatabaseBuilder)9 UncloseableDelegatingFileSystemAbstraction (org.neo4j.graphdb.mockfs.UncloseableDelegatingFileSystemAbstraction)9 BeforeClass (org.junit.BeforeClass)8 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)8 AssertableLogProvider (org.neo4j.logging.AssertableLogProvider)8 HashMap (java.util.HashMap)7 Point (org.neo4j.graphdb.spatial.Point)7 DependencyResolver (org.neo4j.graphdb.DependencyResolver)6 PageCache (org.neo4j.io.pagecache.PageCache)6