use of com.thoughtworks.go.config.ServerConfig 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) {
}
}
use of com.thoughtworks.go.config.ServerConfig 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) {
}
}
use of com.thoughtworks.go.config.ServerConfig 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) {
}
}
use of com.thoughtworks.go.config.ServerConfig 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);
}
use of com.thoughtworks.go.config.ServerConfig in project gocd by gocd.
the class DiskSpaceFullCheckerTest method shouldFormatLowDiskSpaceWarningMailWithHelpLinksHttpAndSiteUrl.
@Test
public void shouldFormatLowDiskSpaceWarningMailWithHelpLinksHttpAndSiteUrl() throws URISyntaxException {
String expectedHelpUrl = "https://docs.gocd.io/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));
}
Aggregations