use of org.neo4j.server.database.WrappedDatabase in project neo4j by neo4j.
the class CypherSessionTest method shouldReturnASingleNode.
@Test
public void shouldReturnASingleNode() throws Throwable {
GraphDatabaseFacade graphdb = (GraphDatabaseFacade) new TestGraphDatabaseFactory().newImpermanentDatabase();
Database database = new WrappedDatabase(graphdb);
CypherExecutor executor = new CypherExecutor(database, NullLogProvider.getInstance());
executor.start();
HttpServletRequest request = mock(HttpServletRequest.class);
when(request.getScheme()).thenReturn("http");
when(request.getRemoteAddr()).thenReturn("127.0.0.1");
when(request.getRemotePort()).thenReturn(5678);
when(request.getServerName()).thenReturn("127.0.0.1");
when(request.getServerPort()).thenReturn(7474);
when(request.getRequestURI()).thenReturn("/");
try {
CypherSession session = new CypherSession(executor, NullLogProvider.getInstance(), request);
Pair<String, String> result = session.evaluate("create (a) return a");
assertThat(result.first(), containsString("Node[0]"));
} finally {
graphdb.shutdown();
}
}
use of org.neo4j.server.database.WrappedDatabase in project neo4j by neo4j.
the class RestfulGraphDatabaseTest method doBefore.
@BeforeClass
public static void doBefore() throws IOException {
graph = (GraphDatabaseFacade) new TestGraphDatabaseFactory().newImpermanentDatabase();
database = new WrappedDatabase(graph);
helper = new GraphDbHelper(database);
output = new EntityOutputFormat(new JsonFormat(), URI.create(BASE_URI), null);
service = new TransactionWrappingRestfulGraphDatabase(graph, new RestfulGraphDatabase(new JsonFormat(), output, new DatabaseActions(new LeaseManager(Clocks.fakeClock()), true, database.getGraph()), new ConfigAdapter(Config.embeddedDefaults())));
}
use of org.neo4j.server.database.WrappedDatabase in project neo4j by neo4j.
the class DatabaseMetadataServiceTest method shouldAdvertiseRelationshipTypesThatCurrentlyInUseInTheDatabase.
@Test
public void shouldAdvertiseRelationshipTypesThatCurrentlyInUseInTheDatabase() throws Throwable {
try (Transaction tx = db.beginTx()) {
db.getRelationshipById(relId).delete();
tx.success();
}
Database database = new WrappedDatabase(db);
DatabaseMetadataService service = new DatabaseMetadataService(database);
try (Transaction tx = db.beginTx()) {
Response response = service.getRelationshipTypes(true);
assertEquals(200, response.getStatus());
List<Map<String, Object>> jsonList = JsonHelper.jsonToList(response.getEntity().toString());
assertEquals(2, jsonList.size());
}
database.stop();
}
use of org.neo4j.server.database.WrappedDatabase in project neo4j by neo4j.
the class PagingTraversalTest method startDatabase.
@Before
public void startDatabase() throws IOException {
graph = (GraphDatabaseFacade) new TestGraphDatabaseFactory().newImpermanentDatabase();
database = new WrappedDatabase(graph);
helper = new GraphDbHelper(database);
EntityOutputFormat output = new EntityOutputFormat(new JsonFormat(), URI.create(BASE_URI), null);
leaseManager = new LeaseManager(Clocks.fakeClock());
service = new RestfulGraphDatabase(new JsonFormat(), output, new DatabaseActions(leaseManager, true, database.getGraph()), null);
service = new TransactionWrappingRestfulGraphDatabase(graph, service);
}
use of org.neo4j.server.database.WrappedDatabase in project neo4j by neo4j.
the class DatabaseActionsTest method createDb.
@BeforeClass
public static void createDb() throws IOException {
graph = (GraphDatabaseFacade) new TestGraphDatabaseFactory().newImpermanentDatabase();
database = new WrappedDatabase(graph);
graphdbHelper = new GraphDbHelper(database);
actions = new TransactionWrappedDatabaseActions(new LeaseManager(Clocks.fakeClock()), database.getGraph());
}
Aggregations