Search in sources :

Example 31 with PipelineInstanceModel

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

Example 32 with PipelineInstanceModel

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

Example 33 with PipelineInstanceModel

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));
}
Also used : PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) PipelineHistoryGroups(com.thoughtworks.go.server.presentation.models.PipelineHistoryGroups) Test(org.junit.Test)

Example 34 with PipelineInstanceModel

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));
}
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 35 with PipelineInstanceModel

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

Aggregations

PipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)60 Test (org.junit.Test)31 StageInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels)15 PipelineInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels)12 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)11 PipelineModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineModel)9 StageInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel)7 NullStageHistoryItem (com.thoughtworks.go.presentation.pipelinehistory.NullStageHistoryItem)6 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)5 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)5 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)4 PipelineDependencyGraphOld (com.thoughtworks.go.domain.PipelineDependencyGraphOld)4 Modification (com.thoughtworks.go.domain.materials.Modification)4 PipelineHistoryGroups (com.thoughtworks.go.server.presentation.models.PipelineHistoryGroups)4 Matchers.anyString (org.mockito.Matchers.anyString)4 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)3 EmptyPipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.EmptyPipelineInstanceModel)3 TimeProvider (com.thoughtworks.go.util.TimeProvider)3 MingleConfig (com.thoughtworks.go.config.MingleConfig)2 TrackingTool (com.thoughtworks.go.config.TrackingTool)2