use of com.thoughtworks.go.config.remote.ConfigRepoConfig in project gocd by gocd.
the class BuildCauseTest method shouldNotThrowWhenMaterialAndConfigOriginRevisionDontMatch_WhenManualTrigger.
@Test
public void shouldNotThrowWhenMaterialAndConfigOriginRevisionDontMatch_WhenManualTrigger() {
SvnMaterial material = MaterialsMother.svnMaterial();
MaterialConfig materialConfig = material.config();
MaterialRevisions first = new MaterialRevisions(new MaterialRevision(material, oneModifiedFile("revision1")));
BuildCause buildCause = BuildCause.createManualForced();
buildCause.setMaterialRevisions(first);
PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfigWithStages("pipe1", "build");
pipelineConfig.materialConfigs().clear();
pipelineConfig.materialConfigs().add(materialConfig);
pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(materialConfig, "plug"), "revision2"));
buildCause.assertPipelineConfigAndMaterialRevisionMatch(pipelineConfig);
}
use of com.thoughtworks.go.config.remote.ConfigRepoConfig in project gocd by gocd.
the class PipelineConfigTest method shouldReturnConfigRepoOriginDisplayNameWhenOriginIsRemote.
@Test
public void shouldReturnConfigRepoOriginDisplayNameWhenOriginIsRemote() {
PipelineConfig pipelineConfig = new PipelineConfig();
pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(MaterialConfigsMother.gitMaterialConfig(), "plugin"), "revision1"));
assertThat(pipelineConfig.getOriginDisplayName(), is("AwesomeGitMaterial at revision1"));
}
use of com.thoughtworks.go.config.remote.ConfigRepoConfig in project gocd by gocd.
the class PipelineConfigTest method shouldReturnFalseWhenOneOfPipelineMaterialsIsNotTheSameAsConfigOrigin.
@Test
public void shouldReturnFalseWhenOneOfPipelineMaterialsIsNotTheSameAsConfigOrigin() {
PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfig("pipeline", "stage", "build");
MaterialConfig material = new GitMaterialConfig("http://git");
pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(material, "plugin"), "1233"));
assertThat(pipelineConfig.isConfigOriginSameAsOneOfMaterials(), is(false));
}
use of com.thoughtworks.go.config.remote.ConfigRepoConfig in project gocd by gocd.
the class MaterialConfigsTest method shouldAllowToDependOnPipelineDefinedInConfigRepository_WhenInConfigRepository.
@Test
public void shouldAllowToDependOnPipelineDefinedInConfigRepository_WhenInConfigRepository() throws Exception {
CruiseConfig cruiseConfig = new BasicCruiseConfig();
PipelineConfig pipeline1 = goConfigMother.addPipeline(cruiseConfig, "pipeline1", "stage", "build");
PipelineConfig pipeline2 = goConfigMother.addPipeline(cruiseConfig, "pipeline2", "stage", "build");
goConfigMother.setDependencyOn(cruiseConfig, pipeline2, "pipeline1", "stage");
pipeline1.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(new SvnMaterialConfig("http://mysvn", false), "myplugin"), "123"));
pipeline2.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(new SvnMaterialConfig("http://othersvn", false), "myplugin"), "2222"));
pipeline1.materialConfigs().validate(ConfigSaveValidationContext.forChain(cruiseConfig, new BasicPipelineConfigs(), pipeline1));
assertThat(pipeline1.materialConfigs().errors().isEmpty(), is(true));
pipeline2.materialConfigs().validate(ConfigSaveValidationContext.forChain(cruiseConfig, new BasicPipelineConfigs(), pipeline2));
DependencyMaterialConfig dep = pipeline2.materialConfigs().findDependencyMaterial(new CaseInsensitiveString("pipeline1"));
assertThat(dep.errors().isEmpty(), is(true));
}
use of com.thoughtworks.go.config.remote.ConfigRepoConfig in project gocd by gocd.
the class PipelineConfigServiceTest method setUp.
@Before
public void setUp() throws Exception {
PipelineConfigs configs = createGroup("group", "pipeline", "in_env");
downstream(configs);
cruiseConfig = new BasicCruiseConfig(configs);
cruiseConfig.addEnvironment(environment("foo", "in_env"));
PipelineConfig remotePipeline = PipelineConfigMother.pipelineConfig("remote");
remotePipeline.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(new GitMaterialConfig("url"), "plugin"), "1234"));
cruiseConfig.addPipeline("group", remotePipeline);
goConfigService = mock(GoConfigService.class);
securityService = mock(SecurityService.class);
pluggableTaskService = mock(PluggableTaskService.class);
when(goConfigService.getCurrentConfig()).thenReturn(cruiseConfig);
when(goConfigService.cruiseConfig()).thenReturn(cruiseConfig);
when(goConfigService.getConfigForEditing()).thenReturn(cruiseConfig);
when(goConfigService.getMergedConfigForEditing()).thenReturn(cruiseConfig);
when(goConfigService.getAllPipelineConfigs()).thenReturn(cruiseConfig.getAllPipelineConfigs());
pipelineConfigService = new PipelineConfigService(goConfigService, securityService, pluggableTaskService, null);
}
Aggregations