use of com.thoughtworks.go.domain.JobInstances in project gocd by gocd.
the class StageSummaryModelTest method shouldRetrivePercentCompleteOnJobs.
@Test
public void shouldRetrivePercentCompleteOnJobs() throws Exception {
JobInstance first = JobInstanceMother.completed("first", JobResult.Failed);
Stage stage = StageMother.custom("pipeline", "stage", new JobInstances(first));
StageSummaryModel model = new StageSummaryModel(stage, new Stages(stage), new JobDurationStrategy.ConstantJobDuration(1000 * 1000), null);
assertThat(model.nonPassedJobs().get(0).getElapsedTime(), is(new Duration(120 * 1000)));
assertThat(model.nonPassedJobs().get(0).getPercentComplete(), is(12));
}
use of com.thoughtworks.go.domain.JobInstances in project gocd by gocd.
the class BuildDetailPageVelocityTemplateTest method createJobDetailModel.
private HashMap<String, Object> createJobDetailModel() {
GitMaterialConfig gitMaterialConfig = gitMaterialConfig();
MaterialRevisions materialRevisions = new MaterialRevisions();
materialRevisions.addRevision(new GitMaterial(gitMaterialConfig), new Modification("Ernest Hemingway <oldman@sea.com>", "comment", "email", new Date(), "12", ""));
Pipeline pipeline = schedule(pipelineConfig("pipeline", new MaterialConfigs(gitMaterialConfig)), createWithModifications(materialRevisions, ""));
JobDetailPresentationModel model = new JobDetailPresentationModel(building("job"), new JobInstances(), null, pipeline, null, new TrackingTool(), mock(ArtifactsService.class), StageMother.custom("stage"));
HashMap<String, Object> data = new HashMap<>();
data.put("presenter", model);
return data;
}
Aggregations