use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel in project gocd by gocd.
the class PipelineHistoryMother method pipelineHistoryItemWithOneStage.
public static PipelineInstanceModel pipelineHistoryItemWithOneStage(String pipelineName, String stageName, Date modifiedDate) {
StageInstanceModels stageHistory = new StageInstanceModels();
stageHistory.add(new StageInstanceModel(stageName, "1", StageResult.Passed, new StageIdentifier(pipelineName, 1, "1", stageName, "1")));
return singlePipeline(pipelineName, stageHistory, modifiedDate);
}
use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel in project gocd by gocd.
the class PipelineHistoryMother method stageHistory.
public static StageInstanceModels stageHistory(PipelineConfig pipelineConfig, Date modificationDate) {
StageInstanceModels history = new StageInstanceModels();
for (StageConfig stageConfig : pipelineConfig) {
StageInstanceModel item = new StageInstanceModel(CaseInsensitiveString.str(stageConfig.name()), "1", buildHistory(stageConfig, modificationDate));
item.setCounter("1");
item.setApprovalType(new InstanceFactory().createStageInstance(stageConfig, new DefaultSchedulingContext("anyone"), md5, new TimeProvider()).getApprovalType());
if (stageConfig.requiresApproval()) {
item.setApprovedBy(APPROVED_BY);
} else {
item.setApprovedBy(GoConstants.DEFAULT_APPROVED_BY);
}
history.add(item);
}
return history;
}
use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel 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.StageInstanceModel in project gocd by gocd.
the class PipelineHistoryItemMother method custom.
public static PipelineInstanceModel custom(StageInstanceModel... stages) {
PipelineInstanceModel pipelineInstanceModel = PipelineInstanceModel.createEmptyModel();
pipelineInstanceModel.setStageHistory(new StageInstanceModels());
for (StageInstanceModel stage : stages) {
pipelineInstanceModel.getStageHistory().add(stage);
}
return pipelineInstanceModel;
}
use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel in project gocd by gocd.
the class PipelineHistoryMother method stagePerJob.
public static StageInstanceModels stagePerJob(String baseName, List<JobHistory> histories) {
StageInstanceModels stageInstanceModels = new StageInstanceModels();
for (int i = 0; i < histories.size(); i++) {
String stageName = baseName + "-" + i;
StageInstanceModel stage = new StageInstanceModel(stageName, "1", StageResult.Passed, new StageIdentifier("pipeline", 1, "1", stageName, "1"));
stage.setBuildHistory(histories.get(i));
stageInstanceModels.add(stage);
stageInstanceModels.latestStage().setApprovedBy("cruise");
}
return stageInstanceModels;
}
Aggregations