use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels 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.StageInstanceModels in project gocd by gocd.
the class PipelineHistoryMother method singlePipeline.
public static PipelineInstanceModel singlePipeline(String pipelineName, StageInstanceModel stage) {
StageInstanceModels stageInstanceModels = new StageInstanceModels();
stageInstanceModels.add(stage);
return singlePipeline(pipelineName, stageInstanceModels, new Date());
}
use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels in project gocd by gocd.
the class PipelineHistoryItemMother method custom.
public static PipelineInstanceModel custom(String... stageNames) {
PipelineInstanceModel pipelineInstanceModel = PipelineInstanceModel.createEmptyModel();
pipelineInstanceModel.setStageHistory(new StageInstanceModels());
for (String stageName : stageNames) {
StageInstanceModel stageHistoryItem = new StageInstanceModel();
stageHistoryItem.setName(stageName);
pipelineInstanceModel.getStageHistory().add(stageHistoryItem);
}
return pipelineInstanceModel;
}
use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels in project gocd by gocd.
the class EnvironmentServiceTest method stubPipelineHistoryServiceToReturnPipelines.
private PipelineInstanceModel stubPipelineHistoryServiceToReturnPipelines(final String pipelineName) {
PipelineInstanceModel pipelineInstanceModel = PipelineInstanceModel.createPipeline(pipelineName, -1, "1", BuildCause.createManualForced(), new StageInstanceModels());
PipelineModel pipelineModel = new PipelineModel(pipelineInstanceModel.getName(), true, true, PipelinePauseInfo.notPaused());
pipelineModel.addPipelineInstance(pipelineInstanceModel);
when(pipelineHistoryService.latestPipelineModel(new Username(new CaseInsensitiveString("Foo")), pipelineName)).thenReturn(pipelineModel);
return pipelineInstanceModel;
}
use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels in project gocd by gocd.
the class PipelineHistoryServiceIntegrationTest method shouldLoadPipelineHistory.
@Test
public void shouldLoadPipelineHistory() throws Exception {
pipelineOne.createdPipelineWithAllStagesPassed();
PipelineInstanceModels history = pipelineHistoryService.load(pipelineOne.pipelineName, Pagination.pageStartingAt(0, 1, 10), "jez", true);
assertThat(history.size(), is(1));
StageInstanceModels stageHistory = history.first().getStageHistory();
assertThat(stageHistory.size(), is(3));
for (StageInstanceModel stageHistoryItem : stageHistory) {
assertThat(stageHistoryItem.isScheduled(), is(true));
assertThat(stageHistoryItem.getCanRun(), is(true));
}
}
Aggregations