Search in sources :

Example 1 with SiteUrl

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

Example 2 with SiteUrl

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));
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) ServerConfig(com.thoughtworks.go.config.ServerConfig) SendEmailMessage(com.thoughtworks.go.server.messaging.SendEmailMessage) SecureSiteUrl(com.thoughtworks.go.domain.SecureSiteUrl) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) SiteUrl(com.thoughtworks.go.domain.SiteUrl) SecureSiteUrl(com.thoughtworks.go.domain.SecureSiteUrl) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) Test(org.junit.jupiter.api.Test)

Example 3 with SiteUrl

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"))));
}
Also used : GoCipher(com.thoughtworks.go.security.GoCipher) SecureSiteUrl(com.thoughtworks.go.domain.SecureSiteUrl) SiteUrl(com.thoughtworks.go.domain.SiteUrl) SecureSiteUrl(com.thoughtworks.go.domain.SecureSiteUrl) Test(org.junit.jupiter.api.Test)

Example 4 with SiteUrl

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()));
}
Also used : SecureSiteUrl(com.thoughtworks.go.domain.SecureSiteUrl) SiteUrl(com.thoughtworks.go.domain.SiteUrl) SecureSiteUrl(com.thoughtworks.go.domain.SecureSiteUrl) Test(org.junit.jupiter.api.Test)

Example 5 with SiteUrl

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"));
}
Also used : SecureSiteUrl(com.thoughtworks.go.domain.SecureSiteUrl) SiteUrl(com.thoughtworks.go.domain.SiteUrl) SecureSiteUrl(com.thoughtworks.go.domain.SecureSiteUrl) Test(org.junit.jupiter.api.Test)

Aggregations

SecureSiteUrl (com.thoughtworks.go.domain.SecureSiteUrl)19 SiteUrl (com.thoughtworks.go.domain.SiteUrl)19 Test (org.junit.jupiter.api.Test)15 BasicCruiseConfig (com.thoughtworks.go.config.BasicCruiseConfig)4 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)4 ServerConfig (com.thoughtworks.go.config.ServerConfig)2 SiteUrls (com.thoughtworks.go.config.SiteUrls)2 GoCache (com.thoughtworks.go.server.cache.GoCache)2 ServerSiteUrlConfig (com.thoughtworks.go.domain.ServerSiteUrlConfig)1 GoCipher (com.thoughtworks.go.security.GoCipher)1 SendEmailMessage (com.thoughtworks.go.server.messaging.SendEmailMessage)1 FeatureToggleService (com.thoughtworks.go.server.service.support.toggle.FeatureToggleService)1 HttpTestUtil (com.thoughtworks.go.server.util.HttpTestUtil)1 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)1 File (java.io.File)1 URISyntaxException (java.net.URISyntaxException)1 WebAppContext (org.eclipse.jetty.webapp.WebAppContext)1 BeforeAll (org.junit.jupiter.api.BeforeAll)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1 WebApplicationContext (org.springframework.web.context.WebApplicationContext)1