Quantcast
Channel: Spring Community Forums - NoSQL
Viewing all articles
Browse latest Browse all 128

[neo4j] Index creation fails when running multiple unit tests

$
0
0
Hi All,

We are having problem to run our unit tests (which uses impermanent graph database) from a gradle build script. Note that there are now quite a number of Unit test case files that perform database related tests.

In the application context file we are using for our unit tests, the impermanent database is defined in the following way

<bean id="graphDatabaseService" class="org.neo4j.test.ImpermanentGraphDatabase"
destroy-method="shutdown">
</bean>
<neo4j:config graphDatabaseService="graphDatabaseService" />


Each of our unit test classes were annotated using @DirtiesContext(classMode = AFTER_CLASS) to make sure we get a clean application context per unit test.

The unit test classes belong to a particular group which is being executed from a gradle build script.
When we run the gradle script we expect each of the unit test will use a fresh application context and so a fresh instance of ImpermanentGraphDatabase.
But the build script fails and stack trace shows that in one of the test methods where I am trying to retrieve the object from repository (i.e., A a = repos.findByPropertyValue("name", A_NAME) ), it is trying to create an index internally and it fails. The stack trace starts like the following

org.neo4j.graphdb.TransactionFailureException: Index creation failed for AgentHostDTO, {provider=lucene, type=exact}"
org.springframework.data.neo4j.support.mapping.Abs tractConstructorEntityInstantiator.createEntityFro mState(AbstractConstructorEntityInstantiator.java: 61)
org.springframework.data.neo4j.support.mapping.Neo 4jEntityPersister$CachedInstantiator.createEntityF romState(Neo4jEntityPersister.java:135)
..............


What can be the possible reason for this index creation failure ?
Even if the unit test uses the same database instance (which we do not want to), the index creation should not fail. Am I correct ?.

Viewing all articles
Browse latest Browse all 128

Trending Articles