Search in sources :

Example 46 with SvnMaterialConfig

use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.

the class PasswordDeserializerTest method shouldNotValidateEncryptedPasswordIfBlank.

@Test
public void shouldNotValidateEncryptedPasswordIfBlank() {
    SvnMaterialConfig svnMaterialConfig = new SvnMaterialConfig();
    PasswordDeserializer passwordDeserializer = new PasswordDeserializer();
    String encrypted = passwordDeserializer.deserialize(null, "", svnMaterialConfig);
    assertNull(encrypted);
}
Also used : SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) Test(org.junit.Test)

Example 47 with SvnMaterialConfig

use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.

the class GoConfigServiceTest method shouldThrowExceptionWhenUnableToFindMaterialBasedOnFingerprint.

@Test
public void shouldThrowExceptionWhenUnableToFindMaterialBasedOnFingerprint() throws Exception {
    SvnMaterialConfig svnMaterialConfig = new SvnMaterialConfig("repo", null, null, false);
    cruiseConfig = configWith(GoConfigMother.createPipelineConfigWithMaterialConfig(svnMaterialConfig));
    when(goConfigDao.load()).thenReturn(cruiseConfig);
    try {
        goConfigService.materialForPipelineWithFingerprint("pipeline", "bad-fingerprint");
        fail("Shouldn't be able to find material with incorrect fingerprint");
    } catch (Exception expected) {
        assertThat(expected.getMessage(), is("Pipeline [pipeline] does not have a material with fingerprint [bad-fingerprint]"));
    }
}
Also used : SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) ConfigFileHasChangedException(com.thoughtworks.go.config.exceptions.ConfigFileHasChangedException) GoConfigInvalidException(com.thoughtworks.go.config.exceptions.GoConfigInvalidException) JDOMParseException(org.jdom2.input.JDOMParseException) PipelineGroupNotFoundException(com.thoughtworks.go.config.exceptions.PipelineGroupNotFoundException) Test(org.junit.Test)

Example 48 with SvnMaterialConfig

use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.

the class GoConfigServiceTest method shouldFindMaterialByPipelineUniqueFingerprint.

@Test
public void shouldFindMaterialByPipelineUniqueFingerprint() throws Exception {
    SvnMaterialConfig svnMaterialConfig = new SvnMaterialConfig("repo", null, null, false);
    svnMaterialConfig.setName(new CaseInsensitiveString("foo"));
    cruiseConfig = configWith(GoConfigMother.createPipelineConfigWithMaterialConfig(svnMaterialConfig));
    when(goConfigDao.load()).thenReturn(cruiseConfig);
    assertThat(goConfigService.findMaterial(new CaseInsensitiveString("pipeline"), svnMaterialConfig.getPipelineUniqueFingerprint()), is(svnMaterialConfig));
    assertThat(goConfigService.findMaterial(new CaseInsensitiveString("piPelIne"), svnMaterialConfig.getPipelineUniqueFingerprint()), is(svnMaterialConfig));
}
Also used : SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) Test(org.junit.Test)

Example 49 with SvnMaterialConfig

use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.

the class GoConfigServiceTest method shouldBeAbleToListAllDependencyMaterialConfigs.

@Test
public void shouldBeAbleToListAllDependencyMaterialConfigs() {
    BasicCruiseConfig config = mock(BasicCruiseConfig.class);
    DependencyMaterialConfig dependencyMaterialConfig = MaterialConfigsMother.dependencyMaterialConfig();
    SvnMaterialConfig svnMaterialConfig = MaterialConfigsMother.svnMaterialConfig();
    PluggableSCMMaterialConfig pluggableSCMMaterialConfig = MaterialConfigsMother.pluggableSCMMaterialConfig();
    HashSet<MaterialConfig> materialConfigs = new HashSet<>(Arrays.asList(dependencyMaterialConfig, svnMaterialConfig, pluggableSCMMaterialConfig));
    when(goConfigService.getCurrentConfig()).thenReturn(config);
    when(config.getAllUniqueMaterialsBelongingToAutoPipelinesAndConfigRepos()).thenReturn(materialConfigs);
    Set<DependencyMaterialConfig> schedulableDependencyMaterials = goConfigService.getSchedulableDependencyMaterials();
    assertThat(schedulableDependencyMaterials.size(), is(1));
    assertTrue(schedulableDependencyMaterials.contains(dependencyMaterialConfig));
}
Also used : DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) PluggableSCMMaterialConfig(com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) PluggableSCMMaterialConfig(com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig) Test(org.junit.Test)

Example 50 with SvnMaterialConfig

use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.

the class MaterialExpansionServiceTest method shouldExpandSvnMaterialWithExternalsIntoMultipleSvnMaterialsWhenExpandingForScheduling.

@Test
public void shouldExpandSvnMaterialWithExternalsIntoMultipleSvnMaterialsWhenExpandingForScheduling() {
    SvnMaterialConfig svn = svnMaterialConfig(svnRepo.projectRepositoryUrl(), "mainRepo");
    SvnMaterialConfig svnExt = svnMaterialConfig(svnRepo.externalRepositoryUrl(), "mainRepo/end2end", null);
    PipelineConfig pipelineConfig = new PipelineConfig();
    pipelineConfig.addMaterialConfig(svn);
    String cacheKeyForSvn = MaterialExpansionService.class + "_cacheKeyForSvnMaterialCheckExternalCommand_" + svn.getFingerprint();
    String cacheKeyForSvnExt = MaterialExpansionService.class + "_cacheKeyForSvnMaterialCheckExternalCommand_" + svnExt.getFingerprint();
    when(goCache.get(cacheKeyForSvn)).thenReturn(null);
    when(goCache.get(cacheKeyForSvnExt)).thenReturn(null);
    MaterialConfigs materialConfigs = materialExpansionService.expandMaterialConfigsForScheduling(pipelineConfig.materialConfigs());
    assertThat(materialConfigs.size(), is(2));
    assertThat(materialConfigs.get(0), is(svn));
    assertThat(materialConfigs.get(1), is(svnExt));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) PipelineConfig(com.thoughtworks.go.config.PipelineConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)

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