Search in sources :

Example 36 with FileConfigOrigin

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()));
}
Also used : FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) Test(org.junit.Test)

Example 37 with FileConfigOrigin

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));
}
Also used : FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) Test(org.junit.Test)

Example 38 with FileConfigOrigin

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));
}
Also used : FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) Test(org.junit.Test)

Example 39 with FileConfigOrigin

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);
}
Also used : FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin)

Example 40 with FileConfigOrigin

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));
}
Also used : FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) Test(org.junit.Test)

Aggregations

FileConfigOrigin (com.thoughtworks.go.config.remote.FileConfigOrigin)59 Test (org.junit.Test)51 RepoConfigOrigin (com.thoughtworks.go.config.remote.RepoConfigOrigin)23 PipelineModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineModel)5 MergeEnvironmentConfig (com.thoughtworks.go.config.merge.MergeEnvironmentConfig)4 ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)4 Permissions (com.thoughtworks.go.config.security.Permissions)4 AllowedUsers (com.thoughtworks.go.config.security.users.AllowedUsers)4 BasicPipelineConfigs (com.thoughtworks.go.config.BasicPipelineConfigs)3 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)3 PipelineConfigs (com.thoughtworks.go.config.PipelineConfigs)3 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)3 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)3 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)3 MergePipelineConfigs (com.thoughtworks.go.config.merge.MergePipelineConfigs)2 BasicEnvironmentConfig (com.thoughtworks.go.config.BasicEnvironmentConfig)1 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)1 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)1 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)1 MergeConfigOrigin (com.thoughtworks.go.config.merge.MergeConfigOrigin)1