Search in sources :

Example 1 with BuildCauseProducerService

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));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) BasicPipelineConfigs(com.thoughtworks.go.config.BasicPipelineConfigs) ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) BuildCauseProducerService(com.thoughtworks.go.server.scheduling.BuildCauseProducerService) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) Test(org.junit.Test)

Example 2 with BuildCauseProducerService

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));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) BuildCauseProducerService(com.thoughtworks.go.server.scheduling.BuildCauseProducerService) Test(org.junit.Test)

Aggregations

PipelineConfig (com.thoughtworks.go.config.PipelineConfig)2 BuildCauseProducerService (com.thoughtworks.go.server.scheduling.BuildCauseProducerService)2 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)2 Test (org.junit.Test)2 BasicCruiseConfig (com.thoughtworks.go.config.BasicCruiseConfig)1 BasicPipelineConfigs (com.thoughtworks.go.config.BasicPipelineConfigs)1 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)1