use of com.thoughtworks.go.presentation.pipelinehistory.StageHistoryEntry in project gocd by gocd.
the class StageServiceIntegrationTest method shouldGetStageHistoryForCurrentPage.
@Test
public void shouldGetStageHistoryForCurrentPage() {
StageHistoryEntry[] stages = createFiveStages();
StageHistoryPage history = stageService.findStageHistoryPage(stageService.stageById(stages[2].getId()), 3);
assertThat("Found " + history, history.getPagination(), is(Pagination.pageStartingAt(0, 5, 3)));
assertThat("Found " + history, history.getStages().size(), is(3));
assertThat("Found " + history, history.getStages().get(0), is(stages[4]));
assertThat("Found " + history, history.getStages().get(1), is(stages[3]));
assertThat("Found " + history, history.getStages().get(2), is(stages[2]));
}
use of com.thoughtworks.go.presentation.pipelinehistory.StageHistoryEntry in project gocd by gocd.
the class StageServiceIntegrationTest method createFiveStages.
private StageHistoryEntry[] createFiveStages() {
Stage[] stages = new Stage[5];
stages[0] = savedPipeline.getFirstStage();
for (int i = 1; i < stages.length; i++) {
DefaultSchedulingContext ctx = new DefaultSchedulingContext("anonumous");
StageConfig stageCfg = pipelineConfig.first();
stages[i] = i % 2 == 0 ? instanceFactory.createStageInstance(stageCfg, ctx, md5, new TimeProvider()) : instanceFactory.createStageForRerunOfJobs(stages[i - 1], a("unit", "blah"), ctx, stageCfg, new TimeProvider(), "md5");
stageService.save(savedPipeline, stages[i]);
}
StageHistoryEntry[] entries = new StageHistoryEntry[5];
for (int i = 0; i < stages.length; i++) {
entries[i] = new StageHistoryEntry(stages[i], pipelineDao.loadHistory(savedPipeline.getId()).getNaturalOrder(), stages[i].getRerunOfCounter());
}
return entries;
}
Aggregations