use of com.thoughtworks.go.serverhealth.ServerHealthService in project gocd by gocd.
the class PipelineSchedulerTest method setUp.
@Before
public void setUp() {
queue = mock(ScheduleCheckQueue.class);
configService = mock(GoConfigService.class);
ServerHealthService serverHealthService = mock(ServerHealthService.class);
SchedulingCheckerService schedulingCheckerService = mock(SchedulingCheckerService.class);
buildCauseProducerService = mock(BuildCauseProducerService.class);
topic = mock(ScheduleCheckCompletedTopic.class);
schedulingPerformanceLogger = mock(SchedulingPerformanceLogger.class);
scheduler = new PipelineScheduler(configService, serverHealthService, schedulingCheckerService, buildCauseProducerService, queue, topic, schedulingPerformanceLogger);
}
use of com.thoughtworks.go.serverhealth.ServerHealthService in project gocd by gocd.
the class GoConfigFileHelper method createTestingDao.
/**
* Creates config dao that accesses single file
*/
public static GoConfigDao createTestingDao() {
SystemEnvironment systemEnvironment = new SystemEnvironment();
try {
ServerHealthService serverHealthService = new ServerHealthService();
ConfigRepository configRepository = new ConfigRepository(systemEnvironment);
configRepository.initialize();
ConfigCache configCache = new ConfigCache();
ConfigElementImplementationRegistry configElementImplementationRegistry = ConfigElementImplementationRegistryMother.withNoPlugins();
CachedGoPartials cachedGoPartials = new CachedGoPartials(serverHealthService);
FullConfigSaveNormalFlow normalFlow = new FullConfigSaveNormalFlow(configCache, configElementImplementationRegistry, systemEnvironment, new ServerVersion(), new TimeProvider(), configRepository, cachedGoPartials);
GoFileConfigDataSource dataSource = new GoFileConfigDataSource(new DoNotUpgrade(), configRepository, systemEnvironment, new TimeProvider(), configCache, new ServerVersion(), configElementImplementationRegistry, serverHealthService, cachedGoPartials, null, normalFlow);
dataSource.upgradeIfNecessary();
CachedGoConfig cachedConfigService = new CachedGoConfig(serverHealthService, dataSource, cachedGoPartials, null, null);
cachedConfigService.loadConfigIfNull();
return new GoConfigDao(cachedConfigService);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of com.thoughtworks.go.serverhealth.ServerHealthService in project gocd by gocd.
the class GoConfigFileHelper method createTestingDao.
/**
* Creates config dao that has custom remote configuration parts provided by partialConfig argument
*/
public static GoConfigDao createTestingDao(GoPartialConfig partialConfig) {
SystemEnvironment systemEnvironment = new SystemEnvironment();
try {
ServerHealthService serverHealthService = new ServerHealthService();
ConfigRepository configRepository = new ConfigRepository(systemEnvironment);
configRepository.initialize();
FullConfigSaveNormalFlow normalFlow = new FullConfigSaveNormalFlow(new ConfigCache(), com.thoughtworks.go.util.ConfigElementImplementationRegistryMother.withNoPlugins(), systemEnvironment, new ServerVersion(), new TimeProvider(), configRepository, new CachedGoPartials(serverHealthService));
GoFileConfigDataSource dataSource = new GoFileConfigDataSource(new DoNotUpgrade(), configRepository, systemEnvironment, new TimeProvider(), new ConfigCache(), new ServerVersion(), com.thoughtworks.go.util.ConfigElementImplementationRegistryMother.withNoPlugins(), serverHealthService, new CachedGoPartials(serverHealthService), null, normalFlow);
dataSource.upgradeIfNecessary();
CachedGoPartials cachedGoPartials = new CachedGoPartials(serverHealthService);
CachedGoConfig cachedConfigService = new CachedGoConfig(serverHealthService, dataSource, cachedGoPartials, null, null);
cachedConfigService.loadConfigIfNull();
return new GoConfigDao(cachedConfigService);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of com.thoughtworks.go.serverhealth.ServerHealthService 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.serverhealth.ServerHealthService in project gocd by gocd.
the class InvalidConfigMessageRemoverTest method shouldRemoveServerHealthServiceMessageAboutStartedWithInvalidConfigurationOnPipelineConfigSave.
@Test
public void shouldRemoveServerHealthServiceMessageAboutStartedWithInvalidConfigurationOnPipelineConfigSave() {
GoConfigService goConfigService = mock(GoConfigService.class);
ServerHealthService serverHealthService = mock(ServerHealthService.class);
ArgumentCaptor<ConfigChangedListener> configChangedListenerArgumentCaptor = ArgumentCaptor.forClass(ConfigChangedListener.class);
doNothing().when(goConfigService).register(configChangedListenerArgumentCaptor.capture());
InvalidConfigMessageRemover invalidConfigMessageRemover = new InvalidConfigMessageRemover(goConfigService, serverHealthService);
invalidConfigMessageRemover.initialize();
invalidConfigMessageRemover.onConfigChange(null);
List<ConfigChangedListener> listeners = configChangedListenerArgumentCaptor.getAllValues();
assertThat(listeners.get(1) instanceof EntityConfigChangedListener, is(true));
EntityConfigChangedListener listener = (EntityConfigChangedListener) listeners.get(1);
assertThat(listener.shouldCareAbout(mock(PipelineConfig.class)), is(true));
invalidConfigMessageRemover.pipelineConfigChangedListener().onEntityConfigChange(mock(PipelineConfig.class));
ArgumentCaptor<HealthStateScope> captor = ArgumentCaptor.forClass(HealthStateScope.class);
verify(serverHealthService).removeByScope(captor.capture());
assertThat(captor.getValue().compareTo(HealthStateScope.forInvalidConfig()), is(0));
}
Aggregations