Search in sources :

Example 16 with JobInstances

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));
}
Also used : JobInstance(com.thoughtworks.go.domain.JobInstance) Stages(com.thoughtworks.go.domain.Stages) Stage(com.thoughtworks.go.domain.Stage) JobDurationStrategy(com.thoughtworks.go.server.domain.JobDurationStrategy) Duration(org.joda.time.Duration) JobInstances(com.thoughtworks.go.domain.JobInstances) Test(org.junit.jupiter.api.Test)

Example 17 with JobInstances

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;
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) ArtifactsService(com.thoughtworks.go.server.service.ArtifactsService) GitMaterial(com.thoughtworks.go.config.materials.git.GitMaterial) HashMap(java.util.HashMap) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) JobDetailPresentationModel(com.thoughtworks.go.server.presentation.models.JobDetailPresentationModel) Matchers.containsString(org.hamcrest.Matchers.containsString) Date(java.util.Date) TrackingTool(com.thoughtworks.go.config.TrackingTool) Pipeline(com.thoughtworks.go.domain.Pipeline) JobInstances(com.thoughtworks.go.domain.JobInstances) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig)

Aggregations

JobInstances (com.thoughtworks.go.domain.JobInstances)17 JobInstance (com.thoughtworks.go.domain.JobInstance)12 Test (org.junit.jupiter.api.Test)10 Stage (com.thoughtworks.go.domain.Stage)6 Stages (com.thoughtworks.go.domain.Stages)5 Pipeline (com.thoughtworks.go.domain.Pipeline)3 JobInstanceModel (com.thoughtworks.go.server.ui.JobInstanceModel)2 Agent (com.thoughtworks.go.config.Agent)1 TrackingTool (com.thoughtworks.go.config.TrackingTool)1 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)1 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)1 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)1 AgentInstance (com.thoughtworks.go.domain.AgentInstance)1 DirectoryEntries (com.thoughtworks.go.domain.DirectoryEntries)1 FolderDirectoryEntry (com.thoughtworks.go.domain.FolderDirectoryEntry)1 JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)1 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)1 PipelineRunIdInfo (com.thoughtworks.go.domain.PipelineRunIdInfo)1 Modification (com.thoughtworks.go.domain.materials.Modification)1 JobDurationStrategy (com.thoughtworks.go.server.domain.JobDurationStrategy)1