Search in sources :

Example 21 with PipelineInstanceModels

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));
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) Test(org.junit.Test)

Example 22 with PipelineInstanceModels

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));
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) Test(org.junit.Test)

Example 23 with PipelineInstanceModels

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"));
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) Test(org.junit.Test)

Example 24 with PipelineInstanceModels

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());
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 25 with PipelineInstanceModels

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());
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) SqlMapClientTemplate(org.springframework.orm.ibatis.SqlMapClientTemplate) Test(org.junit.Test)

Aggregations

PipelineInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels)45 Test (org.junit.Test)37 PipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)12 StageInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels)8 PipelineInstanceModels.createPipelineInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels.createPipelineInstanceModels)4 StageInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel)4 PipelineHistoryGroups (com.thoughtworks.go.server.presentation.models.PipelineHistoryGroups)4 EmptyPipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.EmptyPipelineInstanceModel)3 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)2 PipelineNotFoundException (com.thoughtworks.go.config.PipelineNotFoundException)2 Permissions (com.thoughtworks.go.config.security.Permissions)2 Modification (com.thoughtworks.go.domain.materials.Modification)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 Matchers.anyString (org.mockito.Matchers.anyString)2 SqlMapClientTemplate (org.springframework.orm.ibatis.SqlMapClientTemplate)2 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)1 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)1 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)1 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)1 PipelineDependencyGraphOld (com.thoughtworks.go.domain.PipelineDependencyGraphOld)1