Search in sources :

Example 61 with PipelineInstanceModels

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));
}
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 62 with PipelineInstanceModels

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));
}
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 63 with PipelineInstanceModels

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

Aggregations

PipelineInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels)63 Test (org.junit.Test)59 Username (com.thoughtworks.go.server.domain.Username)18 PipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)15 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)14 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)11 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)9 EmptyPipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.EmptyPipelineInstanceModel)9 TimeProvider (com.thoughtworks.go.util.TimeProvider)9 StageInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels)8 Modification (com.thoughtworks.go.domain.materials.Modification)6 DependencyMaterialRevision (com.thoughtworks.go.domain.materials.dependency.DependencyMaterialRevision)5 StageInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel)5 Date (java.util.Date)5 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)4 PipelineHistoryGroups (com.thoughtworks.go.server.presentation.models.PipelineHistoryGroups)4 HttpOperationResult (com.thoughtworks.go.server.service.result.HttpOperationResult)4 Material (com.thoughtworks.go.domain.materials.Material)3 PipelineNotFoundException (com.thoughtworks.go.config.PipelineNotFoundException)2 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)2