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