Search in sources :

Example 26 with ConfigRepoConfig

use of com.thoughtworks.go.config.remote.ConfigRepoConfig in project gocd by gocd.

the class GoPartialConfigTest method setUp.

@Before
public void setUp() {
    serverHealthService = mock(ServerHealthService.class);
    configPluginService = mock(GoConfigPluginService.class);
    plugin = mock(PartialConfigProvider.class);
    when(configPluginService.partialConfigProviderFor(any(ConfigRepoConfig.class))).thenReturn(plugin);
    cruiseConfig = new BasicCruiseConfig();
    configRepoConfig = new ConfigRepoConfig(new GitMaterialConfig("url"), "plugin");
    cruiseConfig.setConfigRepos(new ConfigReposConfig(configRepoConfig));
    cachedGoConfig = mock(CachedGoConfig.class);
    when(cachedGoConfig.currentConfig()).thenReturn(cruiseConfig);
    configWatchList = new GoConfigWatchList(cachedGoConfig);
    repoConfigDataSource = new GoRepoConfigDataSource(configWatchList, configPluginService, serverHealthService);
    cachedGoPartials = new CachedGoPartials(serverHealthService);
    goConfigService = mock(GoConfigService.class);
    serverHealthService = mock(ServerHealthService.class);
    partialConfig = new GoPartialConfig(repoConfigDataSource, configWatchList, goConfigService, cachedGoPartials, serverHealthService);
}
Also used : ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) GoConfigService(com.thoughtworks.go.server.service.GoConfigService) ConfigReposConfig(com.thoughtworks.go.config.remote.ConfigReposConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) ServerHealthService(com.thoughtworks.go.serverhealth.ServerHealthService) Before(org.junit.Before)

Example 27 with ConfigRepoConfig

use of com.thoughtworks.go.config.remote.ConfigRepoConfig in project gocd by gocd.

the class GoPartialConfigTest method shouldRemovePartialWhenNoLongerInWatchList.

@Test
public void shouldRemovePartialWhenNoLongerInWatchList() throws Exception {
    ScmMaterialConfig material = setOneConfigRepo();
    PartialConfig part = new PartialConfig();
    when(plugin.load(any(File.class), any(PartialConfigLoadContext.class))).thenReturn(part);
    repoConfigDataSource.onCheckoutComplete(material, folder, "7a8f");
    assertThat(partialConfig.lastPartials().size(), is(1));
    assertThat(partialConfig.lastPartials().get(0), is(part));
    // we change current configuration
    ScmMaterialConfig othermaterial = new GitMaterialConfig("http://myother.git");
    cruiseConfig.setConfigRepos(new ConfigReposConfig(new ConfigRepoConfig(othermaterial, "myplugin")));
    configWatchList.onConfigChange(cruiseConfig);
    assertThat(partialConfig.lastPartials().size(), is(0));
}
Also used : ConfigReposConfig(com.thoughtworks.go.config.remote.ConfigReposConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) PartialConfig(com.thoughtworks.go.config.remote.PartialConfig) File(java.io.File) ScmMaterialConfig(com.thoughtworks.go.config.materials.ScmMaterialConfig) Test(org.junit.Test)

Example 28 with ConfigRepoConfig

use of com.thoughtworks.go.config.remote.ConfigRepoConfig in project gocd by gocd.

the class GoPartialConfigTest method setOneConfigRepo.

private ScmMaterialConfig setOneConfigRepo() {
    ScmMaterialConfig material = new GitMaterialConfig("http://my.git");
    cruiseConfig.setConfigRepos(new ConfigReposConfig(new ConfigRepoConfig(material, "myplugin")));
    configWatchList.onConfigChange(cruiseConfig);
    return material;
}
Also used : ConfigReposConfig(com.thoughtworks.go.config.remote.ConfigReposConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) ScmMaterialConfig(com.thoughtworks.go.config.materials.ScmMaterialConfig)

Example 29 with ConfigRepoConfig

use of com.thoughtworks.go.config.remote.ConfigRepoConfig in project gocd by gocd.

the class PipelineConfigTest method shouldReturnFalseWhenOneOfPipelineMaterialsIsNotTheSameAsConfigOrigin.

@Test
public void shouldReturnFalseWhenOneOfPipelineMaterialsIsNotTheSameAsConfigOrigin() {
    PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfig("pipeline", "stage", "build");
    MaterialConfig material = new GitMaterialConfig("http://git");
    pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(material, "plugin"), "1233"));
    assertThat(pipelineConfig.isConfigOriginSameAsOneOfMaterials(), is(false));
}
Also used : GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) PluggableSCMMaterialConfig(com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) AbstractMaterialConfig(com.thoughtworks.go.config.materials.AbstractMaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) PackageMaterialConfig(com.thoughtworks.go.config.materials.PackageMaterialConfig) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) Test(org.junit.Test)

Example 30 with ConfigRepoConfig

use of com.thoughtworks.go.config.remote.ConfigRepoConfig in project gocd by gocd.

the class PipelineConfigTest method shouldReturnConfigRepoOriginDisplayNameWhenOriginIsRemote.

@Test
public void shouldReturnConfigRepoOriginDisplayNameWhenOriginIsRemote() {
    PipelineConfig pipelineConfig = new PipelineConfig();
    pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(MaterialConfigsMother.gitMaterialConfig(), "plugin"), "revision1"));
    assertThat(pipelineConfig.getOriginDisplayName(), is("AwesomeGitMaterial at revision1"));
}
Also used : ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) Test(org.junit.Test)

Aggregations

ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)54 Test (org.junit.Test)34 RepoConfigOrigin (com.thoughtworks.go.config.remote.RepoConfigOrigin)32 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)27 PartialConfig (com.thoughtworks.go.config.remote.PartialConfig)10 ConfigReposConfig (com.thoughtworks.go.config.remote.ConfigReposConfig)8 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)8 Before (org.junit.Before)8 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)6 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)6 File (java.io.File)5 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)4 AbstractMaterialConfig (com.thoughtworks.go.config.materials.AbstractMaterialConfig)4 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)4 PluggableSCMMaterialConfig (com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig)4 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)4 FileConfigOrigin (com.thoughtworks.go.config.remote.FileConfigOrigin)4 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)4 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)4 GoConfigInvalidException (com.thoughtworks.go.config.exceptions.GoConfigInvalidException)3