use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.
the class MaterialConfigsMother method svnMaterialConfig.
public static SvnMaterialConfig svnMaterialConfig(String svnUrl, String folder, boolean autoUpdate) {
SvnMaterialConfig materialConfig = new SvnMaterialConfig(new UrlArgument(svnUrl), "user", "pass", true, new GoCipher(), autoUpdate, new Filter(new IgnoredFiles("*.doc")), false, folder, new CaseInsensitiveString("svn-material"));
materialConfig.setPassword("pass");
return materialConfig;
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.
the class ConfigConverterTest method shouldConvertSvmMaterialWhenEncryptedPassword.
@Test
public void shouldConvertSvmMaterialWhenEncryptedPassword() {
CRSvnMaterial crSvnMaterial = CRSvnMaterial.withEncryptedPassword("name", "folder", true, false, filter, "url", "username", "encryptedvalue", true);
SvnMaterialConfig svnMaterialConfig = (SvnMaterialConfig) configConverter.toMaterialConfig(crSvnMaterial, context);
assertThat(svnMaterialConfig.getName().toLower(), is("name"));
assertThat(svnMaterialConfig.getFolder(), is("folder"));
assertThat(svnMaterialConfig.getAutoUpdate(), is(true));
assertThat(svnMaterialConfig.getFilterAsString(), is("filter"));
assertThat(svnMaterialConfig.getUrl(), is("url"));
assertThat(svnMaterialConfig.getUserName(), is("username"));
assertThat(svnMaterialConfig.getPassword(), is("secret"));
assertThat(svnMaterialConfig.isCheckExternals(), is(true));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.
the class ConfigConverterTest method shouldConvertSvmMaterialWhenPlainPassword.
@Test
public void shouldConvertSvmMaterialWhenPlainPassword() {
CRSvnMaterial crSvnMaterial = new CRSvnMaterial("name", "folder", true, false, filter, "url", "username", "secret", true);
SvnMaterialConfig svnMaterialConfig = (SvnMaterialConfig) configConverter.toMaterialConfig(crSvnMaterial, context);
assertThat(svnMaterialConfig.getName().toLower(), is("name"));
assertThat(svnMaterialConfig.getFolder(), is("folder"));
assertThat(svnMaterialConfig.getAutoUpdate(), is(true));
assertThat(svnMaterialConfig.getFilterAsString(), is("filter"));
assertThat(svnMaterialConfig.getUrl(), is("url"));
assertThat(svnMaterialConfig.getUserName(), is("username"));
assertThat(svnMaterialConfig.getPassword(), is("secret"));
assertThat(svnMaterialConfig.isCheckExternals(), is(true));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.
the class GoFileConfigDataSourceTest method shouldEncryptSvnPasswordWhenConfigIsChangedViaFileSystem.
@Test
public void shouldEncryptSvnPasswordWhenConfigIsChangedViaFileSystem() throws Exception {
String configContent = ConfigFileFixture.configWithPipeline(String.format("<pipeline name='pipeline1'>" + " <materials>" + " <svn url='svnurl' username='admin' password='%s'/>" + " </materials>" + " <stage name='mingle'>" + " <jobs>" + " <job name='do-something'>" + " </job>" + " </jobs>" + " </stage>" + "</pipeline>", "hello"), GoConstants.CONFIG_SCHEMA_VERSION);
FileUtils.writeStringToFile(dataSource.fileLocation(), configContent, UTF_8);
GoConfigHolder configHolder = dataSource.load();
PipelineConfig pipelineConfig = configHolder.config.pipelineConfigByName(new CaseInsensitiveString("pipeline1"));
SvnMaterialConfig svnMaterialConfig = (SvnMaterialConfig) pipelineConfig.materialConfigs().get(0);
assertThat(svnMaterialConfig.getEncryptedPassword(), is(not(nullValue())));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.
the class SvnMaterialTest method shouldCopyOverPasswordWhenConvertingToConfig.
@Test
public void shouldCopyOverPasswordWhenConvertingToConfig() throws Exception {
SvnMaterial material = new SvnMaterial("abc", "def", "ghi", false);
SvnMaterialConfig config = (SvnMaterialConfig) material.config();
assertThat(config.getEncryptedPassword(), is(not(Matchers.nullValue())));
assertThat(config.getPassword(), is("ghi"));
}
Aggregations