use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldLoadMostRecentPipeline.
// TODO FIXME sorted by Id is not good.
// - Comment by Bobby: Sorted by Id is exactly what we want here. Please discuss.
@Test
public void shouldLoadMostRecentPipeline() throws Exception {
String stageName = "dev";
PipelineConfig mingleConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", stageName);
Pipeline mingle = schedulePipelineWithStages(mingleConfig);
Pipeline mostRecentPipeline = pipelineDao.mostRecentPipeline(mingle.getName());
assertThat(mostRecentPipeline, hasSameId(mingle));
assertThat(mostRecentPipeline.getBuildCause().getMaterialRevisions().totalNumberOfModifications(), is(1));
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldReturnStageIdOfPassedRunIfThereWereMultipleRerunsOfAStageAndOneOfThemPassed.
@Test
public void shouldReturnStageIdOfPassedRunIfThereWereMultipleRerunsOfAStageAndOneOfThemPassed() throws SQLException {
String pipelineName = "some-pipeline";
PipelineConfig pipelineConfig = PipelineConfigMother.pipelineConfig(pipelineName);
Pipeline pipeline = dbHelper.schedulePipelineWithAllStages(pipelineConfig, ModificationsMother.modifySomeFiles(pipelineConfig));
dbHelper.pass(pipeline);
Stage stage = dbHelper.scheduleStage(pipeline, pipelineConfig.getFirstStageConfig());
dbHelper.cancelStage(stage);
String stageName = pipelineConfig.get(0).name().toString();
assertThat(pipelineDao.latestPassedStageIdentifier(pipeline.getId(), stageName), is(new StageIdentifier(pipelineName, pipeline.getCounter(), pipeline.getLabel(), stageName, "1")));
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldIncrementCounter_WhenPipelineRowIsPresentWhichWasInsertedByPauseAction.
@Test
public void shouldIncrementCounter_WhenPipelineRowIsPresentWhichWasInsertedByPauseAction() throws SQLException {
String pipelineName = "some-pipeline";
PipelineConfig pipelineConfig = PipelineConfigMother.pipelineConfig(pipelineName);
// Counter is 1
Pipeline pipeline = dbHelper.newPipelineWithAllStagesPassed(pipelineConfig);
// Counter should be incremented
dbHelper.newPipelineWithAllStagesPassed(pipelineConfig);
assertThat(pipelineDao.getCounterForPipeline(pipeline.getName().toUpperCase()), is(pipeline.getCounter() + 1));
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldStoreAndRetrieveSvnMaterials.
@Test
public void shouldStoreAndRetrieveSvnMaterials() throws SQLException {
SvnMaterial svnMaterial = svnMaterial("svnUrl", "folder");
PipelineConfig pipelineConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", "dev");
pipelineConfig.setMaterialConfigs(new MaterialConfigs(svnMaterial.config()));
MaterialRevisions materialRevisions = new MaterialRevisions();
materialRevisions.addRevision(svnMaterial, ModificationsMother.multipleModificationList());
Pipeline pipeline = instanceFactory.createPipelineInstance(pipelineConfig, BuildCause.createManualForced(materialRevisions, Username.ANONYMOUS), new DefaultSchedulingContext(DEFAULT_APPROVED_BY), md5, new TimeProvider());
assertNotInserted(pipeline.getId());
savePipeline(pipeline);
Pipeline pipelineFromDB = pipelineDao.loadPipeline(pipeline.getId());
final Materials materials = pipelineFromDB.getMaterials();
assertThat(materials.get(0), is(svnMaterial));
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldPauseExistingPipeline.
@Test
public void shouldPauseExistingPipeline() throws Exception {
PipelineConfig mingleConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("some-pipeline", "dev");
schedulePipelineWithStages(mingleConfig);
pipelineDao.pause(mingleConfig.name().toString(), "cause", "by");
PipelinePauseInfo actual = pipelineDao.pauseState(mingleConfig.name().toString());
PipelinePauseInfo expected = new PipelinePauseInfo(true, "cause", "by");
assertThat(actual.isPaused(), is(expected.isPaused()));
assertThat(actual.getPauseCause(), is(expected.getPauseCause()));
assertThat(actual.getPauseBy(), is(expected.getPauseBy()));
assertNotNull(actual.getPausedAt());
}
Aggregations