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