use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class PropertiesServiceTest method shouldLoadOriginalJobPropertiesForGivenJobIdentifier.
@Test
public void shouldLoadOriginalJobPropertiesForGivenJobIdentifier() {
Properties props = new Properties(new Property("a", "1"), new Property("b", "2"));
PropertyDao propertyDao = mock(PropertyDao.class);
JobResolverService resolver = mock(JobResolverService.class);
PropertiesService service = new PropertiesService(propertyDao, null, null, resolver);
JobIdentifier oldId = new JobIdentifier("pipeline-name", 10, "label-10", "stage-name", "3", "job-name", 9l);
when(propertyDao.list(6l)).thenReturn(props);
when(resolver.actualJobIdentifier(oldId)).thenReturn(new JobIdentifier("pipeline-name", 7, "label-7", "stage-name", "1", "job-name", 6l));
assertThat(service.getPropertiesForOriginalJob(oldId), is(props));
}
use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class ArtifactsController method consoleout.
/* Other URLs */
@RequestMapping(value = "/**/consoleout.json", method = RequestMethod.GET)
public ModelAndView consoleout(@RequestParam("pipelineName") String pipelineName, @RequestParam("pipelineLabel") String counterOrLabel, @RequestParam("stageName") String stageName, @RequestParam("buildName") String buildName, @RequestParam(value = "stageCounter", required = false) String stageCounter, @RequestParam(value = "startLineNumber", required = false) Integer start) throws Exception {
int startLine = start == null ? 0 : start;
try {
JobIdentifier identifier = restfulService.findJob(pipelineName, counterOrLabel, stageName, stageCounter, buildName);
ConsoleOut consoleOut = consoleService.getConsoleOut(identifier, startLine);
return new ModelAndView(new ConsoleOutView(consoleOut.calculateNextStart(), consoleOut.output()));
} catch (FileNotFoundException e) {
return new ModelAndView(new ConsoleOutView(0, ""));
} catch (Exception e) {
return buildNotFound(pipelineName, counterOrLabel, stageName, stageCounter, buildName);
}
}
use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class FetchTaskBuilder method createBuilder.
@Override
public Builder createBuilder(BuilderFactory builderFactory, FetchTask task, Pipeline pipeline, UpstreamPipelineResolver resolver) {
JobIdentifier fetchFrom = resolveTargetJob(task, pipeline, resolver);
Builder cancelBuilder = builderFactory.builderFor(task.cancelTask(), pipeline, resolver);
return new FetchArtifactBuilder(task.getConditions(), cancelBuilder, task.describe(), fetchFrom, task.getSrc(), task.getDest(), getHandler(task, pipeline.getName()), getChecksumHandler(task, pipeline.getName()));
}
use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class JobStatusCacheTest method jobInstance.
private JobInstance jobInstance(String jobConfigName) {
JobInstance instance = JobInstanceMother.scheduled(jobConfigName);
instance.setIdentifier(new JobIdentifier("cruise", 1, "1", "dev", "1", jobConfigName));
return instance;
}
use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class RestfulServiceTest method shouldTranslateEmtpyToLatestStageCounter.
@Test
public void shouldTranslateEmtpyToLatestStageCounter() throws Exception {
Pipeline pipeline = fixture.createdPipelineWithAllStagesPassed();
JobIdentifier jobIdentifier = restfulService.findJob(pipeline.getName(), pipeline.getLabel(), fixture.devStage, "", PipelineWithTwoStages.JOB_FOR_DEV_STAGE);
assertThat(Integer.valueOf(jobIdentifier.getStageCounter()), is(pipeline.getStages().byName(fixture.devStage).getCounter()));
}
Aggregations