use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldReturnEmptyListWhenThereIsNoPipelineHistory.
@Test
public void shouldReturnEmptyListWhenThereIsNoPipelineHistory() throws Exception {
PipelineInstanceModels pipelineHistories = pipelineDao.loadHistory("something not exist", 10, 0);
assertThat(pipelineHistories.size(), is(0));
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels 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));
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldGeneratePipelineDependencyGraphForAllDownStreamPipelines.
@Test
public void shouldGeneratePipelineDependencyGraphForAllDownStreamPipelines() throws Exception {
PipelineConfig shine = PipelineMother.twoBuildPlansWithResourcesAndMaterials("shine", "1stStage", "2ndStage");
PipelineConfig cruise13 = pipelineConfigFor("cruise1.3", "shine", "1stStage");
PipelineConfig cruise20 = pipelineConfigFor("cruise2.0", "shine", "2ndStage");
Pipeline shineInstance = dbHelper.newPipelineWithAllStagesPassed(shine);
Pipeline cruise13Instance = dbHelper.newPipelineWithAllStagesPassed(cruise13);
Pipeline cruise20Instance = dbHelper.newPipelineWithAllStagesPassed(cruise20);
PipelineDependencyGraphOld dependencyGraph = pipelineDao.pipelineGraphByNameAndCounter("shine", 1);
assertPipelineEquals(shineInstance, dependencyGraph.pipeline());
ensureBuildCauseIsLoadedFor(dependencyGraph.pipeline());
PipelineInstanceModels dependencies = dependencyGraph.dependencies();
assertThat(dependencies.size(), is(2));
assertPipelineEquals(cruise13Instance, dependencies.find("cruise1.3"));
assertPipelineEquals(cruise20Instance, dependencies.find("cruise2.0"));
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.
the class PipelineSqlMapDaoTest method shouldGetAnEmptyListOfPIMsWhenActivePipelinesListDoesNotHavePIMsForRequestedPipeline.
@Test
public void shouldGetAnEmptyListOfPIMsWhenActivePipelinesListDoesNotHavePIMsForRequestedPipeline() throws Exception {
String pipelineName = "pipeline-with-no-active-instances";
when(configFileDao.load()).thenReturn(GoConfigMother.configWithPipelines(pipelineName));
when(sqlMapClientTemplate.queryForList("allActivePipelines")).thenReturn(new ArrayList<PipelineInstanceModel>());
PipelineInstanceModels models = pipelineSqlMapDao.loadActivePipelineInstancesFor(pipelineName);
assertTrue(models.isEmpty());
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.
the class PipelineSqlMapDaoTest method loadHistoryByIds_shouldLoadHistoryByIdWhenOnlyASingleIdIsNeedeSoThatItUsesTheExistingCacheForEnvironmentsPage.
@Test
public void loadHistoryByIds_shouldLoadHistoryByIdWhenOnlyASingleIdIsNeedeSoThatItUsesTheExistingCacheForEnvironmentsPage() throws Exception {
SqlMapClientTemplate mockTemplate = mock(SqlMapClientTemplate.class);
when(mockTemplate.queryForList(eq("getPipelineRange"), any())).thenReturn(Arrays.asList(2L));
pipelineSqlMapDao.setSqlMapClientTemplate(mockTemplate);
PipelineInstanceModels pipelineHistories = pipelineSqlMapDao.loadHistory("pipelineName", 1, 0);
verify(mockTemplate, never()).queryForList(eq("getPipelineHistoryByName"), any());
verify(mockTemplate, times(1)).queryForList(eq("getPipelineRange"), any());
}
Aggregations