use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.
the class LocalDependencyMaterialSourceDao method getPassedStagesAfter.
public List<Modification> getPassedStagesAfter(final String lastRevision, DependencyMaterial material, Pagination pagination) {
StageIdentifier identifier = new StageIdentifier(lastRevision);
List<StageAsDMR> passedStagesAfter = stageDao.getPassedStagesAfter(identifier, pagination.getPageSize(), pagination.getOffset());
List<Modification> mods = new ArrayList<>();
for (StageAsDMR stage : passedStagesAfter) {
StageIdentifier stageIdentifier = stage.getIdentifier();
Modification modification = new Modification(stage.getCompletedDate(), stageIdentifier.stageLocator(), stageIdentifier.getPipelineLabel(), stage.getPipelineId());
mods.add(modification);
}
return mods;
}
use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.
the class LocalDependencyMaterialSourceDao method getPassedStagesByName.
public List<Modification> getPassedStagesByName(DependencyMaterial material, Pagination pagination) {
Stages stages = stageDao.getPassedStagesByName(CaseInsensitiveString.str(material.getPipelineName()), CaseInsensitiveString.str(material.getStageName()), pagination.getPageSize(), pagination.getOffset());
List<Modification> mods = new ArrayList<>();
for (Stage stage : stages) {
StageIdentifier stageIdentifier = stage.getIdentifier();
Modification modification = new Modification(stage.completedDate(), stageIdentifier.stageLocator(), stageIdentifier.getPipelineLabel(), stage.getPipelineId());
mods.add(modification);
}
return mods;
}
use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.
the class ShineDao method failedTestsFor.
public List<TestSuite> failedTestsFor(final StageIdentifier stageId) {
StageTestRuns stageTestRuns = getTestCount(stageId);
final List<StageIdentifier> stageIdentifierList = Arrays.asList(stageId);
populateFailingTests(stageTestRuns, getFailedTests(stageIdentifierList));
populateUsers(stageTestRuns, getCommitters(stageIdentifierList));
return stageTestRuns.failingTestSuitesForNthPipelineRun(0);
}
use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.
the class ScheduleServiceStageTriggerTest method shouldNotNotifyListenersForWhenCancelStageTransactionRollsback.
@Test
public void shouldNotNotifyListenersForWhenCancelStageTransactionRollsback() throws Exception {
Pipeline oldest = preCondition.createPipelineWithFirstStagePassedAndSecondStageRunning();
preCondition.createPipelineWithFirstStagePassedAndSecondStageHasNotStarted();
preCondition.createPipelineWithFirstStagePassedAndSecondStageHasNotStarted();
final Stage stage = oldest.getStages().byName(preCondition.ftStage);
final StageIdentifier identifier = stage.getIdentifier();
StageStatusTopic stageStatusTopic = mock(StageStatusTopic.class);
JobResultTopic jobResultTopic = mock(JobResultTopic.class);
StageStatusListener stageStatusListener = mock(StageStatusListener.class);
JobInstanceService jobInstanceService = jobInstanceService(jobResultTopic);
StageService stageService = new StageService(stageDao, jobInstanceService, stageStatusTopic, stageStatusCache, securityService, pipelineDao, changesetService, goConfigService, transactionTemplate, transactionSynchronizationManager, goCache, stageStatusListener);
SchedulingPerformanceLogger schedulingPerformanceLogger = mock(SchedulingPerformanceLogger.class);
scheduleService = new ScheduleService(goConfigService, pipelineService, stageService, schedulingCheckerService, pipelineScheduledTopic, pipelineDao, stageDao, stageOrderService, securityService, pipelineScheduleQueue, this.jobInstanceService, jobInstanceDao, agentAssignment, environmentConfigService, pipelineLockService, serverHealthService, transactionTemplate, null, transactionSynchronizationManager, null, null, null, null, schedulingPerformanceLogger, null);
try {
transactionTemplate.executeWithExceptionHandling(new TransactionCallback() {
@Override
public Object doInTransaction(TransactionStatus status) throws Exception {
scheduleService.cancelAndTriggerRelevantStages(stage.getId(), null, null);
throw new GoUnauthorizedException();
}
});
} catch (Exception e) {
//ignore
}
verify(stageStatusTopic, never()).post(any(StageStatusMessage.class));
verify(jobResultTopic, never()).post(any(JobResultMessage.class));
verify(stageStatusListener, never()).stageStatusChanged(any(Stage.class));
}
use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.
the class PipelineDependencyGraphOldTest method shouldShouldbeAbleToTellIfUpStreamMaterialIsAvailableForTrigger.
@Test
public void shouldShouldbeAbleToTellIfUpStreamMaterialIsAvailableForTrigger() throws Exception {
StageInstanceModels stages = new StageInstanceModels();
stages.add(new StageInstanceModel("stage-0", "21", StageResult.Cancelled, new StageIdentifier("blahUpStream", 23, "stage-0", "21")));
PipelineInstanceModel upStream = PipelineHistoryMother.singlePipeline("blahUpStream", stages);
PipelineInstanceModel down1 = pim("blahDown1");
down1.setMaterialConfigs(new MaterialConfigs(dependencyMaterialConfig("blahUpStream", "stage-1")));
PipelineDependencyGraphOld graph = new PipelineDependencyGraphOld(upStream, PipelineInstanceModels.createPipelineInstanceModels(down1));
assertThat(graph.hasUpStreamRevisionFor(down1), is(false));
}
Aggregations