use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.
the class PasswordDeserializerTest method shouldErrorOutWhenBothPasswordAndEncryptedPasswordAreGivenForDeserialization.
@Test
public void shouldErrorOutWhenBothPasswordAndEncryptedPasswordAreGivenForDeserialization() throws CryptoException {
SvnMaterialConfig svnMaterialConfig = svn();
PasswordDeserializer passwordDeserializer = new PasswordDeserializer();
passwordDeserializer.deserialize("password", new GoCipher().encrypt("encryptedPassword"), svnMaterialConfig);
assertThat(svnMaterialConfig.errors().getAllOn("password"), is(Arrays.asList("You may only specify `password` or `encrypted_password`, not both!")));
assertThat(svnMaterialConfig.errors().getAllOn("encryptedPassword"), is(Arrays.asList("You may only specify `password` or `encrypted_password`, not both!")));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.
the class MaterialConfigsTest method shouldNotRunMultipleMaterialsValidationIfPipelineContainsOnlyOneMaterial.
@Test
public void shouldNotRunMultipleMaterialsValidationIfPipelineContainsOnlyOneMaterial() {
CruiseConfig config = GoConfigMother.configWithPipelines("one");
PipelineConfig pipelineOne = config.pipelineConfigByName(new CaseInsensitiveString("one"));
SvnMaterialConfig svnMaterialConfig = MaterialConfigsMother.svnMaterialConfig();
svnMaterialConfig.setFolder(null);
pipelineOne.setMaterialConfigs(new MaterialConfigs(svnMaterialConfig));
pipelineOne.materialConfigs().validate(ConfigSaveValidationContext.forChain(config));
assertThat(svnMaterialConfig.errors().toString(), svnMaterialConfig.errors().getAll().size(), is(0));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.
the class MaterialConfigsTest method shouldGetExistingOrDefaultMaterialCorrectly.
@Test
public void shouldGetExistingOrDefaultMaterialCorrectly() {
SvnMaterialConfig svn = svn("http://test.com", false);
PackageMaterialConfig p1 = new PackageMaterialConfig("p1");
PackageMaterialConfig p2 = new PackageMaterialConfig("p2");
assertThat(new MaterialConfigs(svn, p2).getExistingOrDefaultMaterial(p1).getPackageId(), is("p2"));
assertThat(new MaterialConfigs(svn).getExistingOrDefaultMaterial(p1).getPackageId(), is("p1"));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.
the class MaterialConfigsTest method shouldValidateTree.
@Test
public void shouldValidateTree() {
GitMaterialConfig git = git();
git.setName(new CaseInsensitiveString("mat-name"));
SvnMaterialConfig svn = svn("url", true);
svn.setName(new CaseInsensitiveString("mat-name"));
P4MaterialConfig p4 = p4();
TfsMaterialConfig tfs = tfs();
HgMaterialConfig hg = hg();
MaterialConfigs materialConfigs = new MaterialConfigs(git, svn, p4, tfs, hg);
PipelineConfig pipelineConfig = new PipelineConfig(new CaseInsensitiveString("p1"), new MaterialConfigs(svn));
materialConfigs.validateTree(PipelineConfigSaveValidationContext.forChain(true, "group", new BasicCruiseConfig(new BasicPipelineConfigs(pipelineConfig)), pipelineConfig));
assertThat(git.errors().on(GitMaterialConfig.MATERIAL_NAME), contains("You have defined multiple materials called 'mat-name'"));
assertThat(git.errors().on(GitMaterialConfig.URL), is("URL cannot be blank"));
assertThat(svn.errors().on(SvnMaterialConfig.MATERIAL_NAME), contains("You have defined multiple materials called 'mat-name'"));
assertThat(p4.errors().on(P4MaterialConfig.VIEW), contains("P4 view cannot be empty."));
assertThat(tfs.errors().on(TfsMaterialConfig.URL), contains("URL cannot be blank"));
assertThat(hg.errors().on(HgMaterialConfig.URL), is("URL cannot be blank"));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.
the class MaterialConfigsTest method shouldGetExistingOrDefaultPluggableSCMMaterialCorrectly.
@Test
public void shouldGetExistingOrDefaultPluggableSCMMaterialCorrectly() {
SvnMaterialConfig svn = svn("http://test.com", false);
PluggableSCMMaterialConfig pluggableSCMMaterialOne = new PluggableSCMMaterialConfig("scm-id-1");
PluggableSCMMaterialConfig pluggableSCMMaterialTwo = new PluggableSCMMaterialConfig("scm-id-2");
assertThat(new MaterialConfigs(svn, pluggableSCMMaterialTwo).getExistingOrDefaultMaterial(pluggableSCMMaterialOne).getScmId(), is("scm-id-2"));
assertThat(new MaterialConfigs(svn).getExistingOrDefaultMaterial(pluggableSCMMaterialOne).getScmId(), is("scm-id-1"));
}
Aggregations