Search in sources :

Example 1 with ConfigRepoService

use of com.thoughtworks.go.server.service.ConfigRepoService in project gocd by gocd.

the class GoConfigRepoConfigDataSourceTest method setUp.

@BeforeEach
public void setUp() {
    serverHealthService = new ServerHealthService();
    configPluginService = mock(GoConfigPluginService.class);
    configRepoService = mock(ConfigRepoService.class);
    plugin = mock(PartialConfigProvider.class);
    goConfigService = mock(GoConfigService.class);
    when(configPluginService.partialConfigProviderFor(any(ConfigRepoConfig.class))).thenReturn(plugin);
    cruiseConfig = new BasicCruiseConfig();
    CachedGoConfig cachedGoConfig = mock(CachedGoConfig.class);
    when(cachedGoConfig.currentConfig()).thenReturn(cruiseConfig);
    configWatchList = new GoConfigWatchList(cachedGoConfig, mock(GoConfigService.class));
    repoConfigDataSource = new GoConfigRepoConfigDataSource(configWatchList, configPluginService, serverHealthService, configRepoService, goConfigService);
    ScmMaterialConfig material = git("http://my.git");
    ConfigRepoConfig configRepoConfig = ConfigRepoConfig.createConfigRepoConfig(material, "myplugin", "id");
    when(configRepoService.findByFingerprint(anyString())).thenReturn(configRepoConfig);
}
Also used : ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) ServerHealthService(com.thoughtworks.go.serverhealth.ServerHealthService) ConfigRepoService(com.thoughtworks.go.server.service.ConfigRepoService) GoConfigService(com.thoughtworks.go.server.service.GoConfigService) ScmMaterialConfig(com.thoughtworks.go.config.materials.ScmMaterialConfig) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with ConfigRepoService

use of com.thoughtworks.go.server.service.ConfigRepoService in project gocd by gocd.

the class PartialConfigServiceTest method setUp.

@BeforeEach
void setUp() {
    ConfigRepoService configRepoService = mock(ConfigRepoService.class);
    serverHealthService = mock(ServerHealthService.class);
    GoConfigPluginService configPluginService = mock(GoConfigPluginService.class);
    partialConfigHelper = mock(PartialConfigHelper.class);
    plugin = mock(PartialConfigProvider.class);
    when(configPluginService.partialConfigProviderFor(any(ConfigRepoConfig.class))).thenReturn(plugin);
    cruiseConfig = new BasicCruiseConfig();
    configRepoConfig = ConfigRepoConfig.createConfigRepoConfig(git("url"), "plugin", "id");
    cruiseConfig.setConfigRepos(new ConfigReposConfig(configRepoConfig));
    CachedGoConfig cachedGoConfig = mock(CachedGoConfig.class);
    when(cachedGoConfig.currentConfig()).thenReturn(cruiseConfig);
    configWatchList = new GoConfigWatchList(cachedGoConfig, mock(GoConfigService.class));
    goConfigService = mock(GoConfigService.class);
    repoConfigDataSource = new GoConfigRepoConfigDataSource(configWatchList, configPluginService, serverHealthService, configRepoService, goConfigService);
    cachedGoPartials = new CachedGoPartials(serverHealthService);
    serverHealthService = mock(ServerHealthService.class);
    updateCommand = null;
    service = new PartialConfigService(repoConfigDataSource, configWatchList, goConfigService, cachedGoPartials, serverHealthService, partialConfigHelper) {

        @Override
        protected PartialConfigUpdateCommand buildUpdateCommand(PartialConfig partial, String fingerprint) {
            if (null == updateCommand) {
                return super.buildUpdateCommand(partial, fingerprint);
            }
            return updateCommand;
        }
    };
    when(configRepoService.findByFingerprint(anyString())).thenReturn(configRepoConfig);
}
Also used : ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) PartialConfig(com.thoughtworks.go.config.remote.PartialConfig) GoConfigService(com.thoughtworks.go.server.service.GoConfigService) ConfigReposConfig(com.thoughtworks.go.config.remote.ConfigReposConfig) ServerHealthService(com.thoughtworks.go.serverhealth.ServerHealthService) ConfigRepoService(com.thoughtworks.go.server.service.ConfigRepoService) PartialConfigUpdateCommand(com.thoughtworks.go.config.update.PartialConfigUpdateCommand) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)2 ConfigRepoService (com.thoughtworks.go.server.service.ConfigRepoService)2 GoConfigService (com.thoughtworks.go.server.service.GoConfigService)2 ServerHealthService (com.thoughtworks.go.serverhealth.ServerHealthService)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 ScmMaterialConfig (com.thoughtworks.go.config.materials.ScmMaterialConfig)1 ConfigReposConfig (com.thoughtworks.go.config.remote.ConfigReposConfig)1 PartialConfig (com.thoughtworks.go.config.remote.PartialConfig)1 PartialConfigUpdateCommand (com.thoughtworks.go.config.update.PartialConfigUpdateCommand)1