use of com.thoughtworks.go.config.materials.ScmMaterialConfig in project gocd by gocd.
the class GoRepoConfigDataSourceTest method shouldNotCallPluginLoadOnCheckout_WhenMaterialNotInWatchList.
@Test
public void shouldNotCallPluginLoadOnCheckout_WhenMaterialNotInWatchList() throws Exception {
ScmMaterialConfig material = new GitMaterialConfig("http://my.git");
repoConfigDataSource.onCheckoutComplete(material, folder, "7a8f");
verify(plugin, times(0)).load(eq(folder), any(PartialConfigLoadContext.class));
}
use of com.thoughtworks.go.config.materials.ScmMaterialConfig in project gocd by gocd.
the class GoRepoConfigDataSourceTest method shouldSetErrorHealthState_AtConfigRepoScope_WhenPluginHasThrown.
@Test
public void shouldSetErrorHealthState_AtConfigRepoScope_WhenPluginHasThrown() {
// use broken plugin now
when(configPluginService.partialConfigProviderFor(any(ConfigRepoConfig.class))).thenReturn(new BrokenConfigPlugin());
ScmMaterialConfig material = new GitMaterialConfig("http://my.git");
ConfigRepoConfig configRepoConfig = new ConfigRepoConfig(material, "myplugin");
cruiseConfig.setConfigRepos(new ConfigReposConfig(configRepoConfig));
configWatchList.onConfigChange(cruiseConfig);
repoConfigDataSource.onCheckoutComplete(material, folder, "7a8f");
assertTrue(repoConfigDataSource.latestParseHasFailedForMaterial(material));
assertFalse(serverHealthService.filterByScope(HealthStateScope.forPartialConfigRepo(configRepoConfig)).isEmpty());
}
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 ConfigRepoConfig method validateAutoUpdateState.
private void validateAutoUpdateState(ValidationContext validationContext) {
if (validationContext == null)
return;
MaterialConfig material = this.getMaterialConfig();
MaterialConfigs allMaterialsByFingerPrint = validationContext.getAllMaterialsByFingerPrint(material.getFingerprint());
if (allMaterialsByFingerPrint != null) {
for (MaterialConfig other : allMaterialsByFingerPrint) {
if (!other.isAutoUpdate())
((ScmMaterialConfig) other).setAutoUpdateMismatchErrorWithConfigRepo();
}
}
}
use of com.thoughtworks.go.config.materials.ScmMaterialConfig in project gocd by gocd.
the class BasicCruiseConfig method getAllUniquePostCommitSchedulableMaterials.
@Override
public Set<MaterialConfig> getAllUniquePostCommitSchedulableMaterials() {
Set<MaterialConfig> materialConfigs = new HashSet<>();
Set<String> uniqueMaterials = new HashSet<>();
for (PipelineConfigs pipelineConfigs : this.groups) {
for (PipelineConfig pipelineConfig : pipelineConfigs) {
for (MaterialConfig materialConfig : pipelineConfig.materialConfigs()) {
if ((materialConfig instanceof ScmMaterialConfig || materialConfig instanceof PluggableSCMMaterialConfig) && !materialConfig.isAutoUpdate() && !uniqueMaterials.contains(materialConfig.getFingerprint())) {
materialConfigs.add(materialConfig);
uniqueMaterials.add(materialConfig.getFingerprint());
}
}
}
}
for (ConfigRepoConfig configRepo : this.configRepos) {
MaterialConfig materialConfig = configRepo.getMaterialConfig();
if (!uniqueMaterials.contains(materialConfig.getFingerprint())) {
materialConfigs.add(materialConfig);
uniqueMaterials.add(materialConfig.getFingerprint());
}
}
return materialConfigs;
}
Aggregations