Search in sources :

Example 31 with PipelineInstanceModels

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels 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 32 with PipelineInstanceModels

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.

the class PipelineHistoryServiceIntegrationTest method shouldOnlyLoadPipelinesThatTheUserHasAcessTo.

@Test
public void shouldOnlyLoadPipelinesThatTheUserHasAcessTo() throws Exception {
    Pipeline pipeline = pipelineOne.createdPipelineWithAllStagesPassed();
    configHelper.setViewPermissionForGroup("group1", "anyone");
    PipelineInstanceModels history = pipelineHistoryService.findPipelineInstances(pipelineOne.pipelineName, "latest", 3, "anyone");
    assertThat(history.get(0).getName(), is(pipeline.getName()));
    assertThat(history.get(0).getLabel(), is(pipeline.getLabel()));
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) Test(org.junit.Test)

Example 33 with PipelineInstanceModels

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.

the class PipelineHistoryServiceIntegrationTest method shouldMakePipelineInstanceCanRunFalseWhenDiskSpaceIsEmpty.

@Test
public void shouldMakePipelineInstanceCanRunFalseWhenDiskSpaceIsEmpty() throws Exception {
    diskIsFull.onSetUp();
    configHelper.updateArtifactRoot(TestFileUtil.createTempFolder("serverlogs").getAbsolutePath());
    pipelineOne.createdPipelineWithAllStagesPassed();
    PipelineInstanceModels history = pipelineHistoryService.load(pipelineOne.pipelineName, Pagination.pageStartingAt(0, 1, 10), "jez", true);
    assertThat(history.size(), is(1));
    assertThat(history.first().getCanRun(), is(false));
    StageInstanceModels stageHistory = history.first().getStageHistory();
    assertThat(stageHistory.size(), is(3));
    for (StageInstanceModel stageHistoryItem : stageHistory) {
        assertThat(stageHistoryItem.isScheduled(), is(true));
        assertThat(stageHistoryItem.getCanRun(), is(false));
    }
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) StageInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel) Test(org.junit.Test)

Example 34 with PipelineInstanceModels

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.

the class PipelineHistoryServiceIntegrationTest method shouldSetCanRunWhenFirstStageIsManuallyTriggerable.

@Test
public void shouldSetCanRunWhenFirstStageIsManuallyTriggerable() throws Exception {
    configHelper.setViewPermissionForGroup(pipelineOne.groupName, "jez");
    pipelineOne.createPipelineWithFirstStageScheduled();
    pipelineOne.moveStageToEnd(CaseInsensitiveString.str(pipelineOne.stageConfig(1).name()));
    PipelineInstanceModels pipelineInstanceModels = pipelineHistoryService.findPipelineInstances(pipelineOne.pipelineName, "latest", 1, "jez");
    assertThat(pipelineInstanceModels.get(0).getCanRun(), is(true));
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) Test(org.junit.Test)

Example 35 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)

Aggregations

PipelineInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels)45 Test (org.junit.Test)37 PipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)12 StageInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels)8 PipelineInstanceModels.createPipelineInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels.createPipelineInstanceModels)4 StageInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel)4 PipelineHistoryGroups (com.thoughtworks.go.server.presentation.models.PipelineHistoryGroups)4 EmptyPipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.EmptyPipelineInstanceModel)3 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)2 PipelineNotFoundException (com.thoughtworks.go.config.PipelineNotFoundException)2 Permissions (com.thoughtworks.go.config.security.Permissions)2 Modification (com.thoughtworks.go.domain.materials.Modification)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 Matchers.anyString (org.mockito.Matchers.anyString)2 SqlMapClientTemplate (org.springframework.orm.ibatis.SqlMapClientTemplate)2 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)1 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)1 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)1 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)1 PipelineDependencyGraphOld (com.thoughtworks.go.domain.PipelineDependencyGraphOld)1