I'm writing Spring Data Neo4J repository tests with @DataNeo4jTest
and all is well until I write a test against a custom query that uses a procedure, for example apoc.coll.intersection
. The error declares procedure apoc.coll.intersection
is unknown. I have the APOC JAR on the classpath so am guessing I need to find a way to register the procedure with the embedded datasource/driver that @DataNeo4jTest
uses.
Any help would be appreciated. Thanks.
After messing around with this for quite some time, trying different dependency versions and also playing with configuration code as suggested by @meistermeier I found a solution, which was to simply use the correct version of the 2 Neo4J test JARs I was referencing. This is a Spring Boot project so here are all the Neo4J dependencies in my Maven POM that solve the issue:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-neo4j</artifactId>
</dependency>
<dependency>
<groupId>org.neo4j.test</groupId>
<artifactId>neo4j-harness</artifactId>
<version>${neo4j.ogm.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-embedded-driver</artifactId>
<version>${neo4j.ogm.version}</version>
<scope>test</scope>
</dependency>
I set neo4j.ogm.version
to match the version specified in the spring-data-neo4j-parent
POM (which is brought in transitively).