use of com.thoughtworks.go.config.update.PartialConfigUpdateCommand 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);
}
use of com.thoughtworks.go.config.update.PartialConfigUpdateCommand in project gocd by gocd.
the class PartialConfigService method merge.
public CruiseConfig merge(PartialConfig partialConfig, String fingerprint, CruiseConfig cruiseConfig) {
PartialConfigUpdateCommand command = buildUpdateCommand(partialConfig, fingerprint);
command.update(cruiseConfig);
return cruiseConfig;
}
Aggregations