public VespaModel create(boolean validate, DeployState deployState, ConfigModelRegistry configModelRegistry) {
        try {
            this.deployState = deployState;
            VespaModel model = new VespaModel(configModelRegistry, deployState);
            Version vespaVersion = new Version(8);
            if (validate) {
                SchemaValidators validators = new SchemaValidators(vespaVersion);
                try {
                    if (appPkg.getHosts() != null) {
                        validators.hostsXmlValidator().validate(appPkg.getHosts());
                    }
                    if (appPkg.getDeployment().isPresent()) {
                        validators.deploymentXmlValidator().validate(appPkg.getDeployment().get());
                    }
                    validators.servicesXmlValidator().validate(appPkg.getServices());
                } catch (Exception e) {
                    System.err.println(e.getClass());
                    throw e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e);
                }
                // Validate, but without checking configSources or routing (routing
                // is constructed in a special way and cannot always be validated in
                // this step for unit tests)
                ValidationParameters validationParameters = new ValidationParameters(CheckRouting.FALSE);
                configChangeActions = new Validation().validate(model, validationParameters, deployState);
            }
            return model;
        } catch (Exception e) {
            e.printStackTrace();
            throw e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e);
        }
    }
For testing purposes only.

@author Tony Vaagenes
config-model/src/test/java/com/yahoo/vespa/model/test/utils/VespaModelCreatorWithMockPkg.java