Search in sources :

Example 6 with ServerConfig

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.");
}
Also used : ServerConfig(com.thoughtworks.go.config.ServerConfig)

Example 7 with ServerConfig

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;
}
Also used : ServerConfig(com.thoughtworks.go.config.ServerConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) ServerSiteUrlConfig(com.thoughtworks.go.domain.ServerSiteUrlConfig)

Example 8 with ServerConfig

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;
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) ServerConfig(com.thoughtworks.go.config.ServerConfig) SecurityConfig(com.thoughtworks.go.config.SecurityConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig)

Example 9 with ServerConfig

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));
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) ServerConfig(com.thoughtworks.go.config.ServerConfig) SecurityConfig(com.thoughtworks.go.config.SecurityConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) Test(org.junit.Test)

Example 10 with ServerConfig

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);
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) ServerConfig(com.thoughtworks.go.config.ServerConfig) Before(org.junit.Before)

Aggregations

ServerConfig (com.thoughtworks.go.config.ServerConfig)21 BasicCruiseConfig (com.thoughtworks.go.config.BasicCruiseConfig)12 Test (org.junit.Test)12 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)11 SecurityConfig (com.thoughtworks.go.config.SecurityConfig)7 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)6 AgentConfig (com.thoughtworks.go.config.AgentConfig)4 Username (com.thoughtworks.go.server.domain.Username)4 File (java.io.File)4 UpdateConfigCommand (com.thoughtworks.go.config.UpdateConfigCommand)3 ServerSiteUrlConfig (com.thoughtworks.go.domain.ServerSiteUrlConfig)3 HttpOperationResult (com.thoughtworks.go.server.service.result.HttpOperationResult)2 Before (org.junit.Before)2 Stage (com.thoughtworks.go.domain.Stage)1 SendEmailMessage (com.thoughtworks.go.server.messaging.SendEmailMessage)1 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1