Unit test neo4j with TestNG - newImpermanentDatabase -


when want create graphdatabaseservice in setup() method below:

      private graphdatabaseservice graphdb;        @beforemethod       public void setup() throws exception {         graphdb = new testgraphdatabasefactory().newimpermanentdatabase();       } 

i error:

java.lang.abstractmethoderror: org.neo4j.test.impl.ephemeralfilesystemabstraction.autocreatepath(ljava/io/file;)v     @ org.neo4j.kernel.storelocker.lock(storelocker.java:73)     @ org.neo4j.kernel.internalabstractgraphdatabase.create(internalabstractgraphdatabase.java:287)     @ org.neo4j.kernel.internalabstractgraphdatabase.run(internalabstractgraphdatabase.java:227)     @ org.neo4j.kernel.embeddedgraphdatabase.<init>(embeddedgraphdatabase.java:79)     @ org.neo4j.test.impermanentgraphdatabase.<init>(impermanentgraphdatabase.java:78)     @ org.neo4j.test.testgraphdatabasefactory$1.newdatabase(testgraphdatabasefactory.java:46)     @ org.neo4j.graphdb.factory.graphdatabasebuilder.newgraphdatabase(graphdatabasebuilder.java:205)     @ org.neo4j.test.testgraphdatabasefactory.newimpermanentdatabase(testgraphdatabasefactory.java:36)     @ pl.piotr0123456.neo4j.operations.graphoperationstest.setup(graphoperationstest.java:29) 

as workaround use:

     graphdb = new testgraphdatabasefactory().newembeddeddatabase("target/testgraph/test1"); 

with transaction rollback. think isn't solution.

is possible create each unit test clean graph in memory?

under hoods, impermanentgraphdatabase uses test-data/impermanent-db (in 1.9.rc2) on filesystem. either

  • make sure test-data/impermanent-db has sufficient permissions
  • instantiate impermanentgraphdatabase directly without factory: new org.neo4j.test.impermanentgraphdatabase(mystoredirectory). mystoredirectory temporary directory example.

be aware if run multiple tests in parallel. in case should use second approach since multiple impermanentgraphdatabase instances not allowed share same store directory.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -