use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class MergePipelineConfigsTest method createWithPipelines.
@Override
protected PipelineConfigs createWithPipelines(PipelineConfig first, PipelineConfig second) {
BasicPipelineConfigs pipelineConfigsLocal = new BasicPipelineConfigs(first, second);
pipelineConfigsLocal.setOrigin(new FileConfigOrigin());
BasicPipelineConfigs pipelineConfigsRemote = new BasicPipelineConfigs();
pipelineConfigsRemote.setOrigin(new RepoConfigOrigin());
return new MergePipelineConfigs(pipelineConfigsLocal, pipelineConfigsRemote);
}
use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class MergePipelineConfigsTest method shouldReturnNullForGetLocalWhenOnlyRemoteParts.
@Test
public void shouldReturnNullForGetLocalWhenOnlyRemoteParts() {
BasicPipelineConfigs firstPart = new BasicPipelineConfigs();
firstPart.setOrigin(new RepoConfigOrigin());
BasicPipelineConfigs secondPart = new BasicPipelineConfigs();
secondPart.setOrigin(new RepoConfigOrigin());
MergePipelineConfigs merge = new MergePipelineConfigs(firstPart, secondPart);
assertNull(merge.getLocal());
}
use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class MergePipelineConfigsTest method shouldReturnFilePartForGetLocalWhenHasRemoteAndFilePart.
@Test
public void shouldReturnFilePartForGetLocalWhenHasRemoteAndFilePart() {
BasicPipelineConfigs filePart = new BasicPipelineConfigs();
filePart.setOrigin(new FileConfigOrigin());
BasicPipelineConfigs secondPart = new BasicPipelineConfigs();
secondPart.setOrigin(new RepoConfigOrigin());
MergePipelineConfigs merge = new MergePipelineConfigs(filePart, secondPart);
assertThat(merge.getLocal(), Matchers.<PipelineConfigs>is(filePart));
}
use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class ConfigRepoPartialPreprocessorTest method shouldMergePartialsSetOnConfig.
@Test
public void shouldMergePartialsSetOnConfig() {
final PartialConfig partialConfig = PartialConfigMother.withPipeline("partial");
partialConfig.setOrigin(new RepoConfigOrigin(configRepoConfig, "sha-1"));
ConfigRepoPartialPreprocessor preprocessor = new ConfigRepoPartialPreprocessor();
PipelineConfig pipelineInMain = PipelineConfigMother.createPipelineConfig("main_pipeline", "stage", "job");
BasicCruiseConfig cruiseConfig = new BasicCruiseConfig(new BasicPipelineConfigs(pipelineInMain));
cruiseConfig.setConfigRepos(reposConfig);
cruiseConfig.setPartials(asList(partialConfig));
preprocessor.process(cruiseConfig);
assertThat(cruiseConfig.getAllPipelineNames().contains(pipelineInMain.name()), is(true));
assertThat(cruiseConfig.getAllPipelineNames().contains(partialConfig.getGroups().first().get(0).name()), is(true));
}
use of com.thoughtworks.go.config.remote.RepoConfigOrigin 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));
}
Aggregations