Search in sources :

Example 1 with BasicPipelineConfigs

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));
}
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 BasicPipelineConfigs

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));
}
Also used : BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) BasicPipelineConfigs(com.thoughtworks.go.config.BasicPipelineConfigs) Test(org.junit.Test)

Example 3 with BasicPipelineConfigs

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()));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) PipelineConfigs(com.thoughtworks.go.config.PipelineConfigs) BasicPipelineConfigs(com.thoughtworks.go.config.BasicPipelineConfigs) BasicPipelineConfigs(com.thoughtworks.go.config.BasicPipelineConfigs) Test(org.junit.Test)

Example 4 with BasicPipelineConfigs

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()));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) PipelineConfigs(com.thoughtworks.go.config.PipelineConfigs) BasicPipelineConfigs(com.thoughtworks.go.config.BasicPipelineConfigs) BasicPipelineConfigs(com.thoughtworks.go.config.BasicPipelineConfigs) Test(org.junit.Test)

Example 5 with BasicPipelineConfigs

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));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) PartialConfig(com.thoughtworks.go.config.remote.PartialConfig) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) BasicPipelineConfigs(com.thoughtworks.go.config.BasicPipelineConfigs) Test(org.junit.Test)

Aggregations

BasicPipelineConfigs (com.thoughtworks.go.config.BasicPipelineConfigs)7 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)6 Test (org.junit.Test)6 BasicCruiseConfig (com.thoughtworks.go.config.BasicCruiseConfig)4 PipelineConfigs (com.thoughtworks.go.config.PipelineConfigs)3 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)2 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)2 FileConfigOrigin (com.thoughtworks.go.config.remote.FileConfigOrigin)2 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)1 ScmMaterialConfig (com.thoughtworks.go.config.materials.ScmMaterialConfig)1 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)1 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)1 PartialConfig (com.thoughtworks.go.config.remote.PartialConfig)1 RepoConfigOrigin (com.thoughtworks.go.config.remote.RepoConfigOrigin)1 PipelineGroups (com.thoughtworks.go.domain.PipelineGroups)1 BuildCauseProducerService (com.thoughtworks.go.server.scheduling.BuildCauseProducerService)1 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)1 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1