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);
}
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]"));
}
}
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));
}
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));
}
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));
}
Aggregations