Search in sources :

Example 76 with RepoConfigOrigin

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

the class PipelineConfigTest method shouldReturnTrueWhenOneOfPipelineMaterialsIsTheSameAsConfigOrigin.

@Test
public void shouldReturnTrueWhenOneOfPipelineMaterialsIsTheSameAsConfigOrigin() {
    PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfig("pipeline", "stage", "build");
    MaterialConfig material = pipelineConfig.materialConfigs().first();
    pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(material, "plugin"), "1233"));
    assertThat(pipelineConfig.isConfigOriginSameAsOneOfMaterials(), is(true));
}
Also used : ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) PluggableSCMMaterialConfig(com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) AbstractMaterialConfig(com.thoughtworks.go.config.materials.AbstractMaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) PackageMaterialConfig(com.thoughtworks.go.config.materials.PackageMaterialConfig) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) Test(org.junit.Test)

Example 77 with RepoConfigOrigin

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

the class PipelineGroupsTest method shouldErrorOutIfDuplicatePipelineIsAdded.

@Test
public void shouldErrorOutIfDuplicatePipelineIsAdded() {
    PipelineConfig pipeline1 = createPipelineConfig("pipeline1", "stage1");
    PipelineConfig pipeline2 = createPipelineConfig("pipeline1", "stage1");
    PipelineConfig pipeline3 = createPipelineConfig("pipeline1", "stage1");
    PipelineConfig pipeline4 = createPipelineConfig("pipeline1", "stage1");
    pipeline3.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(MaterialConfigsMother.gitMaterialConfig(), "plugin"), "rev1"));
    pipeline4.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(MaterialConfigsMother.svnMaterialConfig(), "plugin"), "1"));
    PipelineConfigs defaultGroup = createGroup("defaultGroup", pipeline1);
    PipelineConfigs anotherGroup = createGroup("anotherGroup", pipeline2);
    PipelineConfigs thirdGroup = createGroup("thirdGroup", pipeline3);
    PipelineConfigs fourthGroup = createGroup("fourthGroup", pipeline4);
    PipelineGroups pipelineGroups = new PipelineGroups(defaultGroup, anotherGroup, thirdGroup, fourthGroup);
    pipelineGroups.validate(null);
    List<String> expectedSources = asList(pipeline1.getOriginDisplayName(), pipeline2.getOriginDisplayName(), pipeline3.getOriginDisplayName(), pipeline4.getOriginDisplayName());
    assertDuplicateNameErrorOnPipeline(pipeline1, expectedSources, 3);
    assertDuplicateNameErrorOnPipeline(pipeline2, expectedSources, 3);
    assertDuplicateNameErrorOnPipeline(pipeline3, expectedSources, 3);
    assertDuplicateNameErrorOnPipeline(pipeline4, expectedSources, 3);
}
Also used : PipelineConfigMother.createPipelineConfig(com.thoughtworks.go.helper.PipelineConfigMother.createPipelineConfig) ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) MergePipelineConfigs(com.thoughtworks.go.config.merge.MergePipelineConfigs) StringContains.containsString(org.hamcrest.core.StringContains.containsString) Test(org.junit.Test)

Example 78 with RepoConfigOrigin

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

the class PipelineGroupsTest method shouldGetLocalPartsWhenOriginIsRepo.

@Test
public void shouldGetLocalPartsWhenOriginIsRepo() {
    PipelineConfigs defaultGroup = createGroup("defaultGroup", createPipelineConfig("pipeline1", "stage1"));
    defaultGroup.setOrigins(new RepoConfigOrigin());
    PipelineGroups groups = new PipelineGroups(defaultGroup);
    assertThat(groups.getLocal().size(), is(0));
    assertThat(groups.getLocal().isEmpty(), is(true));
}
Also used : RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) MergePipelineConfigs(com.thoughtworks.go.config.merge.MergePipelineConfigs) Test(org.junit.Test)

Example 79 with RepoConfigOrigin

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

the class BuildCauseTest method shouldNotThrowWhenMaterialAndConfigOriginRevisionMatch_WhenAutoTrigger.

@Test
public void shouldNotThrowWhenMaterialAndConfigOriginRevisionMatch_WhenAutoTrigger() {
    SvnMaterial material = MaterialsMother.svnMaterial();
    MaterialConfig materialConfig = material.config();
    MaterialRevisions first = new MaterialRevisions(new MaterialRevision(material, oneModifiedFile("revision1")));
    BuildCause buildCause = BuildCause.createWithModifications(first, "");
    buildCause.setMaterialRevisions(first);
    PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfigWithStages("pipe1", "build");
    pipelineConfig.materialConfigs().clear();
    pipelineConfig.materialConfigs().add(materialConfig);
    pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(materialConfig, "plug"), "revision1"));
    buildCause.assertPipelineConfigAndMaterialRevisionMatch(pipelineConfig);
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) Test(org.junit.Test)

Example 80 with RepoConfigOrigin

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

the class FetchPluggableArtifactTaskTest method validate_shouldNotErrorWhenReferencingFilePipelineFromConfigRepositoryPipeline.

@Test
public void validate_shouldNotErrorWhenReferencingFilePipelineFromConfigRepositoryPipeline() {
    uppestStream.getStage("uppest-stage2").jobConfigByConfigName("uppest-job2").artifactConfigs().add(new PluggableArtifactConfig("s3", "cd.go.s3"));
    uppestStream.setOrigin(new FileConfigOrigin());
    downstream.setOrigin(new RepoConfigOrigin());
    FetchPluggableArtifactTask task = new FetchPluggableArtifactTask(new CaseInsensitiveString("uppest_stream/upstream"), new CaseInsensitiveString("uppest-stage2"), new CaseInsensitiveString("uppest-job2"), "s3");
    task.validate(ConfigSaveValidationContext.forChain(config, new BasicPipelineConfigs(), downstream, downstream.getStage(new CaseInsensitiveString("stage"))));
    assertThat(task.errors().isEmpty(), is(true));
}
Also used : FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) Test(org.junit.Test)

Aggregations

RepoConfigOrigin (com.thoughtworks.go.config.remote.RepoConfigOrigin)97 Test (org.junit.Test)74 ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)34 PartialConfig (com.thoughtworks.go.config.remote.PartialConfig)29 FileConfigOrigin (com.thoughtworks.go.config.remote.FileConfigOrigin)23 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)15 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)13 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)11 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)11 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)11 StringContains.containsString (org.hamcrest.core.StringContains.containsString)11 File (java.io.File)9 IOException (java.io.IOException)8 GitAPIException (org.eclipse.jgit.api.errors.GitAPIException)8 ExpectedException (org.junit.rules.ExpectedException)8 Cloner (com.rits.cloning.Cloner)7 FullConfigUpdateCommand (com.thoughtworks.go.config.update.FullConfigUpdateCommand)7 Modification (com.thoughtworks.go.domain.materials.Modification)7 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)6 GoConfigInvalidException (com.thoughtworks.go.config.exceptions.GoConfigInvalidException)6