use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MergeEnvironmentConfigTest method shouldReturnCorrectOriginOfDefinedPipeline.
@Test
public void shouldReturnCorrectOriginOfDefinedPipeline() throws Exception {
BasicEnvironmentConfig uatLocalPart = new BasicEnvironmentConfig(new CaseInsensitiveString("UAT"));
uatLocalPart.setOrigins(new FileConfigOrigin());
String localPipeline = "local-pipeline";
uatLocalPart.addPipeline(new CaseInsensitiveString(localPipeline));
BasicEnvironmentConfig uatRemotePart = new BasicEnvironmentConfig(new CaseInsensitiveString("UAT"));
uatRemotePart.setOrigins(new RepoConfigOrigin());
String remotePipeline = "remote-pipeline";
uatRemotePart.addPipeline(new CaseInsensitiveString(remotePipeline));
MergeEnvironmentConfig environmentConfig = new MergeEnvironmentConfig(uatLocalPart, uatRemotePart);
assertThat(environmentConfig.getOriginForPipeline(new CaseInsensitiveString(localPipeline)), is(new FileConfigOrigin()));
assertThat(environmentConfig.getOriginForPipeline(new CaseInsensitiveString(remotePipeline)), is(new RepoConfigOrigin()));
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MergeEnvironmentConfigTest method shouldReturnTrueWhenOnlyPartIsLocal.
@Test
public void shouldReturnTrueWhenOnlyPartIsLocal() {
BasicEnvironmentConfig uatLocalPart = new BasicEnvironmentConfig(new CaseInsensitiveString("UAT"));
uatLocalPart.setOrigins(new FileConfigOrigin());
environmentConfig = new MergeEnvironmentConfig(uatLocalPart);
assertThat(environmentConfig.isLocal(), is(true));
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MergePipelineConfigsTest method shouldReturnTrueIfAuthorizationIsNotDefined_When2ConfigParts.
@Test
public void shouldReturnTrueIfAuthorizationIsNotDefined_When2ConfigParts() {
BasicPipelineConfigs filePart = new BasicPipelineConfigs();
filePart.setOrigin(new FileConfigOrigin());
MergePipelineConfigs merge = new MergePipelineConfigs(new BasicPipelineConfigs(), filePart);
assertThat(merge.hasViewPermission(new CaseInsensitiveString("anyone"), null), is(true));
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MergePipelineConfigsTest method createWithPipeline.
@Override
protected PipelineConfigs createWithPipeline(PipelineConfig pipelineConfig) {
BasicPipelineConfigs pipelineConfigsLocal = new BasicPipelineConfigs(pipelineConfig);
pipelineConfigsLocal.setOrigin(new FileConfigOrigin());
BasicPipelineConfigs pipelineConfigsRemote = new BasicPipelineConfigs();
pipelineConfigsRemote.setOrigin(new RepoConfigOrigin());
return new MergePipelineConfigs(pipelineConfigsRemote, pipelineConfigsLocal);
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MergePipelineConfigsTest method shouldReturnTrueForOperatePermissionIfAuthorizationIsNotDefined_When2ConfigParts.
@Test
public void shouldReturnTrueForOperatePermissionIfAuthorizationIsNotDefined_When2ConfigParts() {
BasicPipelineConfigs filePart = new BasicPipelineConfigs();
filePart.setOrigin(new FileConfigOrigin());
assertThat(new MergePipelineConfigs(filePart, new BasicPipelineConfigs()).hasOperatePermission(new CaseInsensitiveString("anyone"), null), is(true));
}
Aggregations