use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MergePipelineConfigsTest method shouldFailToAddPipelineAtIndex_WhenWouldLandInNonEditablePart.
@Test
public void shouldFailToAddPipelineAtIndex_WhenWouldLandInNonEditablePart() {
PipelineConfig pipeline0 = PipelineConfigMother.pipelineConfig("pipeline0");
PipelineConfig pipeline1 = PipelineConfigMother.pipelineConfig("pipeline1");
PipelineConfig pipeline3 = PipelineConfigMother.pipelineConfig("pipeline3");
PipelineConfig pipeline5 = PipelineConfigMother.pipelineConfig("pipeline5");
PipelineConfig pipeline2 = PipelineConfigMother.pipelineConfig("pipeline2");
PipelineConfig pipeline4 = PipelineConfigMother.pipelineConfig("pipeline4");
BasicPipelineConfigs pipelineConfigsMiddle = new BasicPipelineConfigs(pipeline3);
pipelineConfigsMiddle.setOrigin(new FileConfigOrigin());
BasicPipelineConfigs bottom = new BasicPipelineConfigs(pipeline0, pipeline1, pipeline2);
BasicPipelineConfigs top = new BasicPipelineConfigs(pipeline4, pipeline5);
bottom.setOrigin(new RepoConfigOrigin());
top.setOrigin(new RepoConfigOrigin());
PipelineConfigs group = new MergePipelineConfigs(bottom, pipelineConfigsMiddle, top);
PipelineConfig p1 = PipelineConfigMother.pipelineConfig("pipelineToInsert");
tryAddAndAssertThatFailed(group, p1, 0);
tryAddAndAssertThatFailed(group, p1, 1);
tryAddAndAssertThatFailed(group, p1, 2);
tryAddAndAssertThatFailed(group, p1, 5);
tryAddAndAssertThatFailed(group, p1, 4);
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin 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.FileConfigOrigin in project gocd by gocd.
the class MergePipelineConfigsTest method createEmpty.
@Override
protected PipelineConfigs createEmpty() {
BasicPipelineConfigs pipelineConfigs = new BasicPipelineConfigs();
pipelineConfigs.setOrigin(new FileConfigOrigin());
return new MergePipelineConfigs(pipelineConfigs);
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MergePipelineConfigsTest method shouldAddToFirstEditableWhenAddToTop.
@Test
public void shouldAddToFirstEditableWhenAddToTop() {
BasicPipelineConfigs filePart = new BasicPipelineConfigs(PipelineConfigMother.pipelineConfig("pipeline2"));
filePart.setOrigin(new FileConfigOrigin());
PipelineConfigs group = new MergePipelineConfigs(new BasicPipelineConfigs(PipelineConfigMother.pipelineConfig("pipeline1")), filePart);
group.addToTop(PipelineConfigMother.pipelineConfig("pipeline3"));
assertThat(filePart.hasPipeline(new CaseInsensitiveString("pipeline3")), is(true));
assertThat(group.hasPipeline(new CaseInsensitiveString("pipeline3")), is(true));
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MergePipelineConfigsTest method shouldReturnFirstEditablePartWhenExists.
@Test
public void shouldReturnFirstEditablePartWhenExists() {
PipelineConfig pipe1 = PipelineConfigMother.pipelineConfig("pipeline1");
BasicPipelineConfigs part1 = new BasicPipelineConfigs(pipe1);
part1.setOrigin(new FileConfigOrigin());
MergePipelineConfigs group = new MergePipelineConfigs(part1, new BasicPipelineConfigs());
assertThat(group.getFirstEditablePartOrNull(), Matchers.<PipelineConfigs>is(part1));
}
Aggregations