use of com.thoughtworks.go.serverhealth.ServerHealthService in project gocd by gocd.
the class TimerSchedulerTest method shouldUpdateServerHealthStatusWhenPipelineCantBeAddedToTheQuartzScheduler.
@Test
public void shouldUpdateServerHealthStatusWhenPipelineCantBeAddedToTheQuartzScheduler() throws Exception {
Scheduler scheduler = mock(Scheduler.class);
when(scheduler.scheduleJob(any(JobDetail.class), any(Trigger.class))).thenThrow(new SchedulerException("scheduling failed!"));
SchedulerFactory schedulerFactory = mock(SchedulerFactory.class);
when(schedulerFactory.getScheduler()).thenReturn(scheduler);
GoConfigService goConfigService = mock(GoConfigService.class);
when(goConfigService.getAllPipelineConfigs()).thenReturn(asList(pipelineConfigWithTimer("uat", "* * * * * ?")));
ServerHealthService serverHealthService = mock(ServerHealthService.class);
TimerScheduler timerScheduler = new TimerScheduler(schedulerFactory, goConfigService, null, serverHealthService);
timerScheduler.initialize();
verify(serverHealthService).update(ServerHealthState.error("Could not register pipeline 'uat' with timer", "", HealthStateType.general(HealthStateScope.forPipeline("uat"))));
}
use of com.thoughtworks.go.serverhealth.ServerHealthService in project gocd by gocd.
the class TimerSchedulerTest method shouldUpdateServerHealthStatusWhenCronSpecCantBeParsed.
@Test
public void shouldUpdateServerHealthStatusWhenCronSpecCantBeParsed() throws Exception {
when(schedulerFactory.getScheduler()).thenReturn(scheduler);
GoConfigService goConfigService = mock(GoConfigService.class);
when(goConfigService.getAllPipelineConfigs()).thenReturn(asList(pipelineConfigWithTimer("uat", "bad cron spec!!!")));
ServerHealthService serverHealthService = mock(ServerHealthService.class);
TimerScheduler timerScheduler = new TimerScheduler(schedulerFactory, goConfigService, null, serverHealthService);
timerScheduler.initialize();
verify(schedulerFactory).getScheduler();
verify(scheduler).start();
verify(serverHealthService).update(ServerHealthState.error("Bad timer specification for timer in Pipeline: uat", "Cannot schedule pipeline using the timer", HealthStateType.general(HealthStateScope.forPipeline("uat"))));
}
use of com.thoughtworks.go.serverhealth.ServerHealthService in project gocd by gocd.
the class JobRerunScheduleServiceTest method setup.
@Before
public void setup() {
jobInstanceService = mock(JobInstanceService.class);
goConfigService = mock(GoConfigService.class);
environmentConfigService = mock(EnvironmentConfigService.class);
serverHealthService = mock(ServerHealthService.class);
final TestTransactionSynchronizationManager synchronizationManager = new TestTransactionSynchronizationManager();
schedulingChecker = mock(SchedulingCheckerService.class);
pipelineScheduleQueue = mock(PipelineScheduleQueue.class);
pipelineService = mock(PipelineService.class);
stageService = mock(StageService.class);
securityService = mock(SecurityService.class);
lockService = mock(PipelineLockService.class);
txnTemplate = new TestTransactionTemplate(synchronizationManager);
timeProvider = new TimeProvider();
instanceFactory = mock(InstanceFactory.class);
schedulingPerformanceLogger = mock(SchedulingPerformanceLogger.class);
elasticProfileService = mock(ElasticProfileService.class);
service = new ScheduleService(goConfigService, pipelineService, stageService, schedulingChecker, mock(PipelineScheduledTopic.class), mock(PipelineDao.class), mock(StageDao.class), mock(StageOrderService.class), securityService, pipelineScheduleQueue, jobInstanceService, mock(JobInstanceDao.class), mock(AgentAssignment.class), environmentConfigService, lockService, serverHealthService, txnTemplate, mock(AgentService.class), synchronizationManager, timeProvider, null, null, instanceFactory, schedulingPerformanceLogger, elasticProfileService);
}
use of com.thoughtworks.go.serverhealth.ServerHealthService in project gocd by gocd.
the class PipelineSchedulerTest method setUp.
@Before
public void setUp() {
queue = mock(ScheduleCheckQueue.class);
configService = mock(GoConfigService.class);
ServerHealthService serverHealthService = mock(ServerHealthService.class);
SchedulingCheckerService schedulingCheckerService = mock(SchedulingCheckerService.class);
buildCauseProducerService = mock(BuildCauseProducerService.class);
topic = mock(ScheduleCheckCompletedTopic.class);
schedulingPerformanceLogger = mock(SchedulingPerformanceLogger.class);
scheduler = new PipelineScheduler(configService, serverHealthService, schedulingCheckerService, buildCauseProducerService, queue, topic, schedulingPerformanceLogger);
}
use of com.thoughtworks.go.serverhealth.ServerHealthService in project gocd by gocd.
the class SCMMaterialSourceTest method setUp.
@Before
public void setUp() throws Exception {
goConfigService = mock(GoConfigService.class);
systemEnvironment = new SystemEnvironment();
serverHealthService = mock(ServerHealthService.class);
materialConfigConverter = mock(MaterialConfigConverter.class);
materialUpdateService = mock(MaterialUpdateService.class);
source = new SCMMaterialSource(goConfigService, systemEnvironment, materialConfigConverter, materialUpdateService);
}
Aggregations