Search in sources :

Example 96 with PipelineConfig

use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.

the class PipelineSqlMapDaoIntegrationTest method shouldSupportSubmoduleFolderInGitMaterials.

@Test
public void shouldSupportSubmoduleFolderInGitMaterials() throws Exception {
    Materials materials = MaterialsMother.gitMaterials("gitUrl", "submoduleFolder", null);
    PipelineConfig pipelineConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", "dev");
    pipelineConfig.setMaterialConfigs(materials.convertToConfigs());
    Pipeline pipeline = instanceFactory.createPipelineInstance(pipelineConfig, BuildCause.createManualForced(modifyOneFile(pipelineConfig), Username.ANONYMOUS), new DefaultSchedulingContext(DEFAULT_APPROVED_BY), md5, new TimeProvider());
    assertNotInserted(pipeline.getId());
    save(pipeline);
    Pipeline pipelineFromDB = pipelineDao.loadPipeline(pipeline.getId());
    Materials materialsFromDB = pipelineFromDB.getMaterials();
    GitMaterial gitMaterial = (GitMaterial) materialsFromDB.get(0);
    assertThat(gitMaterial.getSubmoduleFolder(), is("submoduleFolder"));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) GitMaterial(com.thoughtworks.go.config.materials.git.GitMaterial) Materials(com.thoughtworks.go.config.materials.Materials) Test(org.junit.Test)

Example 97 with PipelineConfig

use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.

the class PipelineSqlMapDaoIntegrationTest method shouldLoadAllActivePipelines.

@Test
public void shouldLoadAllActivePipelines() throws Exception {
    PipelineConfig twistConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("twist", "dev", "ft");
    Pipeline twistPipeline = dbHelper.newPipelineWithAllStagesPassed(twistConfig);
    List<CaseInsensitiveString> allPipelineNames = goConfigDao.load().getAllPipelineNames();
    if (!allPipelineNames.contains(new CaseInsensitiveString("twist"))) {
        goConfigDao.addPipeline(twistConfig, "pipelinesqlmapdaotest");
    }
    PipelineConfig mingleConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", "dev", "ft");
    if (!allPipelineNames.contains(new CaseInsensitiveString("mingle"))) {
        goConfigDao.addPipeline(mingleConfig, "pipelinesqlmapdaotest");
    }
    Pipeline firstPipeline = dbHelper.newPipelineWithAllStagesPassed(mingleConfig);
    Pipeline secondPipeline = dbHelper.newPipelineWithFirstStagePassed(mingleConfig);
    dbHelper.scheduleStage(secondPipeline, mingleConfig.get(1));
    Pipeline thirdPipeline = dbHelper.newPipelineWithFirstStageScheduled(mingleConfig);
    PipelineInstanceModels pipelineHistories = pipelineDao.loadActivePipelines();
    assertThat(pipelineHistories.size(), is(3));
    assertThat(pipelineHistories.get(0).getId(), is(thirdPipeline.getId()));
    assertThat(pipelineHistories.get(1).getId(), is(secondPipeline.getId()));
    assertThat(pipelineHistories.get(2).getId(), is(twistPipeline.getId()));
    assertThat(pipelineHistories.get(0).getBuildCause().getMaterialRevisions().isEmpty(), is(false));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Example 98 with PipelineConfig

use of com.thoughtworks.go.config.PipelineConfig 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 : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Example 99 with PipelineConfig

use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.

the class PipelineSqlMapDaoIntegrationTest method shouldFindPipelineThatPassedForStageAcrossStageReruns.

@Test
public void shouldFindPipelineThatPassedForStageAcrossStageReruns() throws Exception {
    PipelineConfig config = PipelineMother.createPipelineConfig("pipeline", new MaterialConfigs(MaterialConfigsMother.hgMaterialConfig()), "firstStage", "secondStage");
    Pipeline pipeline0 = dbHelper.newPipelineWithAllStagesPassed(config);
    dbHelper.updateNaturalOrder(pipeline0.getId(), 4.0);
    Pipeline pipeline1 = dbHelper.newPipelineWithFirstStagePassed(config);
    Stage stage = dbHelper.scheduleStage(pipeline1, config.get(1));
    dbHelper.failStage(stage);
    stage = dbHelper.scheduleStage(pipeline1, config.get(1));
    dbHelper.passStage(stage);
    dbHelper.updateNaturalOrder(pipeline1.getId(), 5.0);
    Stage passedStageRerun = StageMother.scheduledStage("pipeline", pipeline1.getCounter(), "secondStage", 2, "job");
    passedStageRerun = stageDao.saveWithJobs(pipeline1, passedStageRerun);
    dbHelper.passStage(passedStageRerun);
    Pipeline pipeline5 = dbHelper.newPipelineWithFirstStagePassed(config);
    stage = dbHelper.scheduleStage(pipeline5, config.get(1));
    dbHelper.failStage(stage);
    dbHelper.updateNaturalOrder(pipeline5.getId(), 9.0);
    Pipeline pipeline6 = dbHelper.newPipelineWithFirstStagePassed(config);
    stage = dbHelper.scheduleStage(pipeline6, config.get(1));
    dbHelper.failStage(stage);
    dbHelper.updateNaturalOrder(pipeline6.getId(), 10.0);
    Pipeline pipeline = pipelineDao.findEarlierPipelineThatPassedForStage("pipeline", "secondStage", 10.0);
    assertThat(pipeline.getId(), is(pipeline1.getId()));
    assertThat(pipeline.getNaturalOrder(), is(5.0));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) PipelineConfig(com.thoughtworks.go.config.PipelineConfig) Test(org.junit.Test)

Example 100 with PipelineConfig

use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.

the class PipelineSqlMapDaoIntegrationTest method shouldSupportPipelinesWithoutCounterWhenLoadHistory.

@Test
public void shouldSupportPipelinesWithoutCounterWhenLoadHistory() {
    PipelineConfig mingleConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", "dev");
    schedulePipelineWithoutCounter(mingleConfig);
    PipelineInstanceModels models = pipelineDao.loadHistory(CaseInsensitiveString.str(mingleConfig.name()), 10, 0);
    assertThat(models.size(), is(1));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) Test(org.junit.Test)

Aggregations

PipelineConfig (com.thoughtworks.go.config.PipelineConfig)188 Test (org.junit.Test)144 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)94 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)40 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)21 Date (java.util.Date)19 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)19 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)17 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)17 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)16 Materials (com.thoughtworks.go.config.materials.Materials)13 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)13 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)12 Pipeline (com.thoughtworks.go.domain.Pipeline)12 PipelineInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels)12 PipelineConfigDependencyGraph (com.thoughtworks.go.server.domain.PipelineConfigDependencyGraph)12 StageConfig (com.thoughtworks.go.config.StageConfig)11 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)10 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)10 Material (com.thoughtworks.go.domain.materials.Material)9