use of com.yahoo.config.model.application.provider.SchemaValidators in project vespa by vespa-engine.
the class VespaModelCreatorWithMockPkg method create.
public VespaModel create(boolean validate, DeployState deployState, ConfigModelRegistry configModelRegistry) {
try {
this.deployState = deployState;
VespaModel model = new VespaModel(configModelRegistry, deployState);
Version vespaVersion = new Version(6);
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)
configChangeActions = Validation.validate(model, false, false, deployState);
}
return model;
} catch (Exception e) {
e.printStackTrace();
throw e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e);
}
}
use of com.yahoo.config.model.application.provider.SchemaValidators in project vespa by vespa-engine.
the class TestDriver method validate.
private void validate(ApplicationPackage appPkg) throws IOException {
if (!validate) {
return;
}
SchemaValidators schemaValidators = new SchemaValidators(new Version(6), new BaseDeployLogger());
if (appPkg.getHosts() != null) {
schemaValidators.hostsXmlValidator().validate(appPkg.getHosts());
}
schemaValidators.servicesXmlValidator().validate(appPkg.getServices());
}
Aggregations