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 shouldStoreAndRetrieveMultipleSvnMaterials.
@Test
public void shouldStoreAndRetrieveMultipleSvnMaterials() throws SQLException {
SvnMaterial svnMaterial1 = svnMaterial("svnUrl1", "folder1");
SvnMaterial svnMaterial2 = svnMaterial("svnUrl2", "folder2");
PipelineConfig pipelineConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", "dev");
pipelineConfig.setMaterialConfigs(new MaterialConfigs(svnMaterial1.config(), svnMaterial2.config()));
Pipeline pipeline = instanceFactory.createPipelineInstance(pipelineConfig, BuildCause.createManualForced(modifyOneFile(pipelineConfig), Username.ANONYMOUS), new DefaultSchedulingContext(DEFAULT_APPROVED_BY), md5, new TimeProvider());
assertNotInserted(pipeline.getId());
savePipeline(pipeline);
Pipeline pipelineFromDB = pipelineDao.loadPipeline(pipeline.getId());
Materials materials = pipelineFromDB.getMaterials();
assertThat(materials, hasItem((Material) svnMaterial1));
assertThat(materials, hasItem((Material) svnMaterial2));
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldReturnCurrentPauseStateOfPipeline.
@Test
public void shouldReturnCurrentPauseStateOfPipeline() throws Exception {
PipelineConfig mingleConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("some-pipeline", "dev");
schedulePipelineWithStages(mingleConfig);
PipelinePauseInfo expected = new PipelinePauseInfo(false, null, null);
PipelinePauseInfo actual = pipelineDao.pauseState(mingleConfig.name().toString());
assertThat(actual, is(expected));
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldLoadAllActivePipelinesPresentInConfigOnly.
@Test
public void shouldLoadAllActivePipelinesPresentInConfigOnly() 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");
dbHelper.newPipelineWithAllStagesPassed(mingleConfig);
Pipeline minglePipeline = dbHelper.newPipelineWithFirstStagePassed(mingleConfig);
PipelineInstanceModels pipelineHistories = pipelineDao.loadActivePipelines();
assertThat(pipelineHistories.size(), is(1));
assertThat(pipelineHistories.get(0).getId(), is(twistPipeline.getId()));
assertThat(pipelineHistories.get(0).getBuildCause().getMaterialRevisions().isEmpty(), is(false));
if (!allPipelineNames.contains(new CaseInsensitiveString("mingle"))) {
goConfigDao.addPipeline(mingleConfig, "pipelinesqlmapdaotest");
}
pipelineHistories = pipelineDao.loadActivePipelines();
assertThat(pipelineHistories.size(), is(2));
assertThat(pipelineHistories.get(0).getId(), is(minglePipeline.getId()));
assertThat(pipelineHistories.get(1).getId(), is(twistPipeline.getId()));
assertThat(pipelineHistories.get(1).getBuildCause().getMaterialRevisions().isEmpty(), is(false));
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldReturnStageIdIfAStageOfPipelineIdPassed.
@Test
public void shouldReturnStageIdIfAStageOfPipelineIdPassed() throws SQLException {
String pipelineName = "some-pipeline";
PipelineConfig pipelineConfig = PipelineConfigMother.pipelineConfig(pipelineName);
Pipeline pipeline = dbHelper.schedulePipelineWithAllStages(pipelineConfig, ModificationsMother.modifySomeFiles(pipelineConfig));
dbHelper.pass(pipeline);
String stage = pipelineConfig.get(0).name().toString();
assertThat(pipelineDao.latestPassedStageIdentifier(pipeline.getId(), stage), is(new StageIdentifier(pipelineName, pipeline.getCounter(), pipeline.getLabel(), stage, "1")));
}
Aggregations