use of com.thoughtworks.go.config.ConfigSaveValidationContext in project gocd by gocd.
the class SvnMaterialConfigTest method shouldThrowErrorsIfBothPasswordAndEncryptedPasswordAreProvided.
@Test
public void shouldThrowErrorsIfBothPasswordAndEncryptedPasswordAreProvided() {
SvnMaterialConfig svnMaterialConfig = new SvnMaterialConfig(new UrlArgument("foo/bar"), "password", "encryptedPassword", new GoCipher(), null, false, "folder");
svnMaterialConfig.validate(new ConfigSaveValidationContext(null));
assertThat(svnMaterialConfig.errors().on("password"), is("You may only specify `password` or `encrypted_password`, not both!"));
assertThat(svnMaterialConfig.errors().on("encryptedPassword"), is("You may only specify `password` or `encrypted_password`, not both!"));
}
use of com.thoughtworks.go.config.ConfigSaveValidationContext in project gocd by gocd.
the class SvnMaterialConfigTest method validate_shouldEnsureDestFilePathIsValid.
@Test
public void validate_shouldEnsureDestFilePathIsValid() {
SvnMaterialConfig svnMaterialConfig = new SvnMaterialConfig("/foo", "", "", false);
svnMaterialConfig.setConfigAttributes(Collections.singletonMap(ScmMaterialConfig.FOLDER, "../a"));
svnMaterialConfig.validate(new ConfigSaveValidationContext(null));
assertThat(svnMaterialConfig.errors().on(SvnMaterialConfig.FOLDER), is("Dest folder '../a' is not valid. It must be a sub-directory of the working folder."));
}
use of com.thoughtworks.go.config.ConfigSaveValidationContext in project gocd by gocd.
the class SvnMaterialConfigTest method shouldValidateWhetherTheEncryptedPasswordIsCorrect.
@Test
public void shouldValidateWhetherTheEncryptedPasswordIsCorrect() {
SvnMaterialConfig svnMaterialConfig = new SvnMaterialConfig(new UrlArgument("foo/bar"), "", "encryptedPassword", new GoCipher(), null, false, "folder");
svnMaterialConfig.validate(new ConfigSaveValidationContext(null));
assertThat(svnMaterialConfig.errors().on("encryptedPassword"), is("Encrypted password value for svn material with url 'foo/bar' is invalid. This usually happens when the cipher text is modified to have an invalid value."));
}
use of com.thoughtworks.go.config.ConfigSaveValidationContext in project gocd by gocd.
the class HgMaterialConfigTest method validate_shouldEnsureUrlIsNotBlank.
@Test
public void validate_shouldEnsureUrlIsNotBlank() {
HgMaterialConfig hgMaterialConfig = new HgMaterialConfig("", null);
hgMaterialConfig.validate(new ConfigSaveValidationContext(null));
assertThat(hgMaterialConfig.errors().on(HgMaterialConfig.URL), is("URL cannot be blank"));
}
use of com.thoughtworks.go.config.ConfigSaveValidationContext in project gocd by gocd.
the class SCMTest method shouldValidateName.
@Test
public void shouldValidateName() throws Exception {
SCM scm = new SCM();
scm.setName("some name");
scm.validate(new ConfigSaveValidationContext(null));
assertThat(scm.errors().isEmpty(), is(false));
assertThat(scm.errors().getAllOn(SCM.NAME).get(0), is("Invalid SCM name 'some name'. This must be alphanumeric and can contain underscores and periods (however, it cannot start with a period). The maximum allowed length is 255 characters."));
}
Aggregations