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 RestfulServiceTest method shouldTranslateLatestToRealStageCounter.
@Test
public void shouldTranslateLatestToRealStageCounter() throws Exception {
Pipeline pipeline = fixture.createdPipelineWithAllStagesPassed();
JobIdentifier jobIdentifier = restfulService.findJob(pipeline.getName(), pipeline.getLabel(), fixture.devStage, JobIdentifier.LATEST, PipelineWithTwoStages.JOB_FOR_DEV_STAGE);
assertThat(Integer.valueOf(jobIdentifier.getStageCounter()), is(pipeline.getStages().byName(fixture.devStage).getCounter()));
}
use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class RestfulServiceTest method shouldTranslateLatestToRealPipelineLabel.
@Test
public void shouldTranslateLatestToRealPipelineLabel() throws Exception {
fixture.createdPipelineWithAllStagesPassed();
Pipeline latestPipleine = fixture.createdPipelineWithAllStagesPassed();
JobIdentifier jobIdentifier = restfulService.findJob(latestPipleine.getName(), JobIdentifier.LATEST, fixture.devStage, JobIdentifier.LATEST, PipelineWithTwoStages.JOB_FOR_DEV_STAGE);
assertThat(jobIdentifier.getPipelineLabel(), is(latestPipleine.getLabel()));
}
use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class RestfulServiceTest method shouldReturnJobWithLabelWhenSpecifyPipelineLabel.
@Test
public void shouldReturnJobWithLabelWhenSpecifyPipelineLabel() throws Exception {
configHelper.setPipelineLabelTemplate(fixture.pipelineName, "label-${COUNT}");
Pipeline pipeline = fixture.createdPipelineWithAllStagesPassed();
Stage stage = pipeline.getStages().byName(fixture.devStage);
JobInstance job = stage.getJobInstances().first();
JobIdentifier result = restfulService.findJob(pipeline.getName(), pipeline.getLabel(), stage.getName(), String.valueOf(stage.getCounter()), job.getName(), job.getId());
JobIdentifier expect = new JobIdentifier(pipeline, stage, job);
assertThat(result, is(expect));
}
use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class JobDetailPresentationModelJMockTest method setUp.
@Before
public void setUp() {
stubJobInstance = context.mock(JobInstance.class);
TrackingTool trackingTool = context.mock(TrackingTool.class);
artifactService = context.mock(ArtifactsService.class);
jobIdentifier = new JobIdentifier("pipeline", -1, "1", "stageName", "0", "build", 1L);
context.checking(new Expectations() {
{
allowing(stubJobInstance).getName();
will(returnValue("build"));
allowing(stubJobInstance).getId();
will(returnValue(1L));
allowing(stubJobInstance).getIdentifier();
will(returnValue(jobIdentifier));
}
});
Stage stage = StageMother.custom("stageName", stubJobInstance);
Pipeline pipeline = new Pipeline("pipeline", null, stage);
pipeline.setId(1L);
trackingTool = new TrackingTool();
jobDetailPresenter = new JobDetailPresentationModel(stubJobInstance, null, null, pipeline, new Tabs(), trackingTool, artifactService, new Properties(), null);
testFolder = TestFileUtil.createTempFolder("testFiles");
}
Aggregations