use of org.neo4j.server.rest.management.console.CypherSession 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();
}
}
Aggregations