use of com.thoughtworks.go.config.materials.ScmMaterialConfig in project gocd by gocd.
the class PipelineConfigValidationTest method isValid_shouldMatchMaterialNamesInACaseInsensitiveManner.
@Test
public void isValid_shouldMatchMaterialNamesInACaseInsensitiveManner() {
pipeline.setLabelTemplate("pipeline-${count}-${myGit}");
ScmMaterialConfig gitMaterialConfig = MaterialConfigsMother.gitMaterialConfig("git://url");
gitMaterialConfig.setName(new CaseInsensitiveString("mygit"));
pipeline.addMaterialConfig(gitMaterialConfig);
pipeline.validate(validationContext);
assertThat(pipeline.errors().isEmpty(), is(true));
List<String> errors = pipeline.errors().getAllOn("labelTemplate");
assertThat(errors, is(nullValue()));
}
use of com.thoughtworks.go.config.materials.ScmMaterialConfig in project gocd by gocd.
the class BasicCruiseConfig method getUniqueMaterialConfigs.
private Set<MaterialConfig> getUniqueMaterialConfigs(boolean ignoreManualPipelines) {
Set<MaterialConfig> materialConfigs = new HashSet<>();
Set<Map> uniqueMaterials = new HashSet<>();
for (PipelineConfig pipelineConfig : pipelinesFromAllGroups()) {
for (MaterialConfig materialConfig : pipelineConfig.materialConfigs()) {
if (!uniqueMaterials.contains(materialConfig.getSqlCriteria())) {
if (ignoreManualPipelines && !materialConfig.isAutoUpdate() && materialConfig instanceof ScmMaterialConfig) {
continue;
}
materialConfigs.add(materialConfig);
uniqueMaterials.add(materialConfig.getSqlCriteria());
}
}
}
return materialConfigs;
}
use of com.thoughtworks.go.config.materials.ScmMaterialConfig in project gocd by gocd.
the class GoPartialConfigTest method shouldRemovePartialWhenNoLongerInWatchList.
@Test
public void shouldRemovePartialWhenNoLongerInWatchList() throws Exception {
ScmMaterialConfig material = setOneConfigRepo();
PartialConfig part = new PartialConfig();
when(plugin.load(any(File.class), any(PartialConfigLoadContext.class))).thenReturn(part);
repoConfigDataSource.onCheckoutComplete(material, folder, "7a8f");
assertThat(partialConfig.lastPartials().size(), is(1));
assertThat(partialConfig.lastPartials().get(0), is(part));
// we change current configuration
ScmMaterialConfig othermaterial = new GitMaterialConfig("http://myother.git");
cruiseConfig.setConfigRepos(new ConfigReposConfig(new ConfigRepoConfig(othermaterial, "myplugin")));
configWatchList.onConfigChange(cruiseConfig);
assertThat(partialConfig.lastPartials().size(), is(0));
}
use of com.thoughtworks.go.config.materials.ScmMaterialConfig in project gocd by gocd.
the class GoPartialConfigTest method shouldNotifyListenersAfterUpdatingMapOfLatestValidConfig.
@Test
public void shouldNotifyListenersAfterUpdatingMapOfLatestValidConfig() {
ScmMaterialConfig material = setOneConfigRepo();
PartialConfig part = new PartialConfig();
when(plugin.load(any(File.class), any(PartialConfigLoadContext.class))).thenReturn(part);
PartialConfigUpdateCompletedListener listener = mock(PartialConfigUpdateCompletedListener.class);
repoConfigDataSource.registerListener(listener);
repoConfigDataSource.onCheckoutComplete(material, folder, "7a8f");
verify(listener, times(1)).onSuccessPartialConfig(any(ConfigRepoConfig.class), any(PartialConfig.class));
}
use of com.thoughtworks.go.config.materials.ScmMaterialConfig in project gocd by gocd.
the class GoPartialConfigTest method setOneConfigRepo.
private ScmMaterialConfig setOneConfigRepo() {
ScmMaterialConfig material = new GitMaterialConfig("http://my.git");
cruiseConfig.setConfigRepos(new ConfigReposConfig(new ConfigRepoConfig(material, "myplugin")));
configWatchList.onConfigChange(cruiseConfig);
return material;
}
Aggregations