我将嵌入式Neo4j用于具有以下规则配置的JUnit测试:
@Rule
public Neo4jRule neo4jRule = new Neo4jRule()
.withConfig("dbms.connector.1.enabled", "true")
.withConfig("dbms.connector.1.listen_address", "localhost:4710")
.withConfig("dbms.connector.1.type", "HTTP")
.withConfig("dbms.connector.bolt.enabled", "true")
.withConfig("dbms.connector.bolt.listen_address", ":4711")
.withConfig("apoc.autoIndex.enabled", "true")
.withConfig("ShellSettings.remote_shell_enabled", "true")
.withConfig("ShellSettings.remote_shell_port", "5555")
.withProcedure(apoc.index.FulltextIndex.class)
.withProcedure(apoc.index.FreeTextSearch.class)
.withProcedure(apoc.cypher.Cypher.class);
现在,我想在调试(设置断点)期间通过cypher-shell连接,以查看某个时刻测试数据库中的实际内容。不幸的是,既cypher-shell -a localhost:4711
没有neo4j-shell -port 5555
建立连接。第一个不返回(保持待处理),第二个返回Connection refused
。我想念什么?关于如何建立连接的任何想法?
在调试过程中遇到断点时,嵌入式服务器也会停止响应。
如果要在单元测试期间查看数据库的状态,则需要在没有断点的情况下暂停执行。我的解决方案不是您想要的,但是您可以尝试一下
@Test
public void yourTest() throws IOException {
try {
System.out.pritnln(neo4j.httpURI());
Thread.sleep(100000L);
} catch (Exception e) {
e.printStackTrace();
}
}
上面的代码将暂停100秒,您可以单击控制台中的链接以打开Neo4j浏览器并查询数据库。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句