Hello I have opened this thread to start talking about integration between Arquillian Persistence Extension (from now *APE*) and NoSQLUnit.
Let me introduce the part of NoSQLUnit and what it does. NoSQLUnit has two main modules:
* the first one lifecycle engine. NoSQLUnit manages the lifecycle of the server (as Arquillian does), so you can have embedded, managed or remote way of starting/stopping the servers. So for example in Mongo you can start an embedded in-memory Mongo instance (we are using Fongo), managed which implies you set the MONGO_HOME and NoSQLUnit starts a new instance of Mongo and stops after all tests are executed, and Remote which does nothing. Pretty similar as Arquillian.
* the second one is maintaining the database into known state, that is loading and removing data from a database as provide a way to compare if the values are the expected ones or not.
In case of SQL databases you have public common API, _jdbc_ to connect to all possible vendors of SQL databases. But in case of NoSQL there is no standard way to connect to them, _MongoDB_ has its own, _Neo4J_ the same and so on. In case of NoSQLUnit currently we support 8 databases (document, column, key-value and graph based).
So NoSQLUnit has two main interfaces, one to manage lifecycle and another one to manage all the connections with databases. Each interface is implemented by each supported vendor.
So arrived at this point it is start the integration with APE.
Things I consider for the first version:
* I will forget the lifecycle manage, I think we can consider that user will create the required instance for managing data for us (that means embedded or remote), so we don't have to deal for now with issues about opening and closing external process.
* We should use the annotations already provided by APE for populating data. So I think that this part of the APE should be changed so it can receive the connection for executing SQL queries, but also the NoSQLUnit interface for executing the queries against defined database. We could also add a common interface for both technologies, it is something we should explore if it is possible.
* Currently users of APE need only to define a persistence.xml file and APE will use the related EntityManager (correct me Bartosz if I am wrong). So in this case we should define in some way how user can create the class required for each technology (MongoDB, Neo4j, Redis, Cassandra, ...), and how this class can be used within APE to populate, compare, delete, .. data.
* Also something that does not happens with SQL world and it is the polyglot persistence. Users should be able to populate different kinf of data to different systems (for example on SQL database, one MongoDB and one Redis), so this is something we should see how can be integrated inside APE. In case of NoSQLUnit we are using @Named approach, by setting each connection to a name.
Well I am sure I am missing a lot of things but I think this could be a good start. IMO we don't have to create a new extension for NoSQL databases but improve APE with NoSQL support. But of course if we found it is impossible we could create two separate projects.