Search in sources :

Example 1 with EmbeddedReadOnlyGraphDatabase

use of org.neo4j.kernel.EmbeddedReadOnlyGraphDatabase in project graphdb by neo4j-attic.

the class TestExceptionTypeOnInvalidIds method createDatabase.

@BeforeClass
public static void createDatabase() {
    String storeDir = "target/var/id_test";
    AbstractNeo4jTestCase.deleteFileOrDirectory(new File(storeDir));
    graphdb = new EmbeddedGraphDatabase(storeDir);
    graphDbReadOnly = new EmbeddedReadOnlyGraphDatabase(storeDir);
}
Also used : EmbeddedGraphDatabase(org.neo4j.kernel.EmbeddedGraphDatabase) EmbeddedReadOnlyGraphDatabase(org.neo4j.kernel.EmbeddedReadOnlyGraphDatabase) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Example 2 with EmbeddedReadOnlyGraphDatabase

use of org.neo4j.kernel.EmbeddedReadOnlyGraphDatabase in project graphdb by neo4j-attic.

the class TestReadOnlyNeo4j method testSimple.

@Test
public void testSimple() {
    DbRepresentation someData = createSomeData();
    GraphDatabaseService readGraphDb = new EmbeddedReadOnlyGraphDatabase(PATH);
    assertEquals(someData, DbRepresentation.of(readGraphDb));
    Transaction tx = readGraphDb.beginTx();
    try {
        readGraphDb.createNode();
    } catch (ReadOnlyDbException e) {
    // good
    }
    tx.finish();
    readGraphDb.shutdown();
}
Also used : GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) Transaction(org.neo4j.graphdb.Transaction) EmbeddedReadOnlyGraphDatabase(org.neo4j.kernel.EmbeddedReadOnlyGraphDatabase) DbRepresentation(org.neo4j.test.DbRepresentation) Test(org.junit.Test)

Aggregations

EmbeddedReadOnlyGraphDatabase (org.neo4j.kernel.EmbeddedReadOnlyGraphDatabase)2 File (java.io.File)1 BeforeClass (org.junit.BeforeClass)1 Test (org.junit.Test)1 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)1 Transaction (org.neo4j.graphdb.Transaction)1 EmbeddedGraphDatabase (org.neo4j.kernel.EmbeddedGraphDatabase)1 DbRepresentation (org.neo4j.test.DbRepresentation)1