use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel 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));
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel in project gocd by gocd.
the class PipelineHistoryServiceIntegrationTest method shouldReturnEmptyPipelineInstanceModel.
@Test
public void shouldReturnEmptyPipelineInstanceModel() throws Exception {
configHelper.setViewPermissionForGroup(pipelineOne.groupName, "jez");
PipelineInstanceModels models = pipelineHistoryService.findPipelineInstances(pipelineOne.pipelineName, "latest", 3, "jez");
assertThat(models.size(), is(1));
PipelineInstanceModel emptyModel = models.get(0);
assertThat(emptyModel.getName(), is(pipelineOne.pipelineName));
assertThat(emptyModel.getLabel(), is("unknown"));
assertThat(emptyModel.getBuildCauseMessage(), is("No modifications"));
assertThat(emptyModel.getStageHistory().size(), is(3));
assertThat(emptyModel.getStageHistory().get(0).getState(), is(StageState.Unknown));
assertThat(emptyModel.getCreatedTimeForDisplay(), is(TimeConverter.ConvertedTime.NO_HISTORICAL_DATA));
assertThat(emptyModel.getCanRun(), is(true));
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel in project gocd by gocd.
the class PipelineHistoryGroupingUtilTest method shouldCreateOneGroupForOnePipelineHistoryItem.
@Test
public void shouldCreateOneGroupForOnePipelineHistoryItem() throws Exception {
PipelineInstanceModel pipelineInstanceModel = PipelineHistoryItemMother.custom("stage1", "stage2");
PipelineHistoryGroups historyGroups = groupingUtil.createGroups(PipelineInstanceModels.createPipelineInstanceModels(pipelineInstanceModel));
assertThat(historyGroups.size(), is(1));
assertThat(historyGroups.first().hasSameStagesAs(pipelineInstanceModel), is(true));
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel in project gocd by gocd.
the class PipelineHistoryGroupingUtilTest method shouldCreateOneGroupWithMultiplePipelineHistoryItems.
@Test
public void shouldCreateOneGroupWithMultiplePipelineHistoryItems() throws Exception {
PipelineInstanceModel pipelineHistoryItem1 = PipelineHistoryItemMother.custom("stage1", "stage2");
PipelineInstanceModel pipelineHistoryItem2 = PipelineHistoryItemMother.custom("stage1", "stage2");
PipelineInstanceModels history = PipelineInstanceModels.createPipelineInstanceModels(pipelineHistoryItem1, pipelineHistoryItem2);
PipelineHistoryGroups historyGroups = groupingUtil.createGroups(history);
assertThat(historyGroups.size(), is(1));
assertThat(historyGroups.first().hasSameStagesAs(pipelineHistoryItem1), is(true));
assertThat(historyGroups.first().hasSameStagesAs(pipelineHistoryItem2), is(true));
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel in project gocd by gocd.
the class PipelineHistoryGroupingUtilTest method shouldCreateTwoGroupsWithOneGroupHasMultiplePipelineHistoryItems.
@Test
public void shouldCreateTwoGroupsWithOneGroupHasMultiplePipelineHistoryItems() throws Exception {
PipelineInstanceModel pipelineHistoryItem1 = PipelineHistoryItemMother.custom("stage1", "stage2");
PipelineInstanceModel pipelineHistoryItem2 = PipelineHistoryItemMother.custom("stage1", "stage2");
PipelineInstanceModel pipelineHistoryItem3 = PipelineHistoryItemMother.custom("stage2", "stage1");
PipelineInstanceModel pipelineHistoryItem4 = PipelineHistoryItemMother.custom("stage1", "stage3");
PipelineInstanceModels history = PipelineInstanceModels.createPipelineInstanceModels(pipelineHistoryItem1, pipelineHistoryItem2, pipelineHistoryItem3, pipelineHistoryItem4);
PipelineHistoryGroups historyGroups = groupingUtil.createGroups(history);
assertThat(historyGroups.size(), is(3));
assertThat(historyGroups.first().hasSameStagesAs(pipelineHistoryItem1), is(true));
assertThat(historyGroups.get(1).hasSameStagesAs(pipelineHistoryItem3), is(true));
assertThat(historyGroups.get(2).hasSameStagesAs(pipelineHistoryItem4), is(true));
}
Aggregations