use of com.thoughtworks.go.server.dao.PipelineDao in project gocd by gocd.
the class PipelineServiceTriangleDependencyTest method stubPipelineSaveForStatusListener.
private Pipeline stubPipelineSaveForStatusListener(StageStatusListener stageStatusListener, JobStatusListener jobStatusListener) {
StageDao stageDao = mock(StageDao.class);
ServerHealthService serverHealthService = mock(ServerHealthService.class);
when(serverHealthService.getAllLogs()).thenReturn(new ServerHealthStates());
JobInstanceService jobInstanceService = new JobInstanceService(mock(JobInstanceDao.class), mock(PropertiesService.class), mock(JobResultTopic.class), mock(JobStatusCache.class), actualTransactionTemplate, transactionSynchronizationManager, null, null, goConfigService, null, pluginManager, serverHealthService, jobStatusListener);
StageService stageService = new StageService(stageDao, jobInstanceService, mock(StageStatusTopic.class), mock(StageStatusCache.class), mock(SecurityService.class), mock(PipelineDao.class), mock(ChangesetService.class), mock(GoConfigService.class), actualTransactionTemplate, transactionSynchronizationManager, goCache);
Stage savedStage = StageMother.passedStageInstance("stage", "job", "pipeline-name");
when(stageDao.save(any(Pipeline.class), any(Stage.class))).thenReturn(savedStage);
stageService.addStageStatusListener(stageStatusListener);
service = new PipelineService(pipelineDao, stageService, mock(PipelineLockService.class), pipelineTimeline, materialRepository, actualTransactionTemplate, systemEnvironment, null, materialConfigConverter);
Pipeline pipeline = PipelineMother.pipeline("cruise", savedStage);
when(pipelineDao.save(pipeline)).thenReturn(pipeline);
when(pipelineTimeline.pipelineBefore(anyLong())).thenReturn(9L);
when(pipelineTimeline.pipelineAfter(pipeline.getId())).thenReturn(-1L);
when(materialRepository.findMaterialRevisionsForPipeline(9L)).thenReturn(MaterialRevisions.EMPTY);
return pipeline;
}
use of com.thoughtworks.go.server.dao.PipelineDao in project gocd by gocd.
the class PipelineServiceTest method stubPipelineSaveForStatusListener.
private Pipeline stubPipelineSaveForStatusListener(StageStatusListener stageStatusListener, JobStatusListener jobStatusListener) {
StageDao stageDao = mock(StageDao.class);
ServerHealthService serverHealthService = mock(ServerHealthService.class);
when(serverHealthService.getAllLogs()).thenReturn(new ServerHealthStates());
JobInstanceService jobInstanceService = new JobInstanceService(mock(JobInstanceDao.class), mock(PropertiesService.class), mock(JobResultTopic.class), mock(JobStatusCache.class), actualTransactionTemplate, transactionSynchronizationManager, null, null, goConfigService, null, pluginManager, serverHealthService, jobStatusListener);
StageService stageService = new StageService(stageDao, jobInstanceService, mock(StageStatusTopic.class), mock(StageStatusCache.class), mock(SecurityService.class), mock(PipelineDao.class), mock(ChangesetService.class), mock(GoConfigService.class), actualTransactionTemplate, transactionSynchronizationManager, goCache);
Stage savedStage = StageMother.passedStageInstance("stage", "job", "pipeline-name");
when(stageDao.save(any(Pipeline.class), any(Stage.class))).thenReturn(savedStage);
stageService.addStageStatusListener(stageStatusListener);
service = new PipelineService(pipelineDao, stageService, mock(PipelineLockService.class), pipelineTimeline, materialRepository, actualTransactionTemplate, systemEnvironment, null, materialConfigConverter);
Pipeline pipeline = PipelineMother.pipeline("cruise", savedStage);
when(pipelineDao.save(pipeline)).thenReturn(pipeline);
when(pipelineTimeline.pipelineBefore(anyLong())).thenReturn(9L);
when(pipelineTimeline.pipelineAfter(pipeline.getId())).thenReturn(-1L);
when(materialRepository.findMaterialRevisionsForPipeline(9L)).thenReturn(MaterialRevisions.EMPTY);
return pipeline;
}
use of com.thoughtworks.go.server.dao.PipelineDao in project gocd by gocd.
the class StageServiceTest method setUp.
@Before
public void setUp() throws Exception {
stageDao = mock(StageDao.class);
pipelineDao = mock(PipelineDao.class);
jobInstanceService = mock(JobInstanceService.class);
securityService = mock(SecurityService.class);
pipelineNames = asList(new CaseInsensitiveString("blah-pipeline"));
user = new Username(new CaseInsensitiveString("poovan"));
operationResult = new HttpLocalizedOperationResult();
cruiseConfig = mock(BasicCruiseConfig.class);
goConfigService = mock(GoConfigService.class);
changesetService = mock(ChangesetService.class);
goCache = mock(GoCache.class);
transactionSynchronizationManager = new TestTransactionSynchronizationManager();
transactionTemplate = new TestTransactionTemplate(transactionSynchronizationManager);
}
Aggregations