use of com.thoughtworks.go.config.ConfigSaveValidationContext in project gocd by gocd.
the class SCMTest method shouldValidateIfNameIsMissing.
@Test
void shouldValidateIfNameIsMissing() {
SCM scm = new SCM();
scm.validate(new ConfigSaveValidationContext(new BasicCruiseConfig(), null));
assertThat(scm.errors().getAllOn(SCM.NAME)).isEqualTo(asList("Please provide name"));
}
use of com.thoughtworks.go.config.ConfigSaveValidationContext in project gocd by gocd.
the class ConfigRepoCommand method isValid.
@Override
public boolean isValid(CruiseConfig preprocessedConfig) {
validateConfigRepoId(this.configRepo);
validateConfigRepoPluginId(this.configRepo);
if (!this.configRepo.errors().isEmpty()) {
return false;
}
preprocessedConfigRepo = preprocessedConfig.getConfigRepos().getConfigRepo(this.configRepo.getId());
preprocessedConfigRepo.validateTree(new ConfigSaveValidationContext(preprocessedConfig));
List<ConfigErrors> allErrors = ErrorCollector.getAllErrors(preprocessedConfigRepo);
if (!allErrors.isEmpty()) {
BasicCruiseConfig.copyErrors(preprocessedConfigRepo, configRepo);
return false;
}
return true;
}
use of com.thoughtworks.go.config.ConfigSaveValidationContext in project gocd by gocd.
the class CreateOrUpdateBackupConfigCommand method isValid.
@Override
public boolean isValid(CruiseConfig preprocessedConfig) {
preprocessedEntityConfig = preprocessedConfig.server().getBackupConfig();
preprocessedEntityConfig.validate(new ConfigSaveValidationContext(preprocessedConfig));
if (preprocessedEntityConfig.errors().present()) {
BasicCruiseConfig.copyErrors(preprocessedEntityConfig, newBackupConfig);
return false;
} else {
return true;
}
}
Aggregations