use of org.neo4j.kernel.internal.GraphDatabaseAPI in project neo4j by neo4j.
the class TestGraphProperties method testEquals.
@Test
public void testEquals() {
GraphDatabaseAPI db = (GraphDatabaseAPI) factory.newImpermanentDatabase();
PropertyContainer graphProperties = properties(db);
try (Transaction tx = db.beginTx()) {
graphProperties.setProperty("test", "test");
tx.success();
}
assertEquals(graphProperties, properties(db));
db.shutdown();
db = (GraphDatabaseAPI) factory.newImpermanentDatabase();
assertFalse(graphProperties.equals(properties(db)));
db.shutdown();
}
use of org.neo4j.kernel.internal.GraphDatabaseAPI in project neo4j by neo4j.
the class TestGraphProperties method produceUncleanStore.
private EphemeralFileSystemAbstraction produceUncleanStore(EphemeralFileSystemAbstraction fileSystem, File storeDir) {
GraphDatabaseService db = new TestGraphDatabaseFactory().setFileSystem(fileSystem).newImpermanentDatabase(storeDir);
Transaction tx = db.beginTx();
Node node = db.createNode();
node.setProperty("name", "Something");
properties((GraphDatabaseAPI) db).setProperty("prop", "Some value");
tx.success();
tx.close();
EphemeralFileSystemAbstraction snapshot = fileSystem.snapshot();
db.shutdown();
return snapshot;
}
use of org.neo4j.kernel.internal.GraphDatabaseAPI in project neo4j by neo4j.
the class TestGraphProperties method twoUncleanInARow.
@Test
public void twoUncleanInARow() throws Exception {
File storeDir = new File("dir");
try (EphemeralFileSystemAbstraction snapshot = produceUncleanStore(fs.get(), storeDir)) {
try (EphemeralFileSystemAbstraction snapshot2 = produceUncleanStore(snapshot, storeDir)) {
GraphDatabaseAPI db = (GraphDatabaseAPI) new TestGraphDatabaseFactory().setFileSystem(produceUncleanStore(snapshot2, storeDir)).newImpermanentDatabase(storeDir);
assertThat(properties(db), inTx(db, hasProperty("prop").withValue("Some value")));
db.shutdown();
}
}
}
use of org.neo4j.kernel.internal.GraphDatabaseAPI in project neo4j by neo4j.
the class FullCheckIntegrationTest method statementOn.
private static KernelStatement statementOn(GraphDatabaseService db) {
DependencyResolver resolver = ((GraphDatabaseAPI) db).getDependencyResolver();
ThreadToStatementContextBridge bridge = resolver.resolveDependency(ThreadToStatementContextBridge.class);
return (KernelStatement) bridge.get();
}
use of org.neo4j.kernel.internal.GraphDatabaseAPI in project neo4j by neo4j.
the class TestKernelExtension method shouldBeShutdown.
/**
* Check that lifecycle status of extension is SHUTDOWN
*/
@Test
public void shouldBeShutdown() throws Exception {
GraphDatabaseAPI graphdb = graphdb(0);
graphdb.shutdown();
assertEquals(LifecycleStatus.SHUTDOWN, graphdb.getDependencyResolver().resolveDependency(KernelExtensions.class).resolveDependency(DummyExtension.class).getStatus());
}
Aggregations