use of com.thoughtworks.go.config.BasicPipelineConfigs 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.config.BasicPipelineConfigs in project gocd by gocd.
the class UpdatePipelineConfigCommandTest method shouldDisallowStaleRequest.
@Test
public void shouldDisallowStaleRequest() {
UpdatePipelineConfigCommand command = new UpdatePipelineConfigCommand(goConfigService, entityHashingService, pipelineConfig, username, "stale_md5", localizedOperationResult);
when(goConfigService.findGroupNameByPipeline(pipelineConfig.name())).thenReturn("group1");
when(goConfigService.canEditPipeline(pipelineConfig.name().toString(), username, localizedOperationResult, "group1")).thenReturn(true);
when(entityHashingService.md5ForEntity(pipelineConfig)).thenReturn("latest_md5");
BasicCruiseConfig basicCruiseConfig = new BasicCruiseConfig(new BasicPipelineConfigs(pipelineConfig));
assertFalse(command.canContinue(basicCruiseConfig));
}
use of com.thoughtworks.go.config.BasicPipelineConfigs in project gocd by gocd.
the class BasicPipelineConfigsTest method shouldSetOriginInPipelines.
@Test
public void shouldSetOriginInPipelines() {
PipelineConfig pipe = PipelineConfigMother.pipelineConfig("pipeline1");
PipelineConfigs group = new BasicPipelineConfigs(pipe);
group.setOrigins(new FileConfigOrigin());
assertThat(pipe.getOrigin(), Is.<ConfigOrigin>is(new FileConfigOrigin()));
}
use of com.thoughtworks.go.config.BasicPipelineConfigs in project gocd by gocd.
the class BasicPipelineConfigsTest method shouldSetOriginInAuthorization.
@Test
public void shouldSetOriginInAuthorization() {
PipelineConfig pipe = PipelineConfigMother.pipelineConfig("pipeline1");
PipelineConfigs group = new BasicPipelineConfigs(pipe);
group.setOrigins(new FileConfigOrigin());
assertThat(group.getAuthorization().getOrigin(), Is.<ConfigOrigin>is(new FileConfigOrigin()));
}
use of com.thoughtworks.go.config.BasicPipelineConfigs in project gocd by gocd.
the class ConfigRepoPartialPreprocessorTest method shouldMergePartialsSetOnConfig.
@Test
public void shouldMergePartialsSetOnConfig() {
final PartialConfig partialConfig = PartialConfigMother.withPipeline("partial");
partialConfig.setOrigin(new RepoConfigOrigin(configRepoConfig, "sha-1"));
ConfigRepoPartialPreprocessor preprocessor = new ConfigRepoPartialPreprocessor();
PipelineConfig pipelineInMain = PipelineConfigMother.createPipelineConfig("main_pipeline", "stage", "job");
BasicCruiseConfig cruiseConfig = new BasicCruiseConfig(new BasicPipelineConfigs(pipelineInMain));
cruiseConfig.setConfigRepos(reposConfig);
cruiseConfig.setPartials(asList(partialConfig));
preprocessor.process(cruiseConfig);
assertThat(cruiseConfig.getAllPipelineNames().contains(pipelineInMain.name()), is(true));
assertThat(cruiseConfig.getAllPipelineNames().contains(partialConfig.getGroups().first().get(0).name()), is(true));
}
Aggregations