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 = new GitMaterialConfig("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 = new GitMaterialConfig("http://git");
pipeMaterialConfig.setFolder("dest1");
pipelineConfig.materialConfigs().add(pipeMaterialConfig);
GitMaterialConfig repoMaterialConfig = new GitMaterialConfig("http://git");
pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(repoMaterialConfig, "plugin"), "1233"));
assertThat(pipelineConfig.isConfigOriginSameAsOneOfMaterials(), is(true));
}
use of com.thoughtworks.go.config.materials.git.GitMaterialConfig in project gocd by gocd.
the class PipelineConfigValidationTest method shouldCheckForPipelineNameUniqueness.
@Test
public void shouldCheckForPipelineNameUniqueness() {
BasicCruiseConfig cruiseConfig = GoConfigMother.configWithPipelines("p1");
String group = "group";
cruiseConfig.getGroups().add(new BasicPipelineConfigs(group, new Authorization()));
PipelineConfig p1Duplicate = GoConfigMother.createPipelineConfigWithMaterialConfig("p1", new GitMaterialConfig("url"));
cruiseConfig.addPipeline(group, p1Duplicate);
PipelineConfigSaveValidationContext context = PipelineConfigSaveValidationContext.forChain(true, group, cruiseConfig, p1Duplicate);
p1Duplicate.validateTree(context);
assertThat(p1Duplicate.errors().on(PipelineConfig.NAME), is(String.format("You have defined multiple pipelines named '%s'. Pipeline names must be unique. Source(s): [cruise-config.xml]", p1Duplicate.name())));
}
use of com.thoughtworks.go.config.materials.git.GitMaterialConfig in project gocd by gocd.
the class PipelineConfigValidationTest method shouldFailValidateWhenUpstreamStageForDependencyMaterailDoesNotExist.
@Test
public void shouldFailValidateWhenUpstreamStageForDependencyMaterailDoesNotExist() {
String upstreamPipeline = "upstream";
String upstreamStage = "non-existant";
PipelineConfig upstream = GoConfigMother.createPipelineConfigWithMaterialConfig(upstreamPipeline, new GitMaterialConfig("url"));
PipelineConfig pipelineConfig = GoConfigMother.createPipelineConfigWithMaterialConfig("downstream", new DependencyMaterialConfig(new CaseInsensitiveString(upstreamPipeline), new CaseInsensitiveString(upstreamStage)));
BasicCruiseConfig cruiseConfig = new BasicCruiseConfig(new BasicPipelineConfigs(pipelineConfig, upstream));
boolean isValid = pipelineConfig.validateTree(PipelineConfigSaveValidationContext.forChain(true, cruiseConfig.getGroups().first().getGroup(), cruiseConfig, pipelineConfig));
assertThat(isValid, is(false));
ConfigErrors materialErrors = pipelineConfig.materialConfigs().first().errors();
assertThat(materialErrors.isEmpty(), is(false));
assertThat(materialErrors.firstError(), is("Stage with name 'non-existant' does not exist on pipeline 'upstream', it is being referred to from pipeline 'downstream' (cruise-config.xml)"));
}
use of com.thoughtworks.go.config.materials.git.GitMaterialConfig in project gocd by gocd.
the class ConfigSaveDeadlockDetectionIntegrationTest method configSaveThread.
private Thread configSaveThread(final int counter) throws InvalidCipherTextException, InterruptedException {
return createThread(new Runnable() {
@Override
public void run() {
goConfigService.updateConfig(new UpdateConfigCommand() {
@Override
public CruiseConfig update(CruiseConfig cruiseConfig) throws Exception {
PipelineConfig pipelineConfig = GoConfigMother.createPipelineConfigWithMaterialConfig(UUID.randomUUID().toString(), new GitMaterialConfig("FOO"));
cruiseConfig.addPipeline("default", pipelineConfig);
return cruiseConfig;
}
});
}
}, "config-save-thread" + counter);
}
Aggregations