Search in sources :

Example 51 with GitMaterialConfig

use of com.thoughtworks.go.config.materials.git.GitMaterialConfig in project gocd by gocd.

the class CruiseConfigTestBase method canFindMaterialConfigForUnderGivenPipelineWithMaterialFingerprint.

@Test
public void canFindMaterialConfigForUnderGivenPipelineWithMaterialFingerprint() {
    MaterialConfig fullClone = git("url", "master", false);
    PipelineConfig one = PipelineConfigMother.pipelineConfig("one", fullClone, new JobConfigs(new JobConfig("job")));
    cruiseConfig.addPipeline("group-1", one);
    MaterialConfig shallowClone = git("url", "master", true);
    PipelineConfig two = PipelineConfigMother.pipelineConfig("two", shallowClone, new JobConfigs(new JobConfig("job")));
    cruiseConfig.addPipeline("group-2", two);
    MaterialConfig others = git("bar", "master", true);
    PipelineConfig three = PipelineConfigMother.pipelineConfig("three", others, new JobConfigs(new JobConfig("job")));
    cruiseConfig.addPipeline("group-3", three);
    String fingerprint = git("url", "master").getFingerprint();
    assertThat(((GitMaterialConfig) cruiseConfig.materialConfigFor(one.name(), fingerprint)).isShallowClone(), is(false));
    assertThat(((GitMaterialConfig) cruiseConfig.materialConfigFor(two.name(), fingerprint)).isShallowClone(), is(true));
    assertThat(cruiseConfig.materialConfigFor(three.name(), fingerprint), is(nullValue()));
}
Also used : PluggableSCMMaterialConfig(com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) P4MaterialConfig(com.thoughtworks.go.config.materials.perforce.P4MaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) PackageMaterialConfig(com.thoughtworks.go.config.materials.PackageMaterialConfig) ScmMaterialConfig(com.thoughtworks.go.config.materials.ScmMaterialConfig) Test(org.junit.jupiter.api.Test)

Example 52 with GitMaterialConfig

use of com.thoughtworks.go.config.materials.git.GitMaterialConfig in project gocd by gocd.

the class PipelineConfigTest method createAndValidatePipelineLabel.

private PipelineConfig createAndValidatePipelineLabel(String labelFormat) {
    GitMaterialConfig git = git("git@github.com:gocd/gocd.git");
    git.setName(new CaseInsensitiveString("git"));
    PipelineConfig pipelineConfig = new PipelineConfig(new CaseInsensitiveString("cruise"), new MaterialConfigs(git));
    pipelineConfig.setLabelTemplate(labelFormat);
    pipelineConfig.validate(null);
    return pipelineConfig;
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig)

Example 53 with GitMaterialConfig

use of com.thoughtworks.go.config.materials.git.GitMaterialConfig in project gocd by gocd.

the class PipelineConfigTest method shouldReturnTrueWhenOneOfPipelineMaterialsIsTheSameAsConfigOriginButDestinationIsDifferent.

@Test
public void shouldReturnTrueWhenOneOfPipelineMaterialsIsTheSameAsConfigOriginButDestinationIsDifferent() {
    PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfig("pipeline", "stage", "build");
    pipelineConfig.materialConfigs().clear();
    GitMaterialConfig pipeMaterialConfig = git("http://git");
    pipeMaterialConfig.setFolder("dest1");
    pipelineConfig.materialConfigs().add(pipeMaterialConfig);
    GitMaterialConfig repoMaterialConfig = git("http://git");
    pipelineConfig.setOrigin(new RepoConfigOrigin(ConfigRepoConfig.createConfigRepoConfig(repoMaterialConfig, "plugin", "id"), "1233"));
    assertThat(pipelineConfig.isConfigOriginSameAsOneOfMaterials(), is(true));
}
Also used : GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) Test(org.junit.jupiter.api.Test)

Example 54 with GitMaterialConfig

use of com.thoughtworks.go.config.materials.git.GitMaterialConfig in project gocd by gocd.

the class MergeCruiseConfigTest method shouldGetUniqueMaterialsWithConfigRepos.

@Test
public void shouldGetUniqueMaterialsWithConfigRepos() {
    BasicCruiseConfig mainCruiseConfig = new BasicCruiseConfig(pipelines);
    ConfigReposConfig reposConfig = new ConfigReposConfig();
    GitMaterialConfig configRepo = git("http://git");
    reposConfig.add(ConfigRepoConfig.createConfigRepoConfig(configRepo, "myplug", "id"));
    mainCruiseConfig.setConfigRepos(reposConfig);
    PartialConfig partialConfig = PartialConfigMother.withPipeline("pipe2");
    MaterialConfig pipeRepo = partialConfig.getGroups().get(0).get(0).materialConfigs().get(0);
    cruiseConfig = new BasicCruiseConfig(mainCruiseConfig, partialConfig);
    Set<MaterialConfig> materials = cruiseConfig.getAllUniqueMaterialsBelongingToAutoPipelinesAndConfigRepos();
    assertThat(materials, hasItem(configRepo));
    assertThat(materials, hasItem(pipeRepo));
    assertThat(materials.size(), is(2));
}
Also used : GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) Test(org.junit.jupiter.api.Test)

Example 55 with GitMaterialConfig

use of com.thoughtworks.go.config.materials.git.GitMaterialConfig in project gocd by gocd.

the class MergeCruiseConfigTest method shouldGetUniqueMaterialsWithoutConfigRepos.

@Test
public void shouldGetUniqueMaterialsWithoutConfigRepos() {
    BasicCruiseConfig mainCruiseConfig = new BasicCruiseConfig(pipelines);
    ConfigReposConfig reposConfig = new ConfigReposConfig();
    GitMaterialConfig configRepo = git("http://git");
    reposConfig.add(ConfigRepoConfig.createConfigRepoConfig(configRepo, "myplug", "id"));
    mainCruiseConfig.setConfigRepos(reposConfig);
    PartialConfig partialConfig = PartialConfigMother.withPipeline("pipe2");
    MaterialConfig pipeRepo = partialConfig.getGroups().get(0).get(0).materialConfigs().get(0);
    cruiseConfig = new BasicCruiseConfig(mainCruiseConfig, partialConfig);
    Set<MaterialConfig> materials = cruiseConfig.getAllUniqueMaterialsBelongingToAutoPipelines();
    assertThat(materials, hasItem(pipeRepo));
    assertThat(materials.size(), is(1));
}
Also used : GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) Test(org.junit.jupiter.api.Test)

Aggregations

GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)138 Test (org.junit.jupiter.api.Test)73 Test (org.junit.Test)37 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)21 ScmMaterialConfig (com.thoughtworks.go.config.materials.ScmMaterialConfig)21 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)20 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)19 ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)17 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)16 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)14 P4MaterialConfig (com.thoughtworks.go.config.materials.perforce.P4MaterialConfig)14 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)13 GitMaterialInstance (com.thoughtworks.go.domain.materials.git.GitMaterialInstance)11 PluggableSCMMaterialConfig (com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig)10 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)10 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)9 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)8 Material (com.thoughtworks.go.domain.materials.Material)8 SCMs (com.thoughtworks.go.domain.scm.SCMs)8 TfsMaterialConfig (com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig)7