Search in sources :

Example 26 with JobInstance

use of com.thoughtworks.go.domain.JobInstance in project gocd by gocd.

the class StageConverter method createStageDTO.

private StageNotificationDTO.StageDTO createStageDTO() {
    ArrayList<StageNotificationDTO.JobDTO> jobs = new ArrayList<>();
    for (JobInstance job : stage.getJobInstances()) {
        StageNotificationDTO.JobDTO jobDTO = new StageNotificationDTO.JobDTO(job.getName(), job.getScheduledDate(), job.getCompletedDate(), job.getState(), job.getResult(), job.getAgentUuid());
        jobs.add(jobDTO);
    }
    return new StageNotificationDTO.StageDTO(stage.getName(), stage.getCounter(), stage.getApprovalType(), stage.getApprovedBy(), stage.getState(), stage.getResult(), stage.getCreatedTime(), stage.getLastTransitionedTime(), jobs);
}
Also used : JobInstance(com.thoughtworks.go.domain.JobInstance) ArrayList(java.util.ArrayList)

Example 27 with JobInstance

use of com.thoughtworks.go.domain.JobInstance in project gocd by gocd.

the class StageConverter method createStageDTO.

private StageNotificationDTO.StageDTO createStageDTO() {
    ArrayList<StageNotificationDTO.JobDTO> jobs = new ArrayList<>();
    for (JobInstance job : stage.getJobInstances()) {
        StageNotificationDTO.JobDTO jobDTO = new StageNotificationDTO.JobDTO(job.getName(), job.getScheduledDate(), job.getAssignedDate(), job.getCompletedDate(), job.getState(), job.getResult(), job.getAgentUuid());
        jobs.add(jobDTO);
    }
    return new StageNotificationDTO.StageDTO(stage.getName(), stage.getCounter(), stage.getApprovalType(), stage.getApprovedBy(), stage.getState(), stage.getResult(), stage.getCreatedTime(), stage.getLastTransitionedTime(), jobs);
}
Also used : JobInstance(com.thoughtworks.go.domain.JobInstance) ArrayList(java.util.ArrayList)

Example 28 with JobInstance

use of com.thoughtworks.go.domain.JobInstance in project gocd by gocd.

the class StageConverter method createStageDTO.

private StageNotificationDTO.StageDTO createStageDTO() {
    ArrayList<StageNotificationDTO.JobDTO> jobs = new ArrayList<>();
    for (JobInstance job : stage.getJobInstances()) {
        StageNotificationDTO.JobDTO jobDTO = new StageNotificationDTO.JobDTO(job.getName(), DateUtil.dateToString(job.getScheduledDate()), DateUtil.dateToString(job.getAssignedDate()), DateUtil.dateToString(job.getCompletedDate()), job.getState(), job.getResult(), job.getAgentUuid());
        jobs.add(jobDTO);
    }
    return new StageNotificationDTO.StageDTO(stage.getName(), stage.getCounter(), stage.getApprovalType(), stage.getApprovedBy(), stage.getState(), stage.getResult(), DateUtil.dateToString(stage.getCreatedTime()), DateUtil.dateToString(stage.getLastTransitionedTime()), jobs);
}
Also used : JobInstance(com.thoughtworks.go.domain.JobInstance) ArrayList(java.util.ArrayList)

Example 29 with JobInstance

use of com.thoughtworks.go.domain.JobInstance in project gocd by gocd.

the class ScheduleServiceRescheduleHungJobsTest method shouldRescheduleHungBuildForDeadAgent.

@Test
public void shouldRescheduleHungBuildForDeadAgent() {
    final JobInstance jobInstance = JobInstanceMother.assigned("dev");
    when(agentService.findRegisteredAgents()).thenReturn(activities());
    when(jobInstanceService.findHungJobs(Arrays.asList("uuid1", "uuid2"))).thenReturn(new JobInstances(jobInstance));
    scheduleService.rescheduleHungJobs();
    verify(agentService).findRegisteredAgents();
    verify(jobInstanceService).findHungJobs(Arrays.asList("uuid1", "uuid2"));
}
Also used : JobInstance(com.thoughtworks.go.domain.JobInstance) JobInstances(com.thoughtworks.go.domain.JobInstances) Test(org.junit.Test)

Example 30 with JobInstance

use of com.thoughtworks.go.domain.JobInstance in project gocd by gocd.

the class PipelineBuilder method addJob.

public void addJob(String jobName) {
    JobInstance instance = new JobInstance(jobName, new TimeProvider());
    currentStage().getJobInstances().add(instance);
}
Also used : TimeProvider(com.thoughtworks.go.util.TimeProvider) JobInstance(com.thoughtworks.go.domain.JobInstance)

Aggregations

JobInstance (com.thoughtworks.go.domain.JobInstance)82 Test (org.junit.Test)56 Stage (com.thoughtworks.go.domain.Stage)16 JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)15 Pipeline (com.thoughtworks.go.domain.Pipeline)15 JobInstances (com.thoughtworks.go.domain.JobInstances)12 JobConfigIdentifier (com.thoughtworks.go.domain.JobConfigIdentifier)7 Agent (com.thoughtworks.go.server.domain.Agent)6 Gson (com.google.gson.Gson)5 Stages (com.thoughtworks.go.domain.Stages)5 Map (java.util.Map)5 DurationBean (com.thoughtworks.go.dto.DurationBean)4 DateTime (org.joda.time.DateTime)4 ArtifactPropertiesGenerator (com.thoughtworks.go.config.ArtifactPropertiesGenerator)3 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)3 Resource (com.thoughtworks.go.config.Resource)3 DirectoryEntries (com.thoughtworks.go.domain.DirectoryEntries)3 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)3 ProjectStatus (com.thoughtworks.go.domain.activity.ProjectStatus)3 JobInstanceModel (com.thoughtworks.go.server.ui.JobInstanceModel)3