Domain Model Validator

Domain model validation checks for various semantic errors that might exist within the domain model.

Running up the application will flag any validation issues, as will running an integration test. However, depending upon configuration, the metamodel may only be built lazily, meaning that issues would only be detected while the application is running, rather than at bootstrap.

The DomainModelValidator is a simple utility class that will fully rebuild the metamodel if required, and can then be used to verify that there are no issues.

The example below is taken from the simpleapp starter app:

ValidateDomainModel_IntegTest.java
class ValidateDomainModel_IntegTest
        extends ApplicationIntegTestAbstract {

    @Inject ServiceRegistry serviceRegistry;

    @Test
    void validate() {
        new DomainModelValidator(serviceRegistry).assertValid();
    }
}

To see this in action:

  • change the causeway.applib.annotation.action.explicit configuration property to false in application.yml

  • introduce an error, for example by renaming default0UpdateName to default0UpdateFoo.

  • run the test