Search in sources :

Example 61 with DependencyMaterialConfig

use of com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig in project gocd by gocd.

the class PipelineSqlMapDaoIntegrationTest method shouldGenerateGraphForMultipleRunsOfDownstreamPipelinesOfAGivenPipelineNameAndCounter.

@Test
public void shouldGenerateGraphForMultipleRunsOfDownstreamPipelinesOfAGivenPipelineNameAndCounter() throws Exception {
    PipelineConfig shine = PipelineMother.twoBuildPlansWithResourcesAndMaterials("shine", "shineStage");
    PipelineConfig cruise = PipelineMother.twoBuildPlansWithResourcesAndMaterials("cruise", "cruiseStage");
    cruise.materialConfigs().clear();
    cruise.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("shine"), new CaseInsensitiveString("shineStage")));
    Pipeline shineInstance = dbHelper.newPipelineWithAllStagesPassed(shine);
    Pipeline cruiseInstance1 = dbHelper.newPipelineWithAllStagesPassed(cruise);
    Pipeline cruiseInstance2 = dbHelper.newPipelineWithAllStagesPassed(cruise);
    Pipeline cruiseInstance3 = dbHelper.newPipelineWithAllStagesPassed(cruise);
    PipelineDependencyGraphOld dependencyGraph = pipelineDao.pipelineGraphByNameAndCounter("shine", 1);
    PipelineInstanceModel upstream = dependencyGraph.pipeline();
    assertPipelineEquals(shineInstance, upstream);
    ensureBuildCauseIsLoadedFor(upstream);
    assertThat(dependencyGraph.dependencies().size(), is(3));
    assertThat(dependencyGraph.dependencies(), hasPipeline(cruiseInstance1));
    assertThat(dependencyGraph.dependencies(), hasPipeline(cruiseInstance2));
    assertThat(dependencyGraph.dependencies(), hasPipeline(cruiseInstance3));
}
Also used : PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) Test(org.junit.Test)

Example 62 with DependencyMaterialConfig

use of com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig in project gocd by gocd.

the class GoConfigMother method setDependencyOn.

public void setDependencyOn(CruiseConfig cruiseConfig, PipelineConfig pipelineConfig, String dependsOnPipeline, String dependsOnStage) {
    PipelineConfig config = cruiseConfig.pipelineConfigByName(pipelineConfig.name());
    config.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString(dependsOnPipeline), new CaseInsensitiveString(dependsOnStage)));
}
Also used : DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)

Example 63 with DependencyMaterialConfig

use of com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig in project gocd by gocd.

the class BasicCruiseConfigTest method shouldGenerateAMapOfAllPipelinesAndTheirParentDependencies.

@Test
public void shouldGenerateAMapOfAllPipelinesAndTheirParentDependencies() {
    /*
        *    -----+ p2 --> p4
        *  p1
        *    -----+ p3
        *
        * */
    PipelineConfig p1 = createPipelineConfig("p1", "s1", "j1");
    PipelineConfig p2 = createPipelineConfig("p2", "s2", "j1");
    p2.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("p1"), new CaseInsensitiveString("s1")));
    PipelineConfig p3 = createPipelineConfig("p3", "s3", "j1");
    p3.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("p1"), new CaseInsensitiveString("s1")));
    PipelineConfig p4 = createPipelineConfig("p4", "s4", "j1");
    p4.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("p2"), new CaseInsensitiveString("s2")));
    pipelines.addAll(asList(p4, p2, p1, p3));
    Map<String, List<PipelineConfig>> expectedPipelines = cruiseConfig.generatePipelineVsDownstreamMap();
    assertThat(expectedPipelines.size(), is(4));
    assertThat(expectedPipelines.get("p1"), hasItems(p2, p3));
    assertThat(expectedPipelines.get("p2"), hasItems(p4));
    assertThat(expectedPipelines.get("p3").isEmpty(), is(true));
    assertThat(expectedPipelines.get("p4").isEmpty(), is(true));
}
Also used : PipelineConfigMother.createPipelineConfig(com.thoughtworks.go.helper.PipelineConfigMother.createPipelineConfig) Arrays.asList(java.util.Arrays.asList) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) Test(org.junit.Test)

Example 64 with DependencyMaterialConfig

use of com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig in project gocd by gocd.

the class MergeCruiseConfigTest method shouldGenerateAMapOfAllPipelinesAndTheirParentDependencies_WhenThereAreRemotePipelinesInMap.

@Test
public void shouldGenerateAMapOfAllPipelinesAndTheirParentDependencies_WhenThereAreRemotePipelinesInMap() {
    /*
        *    -----+ p2 --> p4
        *  p1
        *    -----+ p3 --> remote-pipe-1
        *
        * */
    PipelineConfig p1 = createPipelineConfig("p1", "s1", "j1");
    PipelineConfig p2 = createPipelineConfig("p2", "s2", "j1");
    p2.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("p1"), new CaseInsensitiveString("s1")));
    PipelineConfig p3 = createPipelineConfig("p3", "s3", "j1");
    p3.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("p1"), new CaseInsensitiveString("s1")));
    PipelineConfig p4 = createPipelineConfig("p4", "s4", "j1");
    p4.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("p2"), new CaseInsensitiveString("s2")));
    pipelines.addAll(Arrays.asList(p4, p2, p1, p3));
    PipelineConfig remotePipe1 = createPipelineConfig("remote-pipe-1", "s5", "j1");
    remotePipe1.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("p3"), new CaseInsensitiveString("s3")));
    PartialConfig part = new PartialConfig();
    part.getGroups().addPipeline("remoteGroup", remotePipe1);
    cruiseConfig = new BasicCruiseConfig(new BasicCruiseConfig(pipelines), part);
    Map<String, List<PipelineConfig>> expectedPipelines = cruiseConfig.generatePipelineVsDownstreamMap();
    assertThat(expectedPipelines.size(), is(5));
    assertThat(expectedPipelines.get("p1"), hasItems(p2, p3));
    assertThat(expectedPipelines.get("p2"), hasItems(p4));
    assertThat(expectedPipelines.get("p3"), hasItems(remotePipe1));
    assertThat(expectedPipelines.get("remote-pipe-1").isEmpty(), is(true));
    assertThat(expectedPipelines.get("p4").isEmpty(), is(true));
}
Also used : PipelineConfigMother.createPipelineConfig(com.thoughtworks.go.helper.PipelineConfigMother.createPipelineConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) Test(org.junit.Test)

Example 65 with DependencyMaterialConfig

use of com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig in project gocd by gocd.

the class MergeCruiseConfigTest method shouldGenerateAMapOfAllPipelinesAndTheirParentDependencies_WhenAllPipelinesInMapAreLocal.

@Test
public void shouldGenerateAMapOfAllPipelinesAndTheirParentDependencies_WhenAllPipelinesInMapAreLocal() {
    /*
        *    -----+ p2 --> p4
        *  p1
        *    -----+ p3
        *
        * */
    PipelineConfig p1 = createPipelineConfig("p1", "s1", "j1");
    PipelineConfig p2 = createPipelineConfig("p2", "s2", "j1");
    p2.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("p1"), new CaseInsensitiveString("s1")));
    PipelineConfig p3 = createPipelineConfig("p3", "s3", "j1");
    p3.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("p1"), new CaseInsensitiveString("s1")));
    PipelineConfig p4 = createPipelineConfig("p4", "s4", "j1");
    p4.addMaterialConfig(new DependencyMaterialConfig(new CaseInsensitiveString("p2"), new CaseInsensitiveString("s2")));
    pipelines.addAll(Arrays.asList(p4, p2, p1, p3));
    cruiseConfig = new BasicCruiseConfig(new BasicCruiseConfig(pipelines), PartialConfigMother.withPipelineInGroup("remote-pipe-1", "remote_group"));
    Map<String, List<PipelineConfig>> expectedPipelines = cruiseConfig.generatePipelineVsDownstreamMap();
    assertThat(expectedPipelines.size(), is(5));
    assertThat(expectedPipelines.get("p1"), hasItems(p2, p3));
    assertThat(expectedPipelines.get("p2"), hasItems(p4));
    assertThat(expectedPipelines.get("p3").isEmpty(), is(true));
    assertThat(expectedPipelines.get("p4").isEmpty(), is(true));
    assertThat(expectedPipelines.get("remote-pipe-1").isEmpty(), is(true));
}
Also used : PipelineConfigMother.createPipelineConfig(com.thoughtworks.go.helper.PipelineConfigMother.createPipelineConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) Test(org.junit.Test)

Aggregations

DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)135 Test (org.junit.Test)106 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)22 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)22 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)21 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)15 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)14 PipelineConfigDependencyGraph (com.thoughtworks.go.server.domain.PipelineConfigDependencyGraph)11 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)10 Date (java.util.Date)10 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)9 PluggableSCMMaterialConfig (com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig)8 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)8 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)8 Pipeline (com.thoughtworks.go.domain.Pipeline)8 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)8 ScmMaterialConfig (com.thoughtworks.go.config.materials.ScmMaterialConfig)7 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)7 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)7 ModificationsMother.changedDependencyMaterialRevision (com.thoughtworks.go.helper.ModificationsMother.changedDependencyMaterialRevision)7