use of com.thoughtworks.go.dto.DurationBeans in project gocd by gocd.
the class StageJsonPresentationModelTest method shouldGetAPresenterWithLabelAndRelevantBuildPlans.
@Test
public void shouldGetAPresenterWithLabelAndRelevantBuildPlans() throws Exception {
DurationBeans durations = new DurationBeans(new DurationBean(stage.getJobInstances().getByName("job-that-will-fail").getId(), 12L));
StageJsonPresentationModel presenter = new StageJsonPresentationModel(pipeline, stage, null, agentService, durations, new TrackingTool());
Map json = presenter.toJson();
JSONAssert.assertEquals("{\n" + " \"stageName\": \"stage\",\n" + " \"builds\": [\n" + " {\n" + " \"name\": \"job-that-will-fail\",\n" + " \"last_build_duration\": \"12\"\n" + " },\n" + " {\n" + " \"name\": \"job-that-will-pass\"\n" + " },\n" + " {\n" + " \"name\": \"scheduledBuild\"\n" + " }\n" + " ],\n" + " \"current_label\": \"10\",\n" + " \"id\": \"1\"\n" + "}", new Gson().toJson(json), false);
assertFalse("JSON shouldn't contain last_successful_label", json.toString().contains("last_successful_label"));
}
use of com.thoughtworks.go.dto.DurationBeans in project gocd by gocd.
the class CachedCurrentActivityService method stageModel.
private StageJsonPresentationModel stageModel(Pipeline currentPipeline, Stage stage) {
StageIdentifier lastSuccessfulPipelineForStage = pipelineService.findLastSuccessfulStageIdentifier(currentPipeline.getName(), stage.getName());
final DurationBeans durations = stageService.getBuildDurations(currentPipeline.getName(), stage);
TrackingTool trackingTool = goConfigService.pipelineConfigNamed(new CaseInsensitiveString(currentPipeline.getName())).trackingTool();
return new StageJsonPresentationModel(currentPipeline, stage, lastSuccessfulPipelineForStage, agentService, durations, trackingTool);
}
Aggregations