use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class ArtifactsServiceTest method shouldProvideArtifactRootForAJobOnWindows.
@Test
@RunIf(value = EnhancedOSChecker.class, arguments = { EnhancedOSChecker.WINDOWS })
public void shouldProvideArtifactRootForAJobOnWindows() throws Exception {
assumeArtifactsRoot(fakeRoot);
ArtifactsService artifactsService = new ArtifactsService(resolverService, stageService, artifactsDirHolder, zipUtil, systemService);
artifactsService.initialize();
JobIdentifier oldId = new JobIdentifier("cruise", 1, "1.1", "dev", "2", "linux-firefox", null);
when(resolverService.actualJobIdentifier(oldId)).thenReturn(new JobIdentifier("cruise", 1, "1.1", "dev", "2", "linux-firefox", null));
String artifactRoot = artifactsService.findArtifactRoot(oldId);
assertThat(artifactRoot, is("pipelines\\cruise\\1\\dev\\2\\linux-firefox"));
}
use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class ArtifactsServiceTest method shouldUsePipelineLabelAsFolderNameIfNoCounter.
@Test
public void shouldUsePipelineLabelAsFolderNameIfNoCounter() throws IllegalArtifactLocationException, IOException {
File artifactsRoot = temporaryFolder.newFolder();
assumeArtifactsRoot(artifactsRoot);
willCleanUp(artifactsRoot);
ArtifactsService artifactsService = new ArtifactsService(resolverService, stageService, artifactsDirHolder, zipUtil, systemService);
artifactsService.initialize();
File artifact = artifactsService.findArtifact(new JobIdentifier("cruise", -2, "1.1", "dev", "2", "linux-firefox", null), "pkg.zip");
assertThat(artifact, is(new File(artifactsRoot, "pipelines/cruise/1.1/dev/2/linux-firefox/pkg.zip")));
}
use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class JobResolverServiceTest method shouldLoadActualIdentifierForGivenJobIdentifier.
@Test
public void shouldLoadActualIdentifierForGivenJobIdentifier() {
JobIdentifier oldId = new JobIdentifier("pipeline-name", 10, "label-10", "stage-name", "2", "build-name", 17l);
JobIdentifier idFoundByDao = new JobIdentifier("pipeline-name", 5, "label-5", "stage-name", "1", "build-name", 12l);
when(jobDao.findOriginalJobIdentifier(oldId.getStageIdentifier(), "build-name")).thenReturn(idFoundByDao);
JobIdentifier actualId = jobResolverService.actualJobIdentifier(oldId);
assertThat(actualId, is(idFoundByDao));
}
use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class JobStatusJsonPresentationModelTest method shouldEncodeBuildLocator.
@Test
public void shouldEncodeBuildLocator() throws Exception {
JobInstance instance = JobInstanceMother.completed("job-%", JobResult.Passed);
instance.setIdentifier(new JobIdentifier("cruise-%", 1, "label-1", "dev-%", "1", "job-%", -1L));
JobStatusJsonPresentationModel presenter = new JobStatusJsonPresentationModel(instance);
Map json = presenter.toJsonHash();
assertThat(JsonUtils.from(json).getString("buildLocator"), is("cruise-%25/1/dev-%25/1/job-%25"));
}
use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class JobStatusJsonPresentationModelTest method shouldIncludeBuildLocatorForDisplay.
@Test
public void shouldIncludeBuildLocatorForDisplay() throws Exception {
JobInstance instance = JobInstanceMother.completed("job-%", JobResult.Passed);
instance.setIdentifier(new JobIdentifier("cruise-%", 1, "label-1", "dev-%", "1", "job-%", -1L));
JobStatusJsonPresentationModel presenter = new JobStatusJsonPresentationModel(instance);
Map json = presenter.toJsonHash();
assertThat(JsonUtils.from(json).getString("buildLocatorForDisplay"), is("cruise-%/label-1/dev-%/1/job-%"));
}
Aggregations