Search in sources :

Example 26 with PipelineInstanceModels

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.

the class PipelineHistoryGroupingUtilTest method shouldNotCreateGroupForEmptyHistory.

@Test
public void shouldNotCreateGroupForEmptyHistory() throws Exception {
    PipelineInstanceModels history = PipelineInstanceModels.createPipelineInstanceModels();
    PipelineHistoryGroups historyGroups = groupingUtil.createGroups(history);
    assertThat(historyGroups.size(), is(0));
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) PipelineHistoryGroups(com.thoughtworks.go.server.presentation.models.PipelineHistoryGroups) Test(org.junit.Test)

Example 27 with PipelineInstanceModels

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.

the class PipelineHistoryGroupingUtilTest method shouldCreateTwoGroupsWithMultiplePipelineHistoryItems.

@Test
public void shouldCreateTwoGroupsWithMultiplePipelineHistoryItems() throws Exception {
    PipelineInstanceModel pipelineHistoryItem1 = PipelineHistoryItemMother.custom("stage1", "stage2");
    PipelineInstanceModel pipelineHistoryItem2 = PipelineHistoryItemMother.custom("stage1", "stage3");
    PipelineInstanceModels history = PipelineInstanceModels.createPipelineInstanceModels(pipelineHistoryItem1, pipelineHistoryItem2);
    PipelineHistoryGroups historyGroups = groupingUtil.createGroups(history);
    assertThat(historyGroups.size(), is(2));
    assertThat(historyGroups.first().hasSameStagesAs(pipelineHistoryItem1), is(true));
    assertThat(historyGroups.get(1).hasSameStagesAs(pipelineHistoryItem2), is(true));
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) PipelineHistoryGroups(com.thoughtworks.go.server.presentation.models.PipelineHistoryGroups) Test(org.junit.Test)

Example 28 with PipelineInstanceModels

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.

the class PipelineHistoryServiceIntegrationTest method shouldLoadPipelineHistoryWithEmptyDefaultIfNone.

@Test
public void shouldLoadPipelineHistoryWithEmptyDefaultIfNone() throws Exception {
    configHelper.setViewPermissionForGroup("group1", "jez");
    PipelineInstanceModels history = pipelineHistoryService.loadWithEmptyAsDefault(pipelineOne.pipelineName, Pagination.pageStartingAt(0, 1, 1), "jez");
    assertThat(history.size(), is(1));
    StageInstanceModels stageHistory = history.first().getStageHistory();
    assertThat(stageHistory.size(), is(3));
    assertStageHistory(stageHistory.get(0), false, true);
    assertStageHistory(stageHistory.get(1), false, false);
    assertStageHistory(stageHistory.get(2), false, false);
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) Test(org.junit.Test)

Example 29 with PipelineInstanceModels

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.

the class PipelineHistoryServiceIntegrationTest method shouldLoadPipelineHistoryWithPlaceholderStagesPopulated.

@Test
public void shouldLoadPipelineHistoryWithPlaceholderStagesPopulated() throws Exception {
    pipelineOne.createPipelineWithFirstStagePassedAndSecondStageHasNotStarted();
    PipelineInstanceModels history = pipelineHistoryService.load(pipelineOne.pipelineName, Pagination.pageStartingAt(0, 1, 10), "jez", true);
    StageInstanceModels stageHistory = history.first().getStageHistory();
    assertThat("Should populate 2 placeholder stages from config", stageHistory.size(), is(3));
    assertThat(stageHistory.first().isScheduled(), is(true));
    assertThat(stageHistory.first().isAutoApproved(), is(true));
    assertThat(stageHistory.first().getCanRun(), is(true));
    assertThat(stageHistory.get(1).isScheduled(), is(false));
    assertThat(stageHistory.get(1).isAutoApproved(), is(false));
    assertThat("The first future stage should can run", stageHistory.get(1).getCanRun(), is(true));
    assertThat(stageHistory.get(2).isScheduled(), is(false));
    assertThat(stageHistory.get(2).isAutoApproved(), is(true));
    assertThat("The second future stage should can not run", stageHistory.get(2).getCanRun(), is(false));
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) Test(org.junit.Test)

Example 30 with PipelineInstanceModels

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.

the class PipelineHistoryServiceIntegrationTest method shouldNotLoadDuplicatPlaceholderStages.

@Test
public void shouldNotLoadDuplicatPlaceholderStages() throws Exception {
    goConfigService.addPipeline(PipelineConfigMother.createPipelineConfig("pipeline", "stage", "job"), "pipeline-group");
    PipelineInstanceModels history = pipelineHistoryService.load("pipeline", Pagination.pageStartingAt(0, 1, 10), "anyone", true);
    PipelineInstanceModel instanceModel = history.first();
    assertThat(instanceModel instanceof EmptyPipelineInstanceModel, is(true));
    StageInstanceModels stageHistory = instanceModel.getStageHistory();
    assertThat(stageHistory.size(), is(1));
    assertThat(stageHistory.first() instanceof NullStageHistoryItem, is(true));
}
Also used : NullStageHistoryItem(com.thoughtworks.go.presentation.pipelinehistory.NullStageHistoryItem) PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) EmptyPipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.EmptyPipelineInstanceModel) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) EmptyPipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.EmptyPipelineInstanceModel) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) 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