With ModeShape 5 supporting DB persistence, we should add a new Maven module (similar to the already existing modeshape-performance-tests module) which uses Docker to start up several DBs and run a set of integration tests across all of the different DBs.
Build-wise, the modeshape-persistence-tests module should:
- be configured in the main build similar to the modeshape-performance-tests module and activated via an optional profile (e.g. persistence)
- use the Docker Maven plugin to start up several Docker images, one for each of the supported DBs: PostgreSQL, MySQL and Oracle (the last one might be a bit tricky image-wise, but IIRC there is a Docker image out there which we can use)
- use the Maven failsafe plugin to run the integration tests multiple times, each time against a specific database using different system properties to specify the connection properties and config options
The above can be achieved with a single repository JSON file which uses for the DB connection properties system property placeholders which are in turn fed-in via the failsafe plugin
The above steps are similar in may ways to the Debezium MySQL Connector build so one can use that as "inspiration". For example, this section shows how to configure failsafe to run the integration tests once. It also uses the Fabric8 Docker Maven plugin to configure multiple containers, which in this example are all variations of MySQL. (Initially, ModeShape only needs to run one container for MySQL, one for Postgres, etc.) Although Debezium runs the integration tests multiple times during the assembly profile, ModeShape could just add multiple executions to the normal failsafe plugin definition.
The goal is to run in one single build the same tests against each of the supported databases.
Content wise, the module should probably have 1 repository configuration file and one integration test case class which covers as many of the main repository read/write scenarios as possible. For example, at least the following should be covered:
- starting/stopping/restarting a repository with initial content and CNDs (similar to some of the tests from JcrRepositoryStartupTest)
- starting/backing up/cleaning/restoring a repository (similar to some of the tests from JcrRepositoryBackupRestoreTests)
- inserting/editing/deleting/querying/reading nodes
- inserting/editing/deleting/querying/reading nodes with binary values
- performing JCR import/export both of document view and system view documents
Note that IMO we don't need to duplicate all the test cases which we already have from modeshape-jcr. We mainly need one solid test method per read-write scenario. It's also fine to simply take (copy-paste) sections or even existing tests. So for example for sequencing, we just want to test that a sequenced file is stored correctly in the DB, not test all the different sequencers.