use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldLoadPipelineHistories.
@Test
public void shouldLoadPipelineHistories() throws Exception {
String dev = "dev";
PipelineConfig mingleConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", dev);
Pipeline mingle = schedulePipelineWithStages(mingleConfig);
Stage firstStage = mingle.getFirstStage();
Pipeline mingle2 = schedulePipelineWithStages(mingleConfig);
JobInstance instance = firstStage.getJobInstances().first();
jobInstanceDao.ignore(instance);
PipelineInstanceModels pipelineHistories = pipelineDao.loadHistory(mingle.getName(), 10, 0);
assertThat(pipelineHistories.size(), is(2));
StageInstanceModels stageHistories = pipelineHistories.first().getStageHistory();
assertThat(stageHistories.size(), is(1));
StageInstanceModel history = stageHistories.first();
assertThat(history.getName(), is(dev));
assertThat(history.getApprovalType(), is(GoConstants.APPROVAL_SUCCESS));
assertThat(history.getBuildHistory().size(), is(2));
assertThat(pipelineHistories.get(1).getName(), is("mingle"));
}
use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldMaintainStageOrderAndHistoryAfterGettingPipelineDependencyGraph.
@Test
public void shouldMaintainStageOrderAndHistoryAfterGettingPipelineDependencyGraph() throws Exception {
PipelineConfig shineConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("shine", "1stStage", "2ndStage");
Pipeline shineInstance = dbHelper.newPipelineWithFirstStageFailed(shineConfig);
dbHelper.scheduleStage(shineInstance, shineConfig.get(1), 1);
PipelineDependencyGraphOld dependencyGraph = pipelineDao.pipelineGraphByNameAndCounter("shine", 1);
assertPipelineEquals(shineInstance, dependencyGraph.pipeline());
StageInstanceModels models = dependencyGraph.pipeline().getStageHistory();
assertThat(models.size(), is(2));
assertThat(models.get(0).getName(), is("1stStage"));
assertThat(models.get(1).getName(), is("2ndStage"));
}
use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels in project gocd by gocd.
the class PipelineHistoryServiceIntegrationTest method shouldLoadPipelineHistoryWithEmptyDefaultIfNone.
@Test
public void shouldLoadPipelineHistoryWithEmptyDefaultIfNone() throws Exception {
configHelper.setViewPermissionForGroup("group1", "jez");
PipelineInstanceModels history = pipelineHistoryService.loadWithEmptyAsDefault(pipelineOne.pipelineName, Pagination.pageStartingAt(0, 1, 1), "jez");
assertThat(history.size(), is(1));
StageInstanceModels stageHistory = history.first().getStageHistory();
assertThat(stageHistory.size(), is(3));
assertStageHistory(stageHistory.get(0), false, true);
assertStageHistory(stageHistory.get(1), false, false);
assertStageHistory(stageHistory.get(2), false, false);
}
use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels in project gocd by gocd.
the class PipelineHistoryServiceIntegrationTest method shouldLoadPipelineHistoryWithPlaceholderStagesPopulated.
@Test
public void shouldLoadPipelineHistoryWithPlaceholderStagesPopulated() throws Exception {
pipelineOne.createPipelineWithFirstStagePassedAndSecondStageHasNotStarted();
PipelineInstanceModels history = pipelineHistoryService.load(pipelineOne.pipelineName, Pagination.pageStartingAt(0, 1, 10), "jez", true);
StageInstanceModels stageHistory = history.first().getStageHistory();
assertThat("Should populate 2 placeholder stages from config", stageHistory.size(), is(3));
assertThat(stageHistory.first().isScheduled(), is(true));
assertThat(stageHistory.first().isAutoApproved(), is(true));
assertThat(stageHistory.first().getCanRun(), is(true));
assertThat(stageHistory.get(1).isScheduled(), is(false));
assertThat(stageHistory.get(1).isAutoApproved(), is(false));
assertThat("The first future stage should can run", stageHistory.get(1).getCanRun(), is(true));
assertThat(stageHistory.get(2).isScheduled(), is(false));
assertThat(stageHistory.get(2).isAutoApproved(), is(true));
assertThat("The second future stage should can not run", stageHistory.get(2).getCanRun(), is(false));
}
use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels in project gocd by gocd.
the class PipelineHistoryServiceIntegrationTest method shouldLoadPipelineHistoryWithPlaceholderStagesPopulated_loadMinimalData.
@Test
public void shouldLoadPipelineHistoryWithPlaceholderStagesPopulated_loadMinimalData() throws Exception {
pipelineOne.createPipelineWithFirstStagePassedAndSecondStageHasNotStarted();
HttpOperationResult result = new HttpOperationResult();
PipelineInstanceModels pipelineInstanceModels = pipelineHistoryService.loadMinimalData(pipelineOne.pipelineName, Pagination.pageStartingAt(0, 1, 10), new Username(new CaseInsensitiveString("admin1")), result);
StageInstanceModels stageHistory = pipelineInstanceModels.first().getStageHistory();
assertThat("Should populate 2 placeholder stages from config", stageHistory.size(), is(3));
assertThat(stageHistory.first().isScheduled(), is(true));
assertThat(stageHistory.first().isAutoApproved(), is(true));
assertThat(stageHistory.first().getCanRun(), is(true));
assertThat(stageHistory.get(1).isScheduled(), is(false));
assertThat(stageHistory.get(1).isAutoApproved(), is(false));
assertThat("The first future stage should can run", stageHistory.get(1).getCanRun(), is(true));
assertThat(stageHistory.get(2).isScheduled(), is(false));
assertThat(stageHistory.get(2).isAutoApproved(), is(true));
assertThat("The second future stage should can not run", stageHistory.get(2).getCanRun(), is(false));
}
Aggregations