Search in sources :

Example 11 with ScmMaterialConfig

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

Example 12 with ScmMaterialConfig

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

Example 13 with ScmMaterialConfig

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

Example 14 with ScmMaterialConfig

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();
        }
    }
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) ScmMaterialConfig(com.thoughtworks.go.config.materials.ScmMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig)

Example 15 with ScmMaterialConfig

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;
}
Also used : PluggableSCMMaterialConfig(com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) ScmMaterialConfig(com.thoughtworks.go.config.materials.ScmMaterialConfig) MergePipelineConfigs(com.thoughtworks.go.config.merge.MergePipelineConfigs) ScmMaterialConfig(com.thoughtworks.go.config.materials.ScmMaterialConfig) PluggableSCMMaterialConfig(com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig)

Aggregations

ScmMaterialConfig (com.thoughtworks.go.config.materials.ScmMaterialConfig)25 Test (org.junit.Test)20 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)16 File (java.io.File)7 PartialConfig (com.thoughtworks.go.config.remote.PartialConfig)5 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)4 PluggableSCMMaterialConfig (com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig)3 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)3 ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)3 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)2 ConfigReposConfig (com.thoughtworks.go.config.remote.ConfigReposConfig)2 BasicCruiseConfig (com.thoughtworks.go.config.BasicCruiseConfig)1 BasicPipelineConfigs (com.thoughtworks.go.config.BasicPipelineConfigs)1 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)1 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)1 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)1 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)1 MergePipelineConfigs (com.thoughtworks.go.config.merge.MergePipelineConfigs)1 ArrayList (java.util.ArrayList)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1