Search in sources :

Example 1 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 2 with ScmMaterialConfig

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;
}
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) ConcurrentMap(java.util.concurrent.ConcurrentMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ScmMaterialConfig(com.thoughtworks.go.config.materials.ScmMaterialConfig)

Example 3 with ScmMaterialConfig

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));
}
Also used : ConfigReposConfig(com.thoughtworks.go.config.remote.ConfigReposConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) PartialConfig(com.thoughtworks.go.config.remote.PartialConfig) File(java.io.File) ScmMaterialConfig(com.thoughtworks.go.config.materials.ScmMaterialConfig) Test(org.junit.Test)

Example 4 with ScmMaterialConfig

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

Example 5 with ScmMaterialConfig

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

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