Search in sources :

Example 6 with BasicCruiseConfig

use of com.thoughtworks.go.config.BasicCruiseConfig in project gocd by gocd.

the class DiskSpaceFullCheckerTest method shouldFormatLowDiskSpaceWarningMailWithHelpLinksHttpAndSiteUrl.

@Test
public void shouldFormatLowDiskSpaceWarningMailWithHelpLinksHttpAndSiteUrl() throws URISyntaxException {
    String expectedHelpUrl = "https://docs.gocd.org/current/installation/configuring_server_details.html";
    ServerConfig serverConfig = new ServerConfig(null, null, new ServerSiteUrlConfig("http://test.host"), new ServerSiteUrlConfig("https://test.host"));
    CruiseConfig cruiseConfig = new BasicCruiseConfig();
    cruiseConfig.setServerConfig(serverConfig);
    GoConfigService goConfigService = mock(GoConfigService.class);
    when(goConfigService.artifactsDir()).thenReturn(null);
    when(goConfigService.currentCruiseConfig()).thenReturn(cruiseConfig);
    when(goConfigService.adminEmail()).thenReturn("admin@email.com");
    ArtifactsDiskSpaceFullChecker diskSpaceFullChecker = new ArtifactsDiskSpaceFullChecker(new SystemEnvironment(), null, goConfigService, null) {

        @Override
        protected String targetFolderCanonicalPath() {
            return "";
        }
    };
    SendEmailMessage actual = diskSpaceFullChecker.createEmail();
    assertThat(actual.getBody(), Matchers.containsString(expectedHelpUrl));
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) ServerConfig(com.thoughtworks.go.config.ServerConfig) SendEmailMessage(com.thoughtworks.go.server.messaging.SendEmailMessage) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) ServerSiteUrlConfig(com.thoughtworks.go.domain.ServerSiteUrlConfig) Test(org.junit.Test)

Example 7 with BasicCruiseConfig

use of com.thoughtworks.go.config.BasicCruiseConfig in project gocd by gocd.

the class ArtifactDirValidatorTest method shouldThrowExceptionWhenUserProvidesNull.

@Test
public void shouldThrowExceptionWhenUserProvidesNull() {
    CruiseConfig cruiseConfig = new BasicCruiseConfig();
    cruiseConfig.setServerConfig(new ServerConfig(null, SecurityConfigMother.securityConfigWithRole("role", "user")));
    ArtifactDirValidator dirValidator = new ArtifactDirValidator();
    try {
        dirValidator.validate(cruiseConfig);
        fail("should throw exception");
    } catch (Exception e) {
    }
}
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) Test(org.junit.Test)

Example 8 with BasicCruiseConfig

use of com.thoughtworks.go.config.BasicCruiseConfig in project gocd by gocd.

the class ArtifactDirValidatorTest method shouldThrowExceptionWhenUserProvidesEmtpty.

@Test
public void shouldThrowExceptionWhenUserProvidesEmtpty() {
    CruiseConfig cruiseConfig = new BasicCruiseConfig();
    cruiseConfig.setServerConfig(new ServerConfig("", null));
    ArtifactDirValidator dirValidator = new ArtifactDirValidator();
    try {
        dirValidator.validate(cruiseConfig);
        fail("should throw exception");
    } catch (Exception e) {
    }
}
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) Test(org.junit.Test)

Example 9 with BasicCruiseConfig

use of com.thoughtworks.go.config.BasicCruiseConfig in project gocd by gocd.

the class ArtifactDirValidatorTest method shouldNotThrowExceptionWhenUserProvidesValidPath.

@Test
public void shouldNotThrowExceptionWhenUserProvidesValidPath() throws Exception {
    File file = new File("");
    CruiseConfig cruiseConfig = new BasicCruiseConfig();
    cruiseConfig.setServerConfig(new ServerConfig(file.getAbsolutePath() + "/logs", null));
    ArtifactDirValidator dirValidator = new ArtifactDirValidator();
    dirValidator.validate(cruiseConfig);
}
Also used : ServerConfig(com.thoughtworks.go.config.ServerConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) File(java.io.File) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) Test(org.junit.Test)

Example 10 with BasicCruiseConfig

use of com.thoughtworks.go.config.BasicCruiseConfig in project gocd by gocd.

the class ArtifactDirValidatorTest method shouldThrowExceptionWhenUserProvidesPathPointToServerSandBox.

@Test
public void shouldThrowExceptionWhenUserProvidesPathPointToServerSandBox() {
    File file = new File("");
    CruiseConfig cruiseConfig = new BasicCruiseConfig();
    cruiseConfig.setServerConfig(new ServerConfig(file.getAbsolutePath(), null));
    ArtifactDirValidator dirValidator = new ArtifactDirValidator();
    try {
        dirValidator.validate(cruiseConfig);
        fail("should throw exception, see dot will make server check out the repository in the wrong place.");
    } catch (Exception e) {
    }
}
Also used : ServerConfig(com.thoughtworks.go.config.ServerConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) File(java.io.File) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) Test(org.junit.Test)

Aggregations

BasicCruiseConfig (com.thoughtworks.go.config.BasicCruiseConfig)37 Test (org.junit.Test)34 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)18 ServerConfig (com.thoughtworks.go.config.ServerConfig)10 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)5 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)5 BasicPipelineConfigs (com.thoughtworks.go.config.BasicPipelineConfigs)4 SecurityConfig (com.thoughtworks.go.config.SecurityConfig)4 ServerSiteUrlConfig (com.thoughtworks.go.domain.ServerSiteUrlConfig)4 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)4 ConfigSaveValidationContext (com.thoughtworks.go.config.ConfigSaveValidationContext)3 PluginRoleConfig (com.thoughtworks.go.config.PluginRoleConfig)3 ValidationError (com.thoughtworks.go.plugin.api.response.validation.ValidationError)3 ValidationResult (com.thoughtworks.go.plugin.api.response.validation.ValidationResult)3 GoConfigService (com.thoughtworks.go.server.service.GoConfigService)3 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)3 SecurityAuthConfig (com.thoughtworks.go.config.SecurityAuthConfig)2 ElasticProfile (com.thoughtworks.go.config.elastic.ElasticProfile)2 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)2 ConfigurationKey (com.thoughtworks.go.domain.config.ConfigurationKey)2