use of com.thoughtworks.go.server.scheduling.BuildCauseProducerService in project gocd by gocd.
the class TimerSchedulerQuartzIntegrationTest method shouldUpdateJobsInTheQuartzSchedulerOnConfigChange.
@Test
public void shouldUpdateJobsInTheQuartzSchedulerOnConfigChange() throws InterruptedException {
PipelineConfig uat = pipelineConfigWithTimer("uat", "* * * * * ?");
PipelineConfig dist = pipelineConfigWithTimer("dist", "* * * * * ?");
List<PipelineConfig> pipelineConfigs = asList(uat, dist);
GoConfigService goConfigService = mock(GoConfigService.class);
when(goConfigService.getAllPipelineConfigs()).thenReturn(pipelineConfigs);
BuildCauseProducerService buildCauseProducerService = mock(BuildCauseProducerService.class);
TimerScheduler timerScheduler = new TimerScheduler(quartzSchedulerFactory, goConfigService, buildCauseProducerService, null);
timerScheduler.initialize();
CruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.getGroups().add(new BasicPipelineConfigs(uat));
timerScheduler.onConfigChange(cruiseConfig);
pauseForScheduling();
verify(buildCauseProducerService, atLeastOnce()).timerSchedulePipeline(eq(uat), any(ServerHealthStateOperationResult.class));
}
use of com.thoughtworks.go.server.scheduling.BuildCauseProducerService in project gocd by gocd.
the class TimerSchedulerQuartzIntegrationTest method shouldExecuteScheduledJobsWhenInvokedFromQuartz.
@Test
public void shouldExecuteScheduledJobsWhenInvokedFromQuartz() throws InterruptedException {
PipelineConfig uat = pipelineConfigWithTimer("uat", "* * * * * ?");
PipelineConfig dist = pipelineConfigWithTimer("dist", "* * * * * ?");
List<PipelineConfig> pipelineConfigs = asList(uat, dist);
GoConfigService goConfigService = mock(GoConfigService.class);
when(goConfigService.getAllPipelineConfigs()).thenReturn(pipelineConfigs);
BuildCauseProducerService buildCauseProducerService = mock(BuildCauseProducerService.class);
TimerScheduler timerScheduler = new TimerScheduler(quartzSchedulerFactory, goConfigService, buildCauseProducerService, null);
timerScheduler.initialize();
pauseForScheduling();
verify(buildCauseProducerService, atLeastOnce()).timerSchedulePipeline(eq(uat), any(ServerHealthStateOperationResult.class));
verify(buildCauseProducerService, atLeastOnce()).timerSchedulePipeline(eq(dist), any(ServerHealthStateOperationResult.class));
}
Aggregations