Search in sources :

Example 46 with FileConfigOrigin

use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.

the class MergePipelineConfigsTest method shouldReturnFilePartForGetLocalWhenHasRemoteAndFilePart.

@Test
public void shouldReturnFilePartForGetLocalWhenHasRemoteAndFilePart() {
    BasicPipelineConfigs filePart = new BasicPipelineConfigs();
    filePart.setOrigin(new FileConfigOrigin());
    BasicPipelineConfigs secondPart = new BasicPipelineConfigs();
    secondPart.setOrigin(new RepoConfigOrigin());
    MergePipelineConfigs merge = new MergePipelineConfigs(filePart, secondPart);
    assertThat(merge.getLocal(), Matchers.<PipelineConfigs>is(filePart));
}
Also used : FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) Test(org.junit.Test)

Example 47 with FileConfigOrigin

use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.

the class MergePipelineConfigsTest method shouldReturnAuthorizationFromFileIfDefined_When2ConfigParts.

@Test
public void shouldReturnAuthorizationFromFileIfDefined_When2ConfigParts() {
    BasicPipelineConfigs part1 = new BasicPipelineConfigs();
    Authorization fileAuth = new Authorization();
    part1.setAuthorization(fileAuth);
    part1.setOrigin(new FileConfigOrigin());
    BasicPipelineConfigs part2 = new BasicPipelineConfigs();
    part2.setAuthorization(new Authorization());
    MergePipelineConfigs merge = new MergePipelineConfigs(part1, part2);
    assertThat(merge.getAuthorization(), is(fileAuth));
}
Also used : FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) Test(org.junit.Test)

Example 48 with FileConfigOrigin

use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.

the class MergePipelineConfigsTest method shouldApplyChangesToPipelineWhenPartEditable.

@Test
public void shouldApplyChangesToPipelineWhenPartEditable() {
    BasicPipelineConfigs filePart = new BasicPipelineConfigs(PipelineConfigMother.pipelineConfig("pipeline1"));
    filePart.setOrigin(new FileConfigOrigin());
    PipelineConfigs group = new MergePipelineConfigs(filePart);
    PipelineConfig pipelineConfig = (PipelineConfig) group.get(0).clone();
    pipelineConfig.setLabelTemplate("blah");
    group.update(group.getGroup(), pipelineConfig, "pipeline1");
    assertThat(group.get(0).getLabelTemplate(), is("blah"));
}
Also used : FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) Test(org.junit.Test)

Example 49 with FileConfigOrigin

use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.

the class MergePipelineConfigsTest method shouldAddPipelineToFirstEditablePartWhenExists.

@Test
public void shouldAddPipelineToFirstEditablePartWhenExists() {
    PipelineConfig pipe1 = PipelineConfigMother.pipelineConfig("pipeline1");
    BasicPipelineConfigs part1 = new BasicPipelineConfigs(pipe1);
    part1.setOrigin(new FileConfigOrigin());
    MergePipelineConfigs group = new MergePipelineConfigs(part1, new BasicPipelineConfigs());
    PipelineConfig pipeline2 = PipelineConfigMother.pipelineConfig("pipeline2");
    group.add(pipeline2);
    assertThat(group.contains(pipeline2), is(true));
}
Also used : FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) Test(org.junit.Test)

Example 50 with FileConfigOrigin

use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.

the class MaterialConfigsTest method shouldAllowToDependOnPipelineDefinedInFile_WhenInFile.

@Test
public void shouldAllowToDependOnPipelineDefinedInFile_WhenInFile() throws Exception {
    CruiseConfig cruiseConfig = new BasicCruiseConfig();
    PipelineConfig pipeline1 = goConfigMother.addPipeline(cruiseConfig, "pipeline1", "stage", "build");
    PipelineConfig pipeline2 = goConfigMother.addPipeline(cruiseConfig, "pipeline2", "stage", "build");
    goConfigMother.setDependencyOn(cruiseConfig, pipeline2, "pipeline1", "stage");
    pipeline1.setOrigin(new FileConfigOrigin());
    pipeline2.setOrigin(new FileConfigOrigin());
    pipeline1.materialConfigs().validate(ConfigSaveValidationContext.forChain(cruiseConfig, new BasicPipelineConfigs(), pipeline1));
    assertThat(pipeline1.materialConfigs().errors().isEmpty(), is(true));
    pipeline2.materialConfigs().validate(ConfigSaveValidationContext.forChain(cruiseConfig, new BasicPipelineConfigs(), pipeline2));
    DependencyMaterialConfig dep = pipeline2.materialConfigs().findDependencyMaterial(new CaseInsensitiveString("pipeline1"));
    assertThat(dep.errors().isEmpty(), is(true));
}
Also used : FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) 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