Search in sources :

Example 56 with SvnMaterialConfig

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;
}
Also used : HgUrlArgument(com.thoughtworks.go.util.command.HgUrlArgument) UrlArgument(com.thoughtworks.go.util.command.UrlArgument) GoCipher(com.thoughtworks.go.security.GoCipher) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Example 57 with SvnMaterialConfig

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));
}
Also used : SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) Test(org.junit.Test)

Example 58 with SvnMaterialConfig

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));
}
Also used : SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) Test(org.junit.Test)

Example 59 with SvnMaterialConfig

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())));
}
Also used : StringContains.containsString(org.hamcrest.core.StringContains.containsString) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) Test(org.junit.Test)

Example 60 with SvnMaterialConfig

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"));
}
Also used : SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) Test(org.junit.Test)

Aggregations

SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)72 Test (org.junit.Test)54 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)22 P4MaterialConfig (com.thoughtworks.go.config.materials.perforce.P4MaterialConfig)12 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)11 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)11 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)8 GoCipher (com.thoughtworks.go.security.GoCipher)8 PluggableSCMMaterialConfig (com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig)7 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)6 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)6 TfsMaterialConfig (com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig)6 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)6 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)4 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)4 SvnCommand (com.thoughtworks.go.domain.materials.svn.SvnCommand)4 SvnTestRepo (com.thoughtworks.go.helper.SvnTestRepo)3 ScmMaterialConfig (com.thoughtworks.go.config.materials.ScmMaterialConfig)2 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)2 ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)2