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