The Initializer Validator is a standalone fatjar to make dry runs of your OpenMRS configs and to report on any errors. This enables developers and implementers to be warned well ahead of time that a config would fail when loaded on real OpenMRS instances.
The Initializer Validator replays OpenMRS configs in a Spring context-sensitive test environment, very much like any OpenMRS Spring context-sensitive test. This means that the data (or metadata in this case) is loaded in a real database, in fact an instance of MariaDB. This ensures that the dry run occurs in an environment that is very close to the real app runtime setup.
- Build Initializer with the
validator
profile
mvn clean package -P validator
- Locate a config that you want to validate, eg. at /Users/mksd/repos/openmrs-config-acme/configuration.
- Run it (use absolute paths for arguments):
java -jar ./validator/target/initializer-validator-2.8.0-SNAPSHOT.jar \
--config-dir=/Users/mksd/repos/openmrs-config-acme/configuration
- That's it! The dry run will either pass or fail.
In case of failures all the relevant logs can be analysed at ./validator/target/initializer.log.
java -jar ./validator/target/initializer-validator-2.8.0-SNAPSHOT.jar \
--config-dir=/Users/mksd/repos/openmrs-config-acme/configuration \
--ciel-file=/Users/mksd/Downloads/openmrs_concepts_2.2_20200927.sql
java -jar validator/target/initializer-validator-2.8.0-SNAPSHOT.jar \
--config-dir=/Users/mksd/repos/openmrs-config-acme/configuration \
--domains='!metadatasharing,privileges,roles'
java -jar validator/target/initializer-validator-2.8.0-SNAPSHOT.jar \
--config-dir=/Users/mksd/repos/openmrs-config-acme/configuration \
--domains='concepts,locations'
java -jar validator/target/initializer-validator-2.8.0-SNAPSHOT.jar \
--config-dir=/Users/mksd/repos/openmrs-config-acme/configuration \
--exclude.concepts='*diags*,*interventions*'
In the above example all 'concepts' domain files matching the wildcard patterns *diags*
and *interventions*
will be filtered out.
java -jar ./validator/target/initializer-validator-2.8.0-SNAPSHOT.jar \
--config-dir=/Users/mksd/repos/openmrs-config-acme/configuration --unsafe
The unsafe mode will break as soon as the first loading error occurs, triggering the validation to stop short. This mode is particularly suitable for CI processes that just need to fail early.
Just run the fatjar with no arguments (or with the --help
argument) to get a list of all possible options:
java -jar validator/target/initializer-validator-2.8.0-SNAPSHOT.jar
Make sure to have the Docker Engine installed before running the validator. Please refer to the installation docs for details.