Fongo is an in-memory fake implementation of MongoDB. It's an interesting alternative backend for testing an OGM application targetting MongoDB.
The required changes should be minimal; The MongoDBDialect should work as is (provided Fongo does implement everything we need), only a new provider class would be needed (or the existing one to be updated to support both backend types).
Forum reference: https://forum.hibernate.org/viewtopic.php?f=31&t=1037889
Is it possible that this information (during tests ) is from classpath like an spi?
No this is not what happens (although there is the idea to do something like this, see ). The provider needs to explicitly configured via the "hibernate.ogm.datastore.provider" property in persistence.xml or - as in this case - hibernate.properties. Here is the one used for MongoDB tests: https://github.com/hibernate/hibernate-ogm/blob/master/mongodb/src/test/resources/hibernate.properties
So a different one would have to be used for Fongo. Maybe via some Maven profile?
Yesterday I have almost finished the implementation, only one problem, Fongo requires as dependency slf4j, but I have seen that this is not used in Hibernate Ogm, so should I add the dependency to the mongodb module (this is where fongodb provider resides) or you have something against adding this dependency?
There is another option and it is to add slf4j as provided and let the hibernate ogm users that wants to use fongo for testing add slf4j dependency in test scope. WDYT?
Yes, that makes sense. I'd mark the Fongo dependency itself as <optional>true</optional and describe in the documentation that users need to add Fongo and slf4j in test scope to their project.