Search in sources :

Example 26 with ConfigSaveValidationContext

use of com.thoughtworks.go.config.ConfigSaveValidationContext in project gocd by gocd.

the class ScmMaterialConfigTest method shouldNotValidateEmptyDestinationFolder.

@Test
public void shouldNotValidateEmptyDestinationFolder() {
    material.setConfigAttributes(Collections.singletonMap(ScmMaterialConfig.FOLDER, ""));
    material.validate(new ConfigSaveValidationContext(null));
    assertThat(material.errors.isEmpty(), is(true));
}
Also used : ConfigSaveValidationContext(com.thoughtworks.go.config.ConfigSaveValidationContext) Test(org.junit.Test)

Example 27 with ConfigSaveValidationContext

use of com.thoughtworks.go.config.ConfigSaveValidationContext in project gocd by gocd.

the class GitMaterialConfigTest method validate_shouldEnsureUrlIsNotBlank.

@Test
public void validate_shouldEnsureUrlIsNotBlank() {
    GitMaterialConfig gitMaterialConfig = new GitMaterialConfig("");
    gitMaterialConfig.validate(new ConfigSaveValidationContext(null));
    assertThat(gitMaterialConfig.errors().on(GitMaterialConfig.URL), is("URL cannot be blank"));
}
Also used : ConfigSaveValidationContext(com.thoughtworks.go.config.ConfigSaveValidationContext) Test(org.junit.Test)

Example 28 with ConfigSaveValidationContext

use of com.thoughtworks.go.config.ConfigSaveValidationContext in project gocd by gocd.

the class SCMTest method shouldValidateIfNameIsMissing.

@Test
public void shouldValidateIfNameIsMissing() {
    SCM scm = new SCM();
    scm.validate(new ConfigSaveValidationContext(new BasicCruiseConfig(), null));
    assertThat(scm.errors().getAllOn(SCM.NAME), is(asList("Please provide name")));
}
Also used : ConfigSaveValidationContext(com.thoughtworks.go.config.ConfigSaveValidationContext) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) Test(org.junit.Test)

Aggregations

ConfigSaveValidationContext (com.thoughtworks.go.config.ConfigSaveValidationContext)28 Test (org.junit.Test)26 GoCipher (com.thoughtworks.go.security.GoCipher)9 UrlArgument (com.thoughtworks.go.util.command.UrlArgument)7 BasicCruiseConfig (com.thoughtworks.go.config.BasicCruiseConfig)3 PipelineConfigSaveValidationContext (com.thoughtworks.go.config.PipelineConfigSaveValidationContext)3 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)2 MingleConfig (com.thoughtworks.go.config.MingleConfig)2 SCM (com.thoughtworks.go.domain.scm.SCM)1