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));
}
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));
}
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);
}
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));
}
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));
}
Aggregations