Add support for Fongo to MongoDB backend

Description

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

Environment

None

Activity

Show:
Gunnar Morling
January 23, 2015, 4:09 PM

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?

Alex Soto
January 25, 2015, 10:27 AM

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?

Alex Soto
January 25, 2015, 3:27 PM

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?

Gunnar Morling
January 25, 2015, 5:30 PM

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.

Alex Soto
January 27, 2015, 10:15 AM

Assignee

Unassigned

Reporter

Gunnar Morling

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

Yes, likely

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Priority

Major
Configure