use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method loadAllActivePipelinesPresentInConfigOnlyShouldBeCaseInsensitive.
@Test
public void loadAllActivePipelinesPresentInConfigOnlyShouldBeCaseInsensitive() 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"))) {
PipelineConfig pipelineConfigWithDifferentCase = PipelineMother.createPipelineConfig("TWIST", twistConfig.materialConfigs(), "dev", "ft");
goConfigDao.addPipeline(pipelineConfigWithDifferentCase, "pipelinesqlmapdaotest");
}
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));
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldLoadAllActivePipelinesPresentInConfigAndAlsoTheScheduledStagesOfPipelinesNotInConfig.
@Test
public void shouldLoadAllActivePipelinesPresentInConfigAndAlsoTheScheduledStagesOfPipelinesNotInConfig() 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");
}
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.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldLoadAllActivePipelinesEvenWhenThereIsStageStatusChange.
@Test
public void shouldLoadAllActivePipelinesEvenWhenThereIsStageStatusChange() throws Exception {
PipelineConfig twistConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("twist", "dev", "ft");
goConfigDao.addPipeline(twistConfig, "pipelinesqlmapdaotest");
Pipeline twistPipeline = dbHelper.newPipelineWithAllStagesPassed(twistConfig);
PipelineConfig mingleConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", "dev", "ft");
goConfigDao.addPipeline(mingleConfig, "pipelinesqlmapdaotest");
final Pipeline firstPipeline = dbHelper.newPipelineWithAllStagesPassed(mingleConfig);
final Pipeline secondPipeline = dbHelper.newPipelineWithFirstStagePassed(mingleConfig);
dbHelper.scheduleStage(secondPipeline, mingleConfig.get(1));
Pipeline thirdPipeline = dbHelper.newPipelineWithFirstStageScheduled(mingleConfig);
Thread stageStatusChanger = new Thread() {
@Override
public void run() {
for (; ; ) {
pipelineDao.stageStatusChanged(secondPipeline.findStage("dev"));
if (super.isInterrupted()) {
break;
}
}
}
};
stageStatusChanger.setDaemon(true);
stageStatusChanger.start();
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));
stageStatusChanger.interrupt();
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels 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.presentation.pipelinehistory.PipelineInstanceModels 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));
}
Aggregations