use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MergePipelineConfigsTest method shouldReturnPartWithPipelineWhenExists.
@Test
public void shouldReturnPartWithPipelineWhenExists() {
PipelineConfig pipe1 = PipelineConfigMother.pipelineConfig("pipeline1");
BasicPipelineConfigs part1 = new BasicPipelineConfigs(pipe1);
part1.setOrigin(new FileConfigOrigin());
MergePipelineConfigs group = new MergePipelineConfigs(part1, new BasicPipelineConfigs(PipelineConfigMother.pipelineConfig("pipeline2")));
assertThat(group.getPartWithPipeline(new CaseInsensitiveString("pipeline1")), Matchers.<PipelineConfigs>is(part1));
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MergePipelineConfigsTest method shouldAddPipelineAtIndex_WhenWouldLandInEditablePart.
@Test
public void shouldAddPipelineAtIndex_WhenWouldLandInEditablePart() {
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");
group.add(3, p1);
assertThat(group, hasItem(p1));
assertThat(pipelineConfigsMiddle, hasItem(p1));
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MergePipelineConfigsTest method shouldSetAuthorizationInFile.
@Test
public void shouldSetAuthorizationInFile() {
BasicPipelineConfigs filePart = new BasicPipelineConfigs();
filePart.setOrigin(new FileConfigOrigin());
MergePipelineConfigs merge = new MergePipelineConfigs(filePart, new BasicPipelineConfigs());
Authorization auth = new Authorization(new AdminsConfig(new AdminUser(new CaseInsensitiveString("buddy"))));
merge.setAuthorization(auth);
assertThat(filePart.getAuthorization(), is(auth));
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MergePipelineConfigsTest method shouldReturnOriginAsASumOfAllOrigins.
@Test
public void shouldReturnOriginAsASumOfAllOrigins() {
BasicPipelineConfigs fileConfigs = new BasicPipelineConfigs(PipelineConfigMother.pipelineConfig("pipeline1"));
fileConfigs.setOrigin(new FileConfigOrigin());
BasicPipelineConfigs remoteConfigs = new BasicPipelineConfigs(PipelineConfigMother.pipelineConfig("pipeline2"));
remoteConfigs.setOrigin(new RepoConfigOrigin());
PipelineConfigs group = new MergePipelineConfigs(fileConfigs, remoteConfigs);
ConfigOrigin allOrigins = group.getOrigin();
assertThat(allOrigins instanceof MergeConfigOrigin, is(true));
MergeConfigOrigin mergeConfigOrigin = (MergeConfigOrigin) allOrigins;
assertThat(mergeConfigOrigin.size(), is(2));
assertThat(mergeConfigOrigin.contains(new FileConfigOrigin()), is(true));
assertThat(mergeConfigOrigin.contains(new RepoConfigOrigin()), is(true));
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MergePipelineConfigsTest method shouldReturnFalseIfViewPermissionIsNotDefined_When2ConfigParts.
@Test
public void shouldReturnFalseIfViewPermissionIsNotDefined_When2ConfigParts() {
BasicPipelineConfigs filePart = new BasicPipelineConfigs(PipelineConfigMother.pipelineConfig("pipeline3"));
filePart.setOrigin(new FileConfigOrigin());
PipelineConfigs group = new MergePipelineConfigs(new BasicPipelineConfigs(PipelineConfigMother.pipelineConfig("pipeline1")), new BasicPipelineConfigs(PipelineConfigMother.pipelineConfig("pipeline2")), filePart);
group.getAuthorization().getOperationConfig().add(new AdminUser(new CaseInsensitiveString("jez")));
assertThat(group.hasViewPermission(new CaseInsensitiveString("jez"), null), is(false));
}
Aggregations