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()));
}
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;
}
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));
}
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));
}
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));
}
Aggregations