2
當我想創建GraphDatabaseService在設置()方法如下:單元測試的Neo4j使用TestNG - newImpermanentDatabase
private GraphDatabaseService graphDb;
@BeforeMethod
public void setUp() throws Exception {
graphDb = new TestGraphDatabaseFactory().newImpermanentDatabase();
}
我得到錯誤:
java.lang.AbstractMethodError: org.neo4j.test.impl.EphemeralFileSystemAbstraction.autoCreatePath(Ljava/io/File;)V
at org.neo4j.kernel.StoreLocker.lock(StoreLocker.java:73)
at org.neo4j.kernel.InternalAbstractGraphDatabase.create(InternalAbstractGraphDatabase.java:287)
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:227)
at org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:79)
at org.neo4j.test.ImpermanentGraphDatabase.<init>(ImpermanentGraphDatabase.java:78)
at org.neo4j.test.TestGraphDatabaseFactory$1.newDatabase(TestGraphDatabaseFactory.java:46)
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:205)
at org.neo4j.test.TestGraphDatabaseFactory.newImpermanentDatabase(TestGraphDatabaseFactory.java:36)
at pl.piotr.neo4j.operations.GraphOperationsTest.setUp(GraphOperationsTest.java:29)
作爲解決類似的問題我使用:
graphDb = new TestGraphDatabaseFactory().newEmbeddedDatabase("target/testGraph/test1");
事務回滾。但我認爲這不是一個好的解決方案。
是否可以創建每個單元測試清潔圖在內存中?
當我將neo4j切換到版本1.9.RC2並將setUp()方法更改爲graphDb = new ImpermanentGraphDatabase(); 我得到錯誤: java.lang.AbstractMethodError:org.neo4j.test.impl.EphemeralFileSystemAbstraction.getFileSize(Ljava/IO /文件;).J在org.neo4j.kernel.AutoConfigurator.getFileSizeMb(AutoConfigurator.java:175) \t 當我將neo4j降級到版本1.8.1時,測試是綠色的。 – Piotr0123456 2013-05-05 19:40:14
您是否將所有Neo4j依賴項升級到1.9.RC2? – 2013-05-06 07:12:06
現在我使用maven這種依賴性: org.neo4j Neo4j的 1.8.1 是的,我是想 1.9.RC2 –
Piotr0123456
2013-05-06 11:25:26