use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class RestfulServiceTest method shouldFindJobByPipelineCounter.
@Test
public void shouldFindJobByPipelineCounter() throws Exception {
Pipeline pipeline = fixture.createdPipelineWithAllStagesPassed();
Stage stage = pipeline.getStages().byName(fixture.devStage);
JobInstance job = stage.getJobInstances().first();
JobIdentifier result = restfulService.findJob(pipeline.getName(), String.valueOf(pipeline.getCounter()), 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 SleepWork method doWork.
@Override
public void doWork(AgentIdentifier agentIdentifier, BuildRepositoryRemote remoteBuildRepository, GoArtifactsManipulator manipulator, EnvironmentVariableContext environmentVariableContext, AgentRuntimeInfo agentRuntimeInfo, PackageRepositoryExtension packageRepositoryExtension, SCMExtension scmExtension, TaskExtension taskExtension) {
cancelLatch = new CountDownLatch(1);
agentRuntimeInfo.busy(new AgentBuildingInfo("sleepwork", "sleepwork1"));
boolean canceled = false;
DefaultGoPublisher goPublisher = new DefaultGoPublisher(manipulator, new JobIdentifier(), remoteBuildRepository, agentRuntimeInfo);
try {
if (this.sleepInMilliSeconds > 0) {
canceled = cancelLatch.await(this.sleepInMilliSeconds, TimeUnit.MILLISECONDS);
}
String result = canceled ? "done_canceled" : "done";
manipulator.setProperty(null, new Property(name + "_result", result));
SystemEnvironment systemEnvironment = new SystemEnvironment();
if (systemEnvironment.isConsoleLogsThroughWebsocketEnabled() && systemEnvironment.isWebsocketsForAgentsEnabled()) {
goPublisher.consumeLine(format("Sleeping for %s milliseconds", this.sleepInMilliSeconds));
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class StageDetailPresentationModel method getIndexPages.
public Map<JobInstance, String> getIndexPages() {
JobInstances nonEmptyIndexPages = stage.getJobInstances().withNonEmptyIndexPages();
Map<JobInstance, String> aggregate = new LinkedHashMap<>();
for (JobInstance job : nonEmptyIndexPages) {
JobIdentifier jobIdentifier = new JobIdentifier(pipeline.getName(), pipeline.getCounter(), pipeline.getLabel(), stage.getName(), String.valueOf(stage.getCounter()), job.getName(), job.getId());
String filePath = job.getTestIndexPage().getPath();
String path = FileUtil.normalizePath(filePath.substring(filePath.indexOf(TEST_OUTPUT_FOLDER)));
aggregate.put(job, baseArtifactUrl(jobIdentifier, path));
}
return aggregate;
}
use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class ArtifactsServiceTest method shouldProvideArtifactUrlForAJob.
@Test
public void shouldProvideArtifactUrlForAJob() throws Exception {
assumeArtifactsRoot(fakeRoot);
ArtifactsService artifactsService = new ArtifactsService(resolverService, stageService, artifactsDirHolder, zipUtil, systemService);
JobIdentifier oldId = new JobIdentifier("cruise", 1, "1.1", "dev", "2", "linux-firefox");
when(resolverService.actualJobIdentifier(oldId)).thenReturn(new JobIdentifier("cruise", 2, "2.2", "functional", "3", "windows-ie"));
String artifactUrl = artifactsService.findArtifactUrl(oldId);
assertThat(artifactUrl, is("/files/cruise/2/functional/3/windows-ie"));
}
use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class ArtifactsServiceTest method shouldUsePipelineCounterAsFolderName.
@Test
public void shouldUsePipelineCounterAsFolderName() throws IllegalArtifactLocationException, IOException {
File artifactsRoot = temporaryFolder.newFolder();
assumeArtifactsRoot(artifactsRoot);
ArtifactsService artifactsService = new ArtifactsService(resolverService, stageService, artifactsDirHolder, zipUtil, systemService);
artifactsService.initialize();
File artifact = artifactsService.findArtifact(new JobIdentifier("cruise", 1, "1.1", "dev", "2", "linux-firefox", null), "pkg.zip");
assertThat(artifact, is(new File(artifactsRoot + "/pipelines/cruise/1/dev/2/linux-firefox/pkg.zip")));
}
Aggregations