Search in sources :

Example 1 with ConfigReposConfig

use of com.thoughtworks.go.config.remote.ConfigReposConfig 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 2 with ConfigReposConfig

use of com.thoughtworks.go.config.remote.ConfigReposConfig 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, mock(GoConfigService.class));
    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 3 with ConfigReposConfig

use of com.thoughtworks.go.config.remote.ConfigReposConfig 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 4 with ConfigReposConfig

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

the class DeleteConfigRepoCommand method update.

@Override
public void update(CruiseConfig preprocessedConfig) {
    ConfigReposConfig configRepos = preprocessedConfig.getConfigRepos();
    preprocessedConfigRepo = configRepos.getConfigRepo(repoId);
    configRepos.remove(preprocessedConfigRepo);
}
Also used : ConfigReposConfig(com.thoughtworks.go.config.remote.ConfigReposConfig)

Example 5 with ConfigReposConfig

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

the class ConfigRepositoryInitializerTest method setUp.

@BeforeEach
void setUp() {
    yamlPluginDescriptor = GoPluginDescriptor.builder().id(YAML_PLUGIN_ID).build();
    yamlPluginDescriptor.setBundleDescriptor(new GoPluginBundleDescriptor(yamlPluginDescriptor));
    jsonPluginDescriptor = GoPluginDescriptor.builder().id(JSON_PLUGIN_ID).build();
    jsonPluginDescriptor.setBundleDescriptor(new GoPluginBundleDescriptor(jsonPluginDescriptor));
    groovyPluginDescriptor = GoPluginDescriptor.builder().id(GROOVY_PLUGIN_ID).build();
    groovyPluginDescriptor.setBundleDescriptor(new GoPluginBundleDescriptor(groovyPluginDescriptor));
    configRepositoryInitializer = new ConfigRepositoryInitializer(pluginManager, configRepoService, materialRepository, goConfigRepoConfigDataSource, goConfigService, systemEnvironment);
    repoConfigs = new ConfigReposConfig();
    ConfigRepoConfig repoConfig1 = new ConfigRepoConfig();
    repoConfig1.setId("repo1");
    repoConfig1.setPluginId(YAML_PLUGIN_ID);
    repoConfig1.setRepo(MaterialConfigsMother.git("git-repo"));
    repoConfigs.add(repoConfig1);
    lenient().when(configRepoService.getConfigRepos()).thenReturn(repoConfigs);
    lenient().when(pluginManager.isPluginOfType(CONFIG_REPO_EXTENSION, YAML_PLUGIN_ID)).thenReturn(true);
    lenient().when(pluginManager.isPluginOfType(CONFIG_REPO_EXTENSION, JSON_PLUGIN_ID)).thenReturn(true);
}
Also used : ConfigReposConfig(com.thoughtworks.go.config.remote.ConfigReposConfig) ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) GoPluginBundleDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginBundleDescriptor) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ConfigReposConfig (com.thoughtworks.go.config.remote.ConfigReposConfig)30 ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)18 Test (org.junit.jupiter.api.Test)17 ScmMaterialConfig (com.thoughtworks.go.config.materials.ScmMaterialConfig)14 PartialConfig (com.thoughtworks.go.config.remote.PartialConfig)7 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)6 RepoConfigOrigin (com.thoughtworks.go.config.remote.RepoConfigOrigin)5 File (java.io.File)4 GoConfigService (com.thoughtworks.go.server.service.GoConfigService)3 ConfigRepoService (com.thoughtworks.go.server.service.ConfigRepoService)2 ServerHealthService (com.thoughtworks.go.serverhealth.ServerHealthService)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 ApiController (com.thoughtworks.go.api.ApiController)1 ApiVersion (com.thoughtworks.go.api.ApiVersion)1 CrudController (com.thoughtworks.go.api.CrudController)1 OutputWriter (com.thoughtworks.go.api.base.OutputWriter)1 JsonReader (com.thoughtworks.go.api.representers.JsonReader)1 ApiAuthenticationHelper (com.thoughtworks.go.api.spring.ApiAuthenticationHelper)1 GsonTransformer (com.thoughtworks.go.api.util.GsonTransformer)1 HaltApiResponses.haltBecauseEntityAlreadyExists (com.thoughtworks.go.api.util.HaltApiResponses.haltBecauseEntityAlreadyExists)1