use of com.thoughtworks.go.domain.StageIdentifier 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;
}
use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.
the class ShineDao method failedBuildHistoryForStage.
public StageTestRuns failedBuildHistoryForStage(StageIdentifier stageId, LocalizedOperationResult result) {
try {
StageTestRuns stageTestRuns = getTestCount(stageId);
List<StageIdentifier> failedStageIds = stageService.findRunForStage(stageId);
populateFailingTests(stageTestRuns, getFailedTests(failedStageIds));
populateUsers(stageTestRuns, getCommitters(failedStageIds));
stageTestRuns.removeDuplicateTestEntries();
return stageTestRuns;
} catch (RuntimeException e) {
LOGGER.error("can not retrieve shine test history!", e);
result.connectionError(LocalizedMessage.unableToRetrieveFailureResults());
return new StageTestRuns(0, 0, 0);
}
}
use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.
the class MaterialDatabaseDependencyUpdaterTest method stubStageServiceGetHistoryAfter.
private void stubStageServiceGetHistoryAfter(DependencyMaterial material, int pipelineCounter, Stages... stageses) {
if (material == null) {
material = new DependencyMaterial(new CaseInsensitiveString("pipeline-name"), new CaseInsensitiveString("stage-name"));
}
StageIdentifier identifier = new StageIdentifier(String.format("%s/%s/%s/0", material.getPipelineName().toString(), pipelineCounter, material.getStageName().toString()));
for (int i = 0; i < stageses.length; i++) {
Stages stages = stageses[i];
List<Modification> mods = new ArrayList<>();
for (Stage stage : stages) {
StageIdentifier id = stage.getIdentifier();
mods.add(new Modification(stage.completedDate(), id.stageLocator(), id.getPipelineLabel(), stage.getPipelineId()));
}
Mockito.when(dependencyMaterialSourceDao.getPassedStagesAfter(identifier.stageLocator(), material, Pagination.pageStartingAt(i * MaterialDatabaseUpdater.STAGES_PER_PAGE, null, MaterialDatabaseUpdater.STAGES_PER_PAGE))).thenReturn(mods);
}
when(dependencyMaterialSourceDao.getPassedStagesAfter(identifier.stageLocator(), material, Pagination.pageStartingAt(MaterialDatabaseUpdater.STAGES_PER_PAGE * stageses.length, null, MaterialDatabaseUpdater.STAGES_PER_PAGE))).thenReturn(new ArrayList<>());
}
use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.
the class MaterialDatabaseDependencyUpdaterTest method stubStageServiceGetHistory.
private void stubStageServiceGetHistory(DependencyMaterial dependencyMaterial, Stages... stageses) {
if (material == null) {
dependencyMaterial = new DependencyMaterial(new CaseInsensitiveString("pipeline-name"), new CaseInsensitiveString("stage-name"));
}
for (int i = 0; i < stageses.length; i++) {
ArrayList<Modification> mods = new ArrayList<>();
for (Stage stage : stageses[i]) {
StageIdentifier id = stage.getIdentifier();
mods.add(new Modification(stage.completedDate(), id.stageLocator(), id.getPipelineLabel(), stage.getPipelineId()));
}
Mockito.when(dependencyMaterialSourceDao.getPassedStagesByName(dependencyMaterial, Pagination.pageStartingAt(i * MaterialDatabaseUpdater.STAGES_PER_PAGE, null, MaterialDatabaseUpdater.STAGES_PER_PAGE))).thenReturn(mods);
}
Mockito.when(dependencyMaterialSourceDao.getPassedStagesByName(dependencyMaterial, Pagination.pageStartingAt(MaterialDatabaseUpdater.STAGES_PER_PAGE * stageses.length, null, MaterialDatabaseUpdater.STAGES_PER_PAGE))).thenReturn(new ArrayList<>());
}
use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.
the class MaterialDatabaseDependencyUpdaterTest method stage.
private Stage stage(int pipelineCounter) {
Stage stage = new Stage();
stage.setIdentifier(new StageIdentifier("pipeline-name", pipelineCounter, "LABEL-" + pipelineCounter, "stage-name", "0"));
return stage;
}
Aggregations