use of com.thoughtworks.go.config.remote.FileConfigOrigin 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.FileConfigOrigin in project gocd by gocd.
the class MergePipelineConfigsTest method shouldReturnAuthorizationFromFileIfDefined_When2ConfigParts.
@Test
public void shouldReturnAuthorizationFromFileIfDefined_When2ConfigParts() {
BasicPipelineConfigs part1 = new BasicPipelineConfigs();
Authorization fileAuth = new Authorization();
part1.setAuthorization(fileAuth);
part1.setOrigin(new FileConfigOrigin());
BasicPipelineConfigs part2 = new BasicPipelineConfigs();
part2.setAuthorization(new Authorization());
MergePipelineConfigs merge = new MergePipelineConfigs(part1, part2);
assertThat(merge.getAuthorization(), is(fileAuth));
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MergePipelineConfigsTest method shouldApplyChangesToPipelineWhenPartEditable.
@Test
public void shouldApplyChangesToPipelineWhenPartEditable() {
BasicPipelineConfigs filePart = new BasicPipelineConfigs(PipelineConfigMother.pipelineConfig("pipeline1"));
filePart.setOrigin(new FileConfigOrigin());
PipelineConfigs group = new MergePipelineConfigs(filePart);
PipelineConfig pipelineConfig = (PipelineConfig) group.get(0).clone();
pipelineConfig.setLabelTemplate("blah");
group.update(group.getGroup(), pipelineConfig, "pipeline1");
assertThat(group.get(0).getLabelTemplate(), is("blah"));
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MergePipelineConfigsTest method shouldAddPipelineToFirstEditablePartWhenExists.
@Test
public void shouldAddPipelineToFirstEditablePartWhenExists() {
PipelineConfig pipe1 = PipelineConfigMother.pipelineConfig("pipeline1");
BasicPipelineConfigs part1 = new BasicPipelineConfigs(pipe1);
part1.setOrigin(new FileConfigOrigin());
MergePipelineConfigs group = new MergePipelineConfigs(part1, new BasicPipelineConfigs());
PipelineConfig pipeline2 = PipelineConfigMother.pipelineConfig("pipeline2");
group.add(pipeline2);
assertThat(group.contains(pipeline2), is(true));
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MaterialConfigsTest method shouldAllowToDependOnPipelineDefinedInFile_WhenInFile.
@Test
public void shouldAllowToDependOnPipelineDefinedInFile_WhenInFile() 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 FileConfigOrigin());
pipeline2.setOrigin(new FileConfigOrigin());
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