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