use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.
the class RestfulServiceTest method shouldReturnLatestJobWhenMultiplePipelinesWithSameLabel.
@Test
public void shouldReturnLatestJobWhenMultiplePipelinesWithSameLabel() throws Exception {
configHelper.setPipelineLabelTemplate(fixture.pipelineName, "label-${COUNT}");
Pipeline pipeline = fixture.createdPipelineWithAllStagesPassed();
Pipeline newPipeline = createPipelineWithSameLabelButNoCounter(pipeline);
Stage stage = newPipeline.getStages().byName(fixture.devStage);
JobInstance job = stage.getJobInstances().first();
JobIdentifier result = restfulService.findJob(newPipeline.getName(), newPipeline.getLabel(), stage.getName(), String.valueOf(stage.getCounter()), job.getName(), null);
JobIdentifier expect = new JobIdentifier(pipeline, stage, job);
assertThat(result, is(expect));
}
use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.
the class RestfulServiceTest method shouldReturnJobWithJobIdWhenSpecifyPipelineCounter.
@Test
public void shouldReturnJobWithJobIdWhenSpecifyPipelineCounter() throws Exception {
configHelper.setPipelineLabelTemplate(fixture.pipelineName, "label-${COUNT}");
Pipeline oldPipeline = fixture.createdPipelineWithAllStagesPassed();
fixture.createdPipelineWithAllStagesPassed();
Stage stage = oldPipeline.getStages().byName(fixture.devStage);
JobInstance job = stage.getJobInstances().first();
JobIdentifier result = restfulService.findJob(oldPipeline.getName(), String.valueOf(oldPipeline.getCounter()), stage.getName(), String.valueOf(stage.getCounter()), job.getName(), null);
JobIdentifier expect = new JobIdentifier(oldPipeline, stage, job);
assertThat(result, is(expect));
}
use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.
the class RestfulServiceTest method canSupportQueryingUsingStageNameWithDifferentCase.
@Test
public void canSupportQueryingUsingStageNameWithDifferentCase() throws Exception {
Pipeline pipeline = fixture.createdPipelineWithAllStagesPassed();
JobIdentifier jobIdentifier = restfulService.findJob(pipeline.getName(), pipeline.getLabel(), fixture.devStage.toUpperCase(), "", PipelineWithTwoStages.JOB_FOR_DEV_STAGE);
assertThat(jobIdentifier.getStageName(), is(fixture.devStage));
}
use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.
the class ScheduleServiceCachedIntegrationTest method shouldUseLatestStageStateInsteadOfCachedWhenScheduling.
@Test
public // #2296
void shouldUseLatestStageStateInsteadOfCachedWhenScheduling() throws Exception {
assertThat(currentActivityService.isStageActive(preCondition.pipelineName, preCondition.devStage), is(false));
Pipeline pipeline0 = pipelineService.mostRecentFullPipelineByName(preCondition.pipelineName);
Pipeline pipeline1 = tryToScheduleAPipeline();
assertThat("we should be able to schedule a pipeline when its first stage is inactive", pipeline0.getId(), is(not(pipeline1.getId())));
Pipeline pipeline2 = tryToScheduleAPipeline();
assertThat("we should NOT schedule the pipeline again when its first stage is active", pipeline2.getId(), is(pipeline1.getId()));
}
use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.
the class ScheduleServiceStageTriggerTest method cancelCurrentStageShouldTriggerSameStageInMostRecentPipeline.
@Test
public void cancelCurrentStageShouldTriggerSameStageInMostRecentPipeline() throws Exception {
Pipeline oldest = preCondition.createPipelineWithFirstStagePassedAndSecondStageRunning();
preCondition.createPipelineWithFirstStagePassedAndSecondStageHasNotStarted();
preCondition.createPipelineWithFirstStagePassedAndSecondStageHasNotStarted();
long cancelledStageId = oldest.getStages().byName(preCondition.ftStage).getId();
scheduleService.cancelAndTriggerRelevantStages(cancelledStageId, null, null);
Pipeline mostRecent = pipelineService.mostRecentFullPipelineByName(preCondition.pipelineName);
Stage cancelledStage = stageService.stageById(cancelledStageId);
assertThat(cancelledStage.stageState(), is(StageState.Cancelled));
assertThat(mostRecent.getStages().byName(preCondition.ftStage).stageState(), is(StageState.Building));
}
Aggregations