Search in sources :

Example 41 with FileConfigOrigin

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

Example 42 with FileConfigOrigin

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

Example 43 with FileConfigOrigin

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

Example 44 with FileConfigOrigin

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

Example 45 with FileConfigOrigin

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));
}
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