use of com.thoughtworks.go.domain.SiteUrl in project gocd by gocd.
the class ArtifactsDiskSpaceFullCheckerTest method configWithSiteUrl.
private static CruiseConfig configWithSiteUrl() {
ServerConfig serverConfig = new ServerConfig(null, null, new SiteUrl("http://test.host"), new SecureSiteUrl("https://test.host"));
CruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.setServerConfig(serverConfig);
return cruiseConfig;
}
use of com.thoughtworks.go.domain.SiteUrl in project gocd by gocd.
the class DiskSpaceFullCheckerTest method shouldFormatLowDiskSpaceWarningMailWithHelpLinksHttpAndSiteUrl.
@Test
public void shouldFormatLowDiskSpaceWarningMailWithHelpLinksHttpAndSiteUrl() throws URISyntaxException {
String expectedHelpUrl = docsUrl("/installation/configuring_server_details.html");
ServerConfig serverConfig = new ServerConfig(null, null, new SiteUrl("http://test.host"), new SecureSiteUrl("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));
}
use of com.thoughtworks.go.domain.SiteUrl in project gocd by gocd.
the class ServerConfigTest method shouldIgnoreErrorsFieldOnEquals.
@Test
public void shouldIgnoreErrorsFieldOnEquals() throws Exception {
ServerConfig one = new ServerConfig(new SecurityConfig(), new MailHost(new GoCipher()), new SiteUrl("siteURL"), new SecureSiteUrl("secureURL"));
one.addError("siteUrl", "I dont like this url");
assertThat(one, is(new ServerConfig(new SecurityConfig(), new MailHost(new GoCipher()), new SiteUrl("siteURL"), new SecureSiteUrl("secureURL"))));
}
use of com.thoughtworks.go.domain.SiteUrl in project gocd by gocd.
the class ServerConfigTest method shouldReturnAnEmptyForSecureSiteUrlIfOnlySiteUrlIsConfigured.
@Test
public void shouldReturnAnEmptyForSecureSiteUrlIfOnlySiteUrlIsConfigured() throws Exception {
ServerConfig serverConfig = new ServerConfig(null, null, new SiteUrl("http://foo.bar:813"), new SecureSiteUrl());
assertThat(serverConfig.getHttpsUrl(), is(new SecureSiteUrl()));
}
use of com.thoughtworks.go.domain.SiteUrl in project gocd by gocd.
the class SiteUrlsTest method shouldAddErrorsIfSecureSiteUrlIsInvalid.
@Test
void shouldAddErrorsIfSecureSiteUrlIsInvalid() {
SiteUrls siteUrls = new SiteUrls(new SiteUrl("http://foo.bar"), new SecureSiteUrl("http://foo.bar"));
siteUrls.validate(null);
assertThat(siteUrls.getSecureSiteUrl().errors()).hasSize(1).containsEntry("secureSiteUrl", Collections.singletonList("Invalid format for secure site url. 'http://foo.bar' must start with https"));
}
Aggregations