Search code examples
javaneo4jgraphawareneo4j-apoc

Loading a plugin into an embedded version of Neo4j database


In a standalone version of Neo4j database server, there's this plugin folder in which I can copy APOC library and then use its awesome functions in my queries. Right now, I'm trying to do the same in a test Java project which instantiates an embedded version of Neo4j, using the Graphaware framework.

My question is, how can I feed the APOC library to the embedded version of the Neo4j when it is setup like this:

class ModuleTest
{
    GraphDatabaseService database;

    @Before
    public void setUp()
    {
        String confFile = this.getClass().getClassLoader().getResource("neo4j-module.conf").getPath();
        database = new TestGraphDatabaseFactory()
                .newImpermanentDatabaseBuilder()
                .loadPropertiesFromFile(confFile)
                .newGraphDatabase();
    }
}

?


Solution

  • You have to register the procedure classes that you want to use during your test.

    An example is in the APOC TestUtil :

    https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/3.0/src/test/java/apoc/util/TestUtil.java#L89