use of com.thoughtworks.go.config.ServerConfig in project gocd by gocd.
the class ServerIdImmutabilityValidator method validate.
public void validate(CruiseConfig cruiseConfig) throws Exception {
ServerConfig server = cruiseConfig.server();
String newServerId = server.getServerId();
if (serverId == null) {
serverId = newServerId;
}
if (serverId == null || serverId.equals(newServerId) || !env.enforceServerIdImmutability()) {
return;
}
throw new RuntimeException("The value of 'serverId' uniquely identifies a Go server instance. This field cannot be modified.");
}
use of com.thoughtworks.go.config.ServerConfig in project gocd by gocd.
the class ArtifactsDiskSpaceFullCheckerTest method configWithSiteUrl.
private static CruiseConfig configWithSiteUrl() {
ServerConfig serverConfig = new ServerConfig(null, null, new ServerSiteUrlConfig("http://test.host"), new ServerSiteUrlConfig("https://test.host"));
CruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.setServerConfig(serverConfig);
return cruiseConfig;
}
use of com.thoughtworks.go.config.ServerConfig in project gocd by gocd.
the class DiskSpaceFullCheckerTest method simulateFullDisk.
private CruiseConfig simulateFullDisk() {
new SystemEnvironment().setProperty(SystemEnvironment.ARTIFACT_FULL_SIZE_LIMIT, "1200009M");
CruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.setServerConfig(new ServerConfig(".", new SecurityConfig()));
return cruiseConfig;
}
use of com.thoughtworks.go.config.ServerConfig in project gocd by gocd.
the class DiskSpaceWarningCheckerTest method shouldUseWarningLimit.
@Test
public void shouldUseWarningLimit() {
new SystemEnvironment().setProperty(SystemEnvironment.ARTIFACT_WARNING_SIZE_LIMIT, "1M");
CruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.setServerConfig(new ServerConfig(".", new SecurityConfig()));
ArtifactsDiskSpaceWarningChecker fullChecker = new ArtifactsDiskSpaceWarningChecker(new SystemEnvironment(), sender, goConfigService, new SystemDiskSpaceChecker(), serverHealthService);
assertThat(fullChecker.limitInMb(), is(1L));
}
use of com.thoughtworks.go.config.ServerConfig in project gocd by gocd.
the class ArtifactsDiskCleanerTest method setUp.
@Before
public void setUp() throws Exception {
sysEnv = mock(SystemEnvironment.class);
serverConfig = new ServerConfig();
goConfigService = mock(GoConfigService.class);
when(goConfigService.serverConfig()).thenReturn(serverConfig);
stageService = mock(StageService.class);
when(goConfigService.serverConfig()).thenReturn(serverConfig);
artifactService = mock(ArtifactsService.class);
diskSpaceChecker = mock(SystemDiskSpaceChecker.class);
configDbStateRepository = mock(ConfigDbStateRepository.class);
artifactsDiskCleaner = new ArtifactsDiskCleaner(sysEnv, goConfigService, diskSpaceChecker, artifactService, stageService, configDbStateRepository);
}
Aggregations