use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels 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.PipelineInstanceModels 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));
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.
the class PipelineDependencyGraphOldTest method shouldFilterPIMS.
@Test
public void shouldFilterPIMS() throws Exception {
PipelineDependencyGraphOld graph = new PipelineDependencyGraphOld(pim("upstream"), PipelineInstanceModels.createPipelineInstanceModels(pim("pavan"), pim("raghu")));
PipelineDependencyGraphOld.Filterer filterer = mock(PipelineDependencyGraphOld.Filterer.class);
when(filterer.filterPipeline("raghu")).thenReturn(false);
when(filterer.filterPipeline("pavan")).thenReturn(true);
graph.filterDependencies(filterer);
PipelineInstanceModels models = graph.dependencies();
assertThat(models.size(), is(1));
assertThat(models.get(0).getName(), is("pavan"));
}
Aggregations