Search in sources :

Example 16 with ServerSiteUrlConfig

use of com.thoughtworks.go.domain.ServerSiteUrlConfig in project gocd by gocd.

the class SecurityServiceIntegrationTest method shouldReturnSecureSiteUrlAsCasServiceBaseUrlIfBothSiteUrlAndSecureSiteUrlAreDefined.

@Test
public void shouldReturnSecureSiteUrlAsCasServiceBaseUrlIfBothSiteUrlAndSecureSiteUrlAreDefined() throws Exception {
    configHelper.setBaseUrls(new ServerSiteUrlConfig("http://example.com"), new ServerSiteUrlConfig("https://example.com"));
    assertThat(securityService.casServiceBaseUrl(), is("https://example.com"));
}
Also used : ServerSiteUrlConfig(com.thoughtworks.go.domain.ServerSiteUrlConfig) Test(org.junit.Test)

Example 17 with ServerSiteUrlConfig

use of com.thoughtworks.go.domain.ServerSiteUrlConfig in project gocd by gocd.

the class ServerConfigServiceIntegrationTest method shouldUseTheSecureSiteUrlInspiteOfCallerNotForcingSsl_whenAlreadyUsingHTTPS.

@Test
public void shouldUseTheSecureSiteUrlInspiteOfCallerNotForcingSsl_whenAlreadyUsingHTTPS() throws URISyntaxException {
    configHelper.setBaseUrls(new ServerSiteUrlConfig("http://foo.com:80"), new ServerSiteUrlConfig("https://bar.com:443"));
    assertThat(serverConfigService.siteUrlFor("https://test.host:1000/foo/bar", false), is("https://bar.com:443/foo/bar"));
    assertThat(serverConfigService.siteUrlFor("http://test.host/foo/bar", false), is("http://foo.com:80/foo/bar"));
}
Also used : ServerSiteUrlConfig(com.thoughtworks.go.domain.ServerSiteUrlConfig) Test(org.junit.Test)

Example 18 with ServerSiteUrlConfig

use of com.thoughtworks.go.domain.ServerSiteUrlConfig in project gocd by gocd.

the class ServerConfigServiceIntegrationTest method shouldUpdateWithEmptySecureSiteUrlAndSiteUrl.

@Test
public void shouldUpdateWithEmptySecureSiteUrlAndSiteUrl() throws InvalidCipherTextException {
    HttpLocalizedOperationResult result = new HttpLocalizedOperationResult();
    MailHost mailHost = new MailHost("boo", 1, "username", "password", new GoCipher().encrypt("password"), true, true, "from@from.com", "admin@admin.com", new GoCipher());
    serverConfigService.updateServerConfig(mailHost, "newArtifactsDir", null, null, "42", true, "", "", "default", result, goConfigDao.md5OfConfigFile());
    assertThat(goConfigService.serverConfig().getSiteUrl(), is(new ServerSiteUrlConfig()));
    assertThat(goConfigService.serverConfig().getSecureSiteUrl(), is(new ServerSiteUrlConfig()));
}
Also used : HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) GoCipher(com.thoughtworks.go.security.GoCipher) ServerSiteUrlConfig(com.thoughtworks.go.domain.ServerSiteUrlConfig) Test(org.junit.Test)

Aggregations

ServerSiteUrlConfig (com.thoughtworks.go.domain.ServerSiteUrlConfig)18 Test (org.junit.Test)13 BasicCruiseConfig (com.thoughtworks.go.config.BasicCruiseConfig)4 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)4 ServerConfig (com.thoughtworks.go.config.ServerConfig)3 GoCipher (com.thoughtworks.go.security.GoCipher)2 GoCache (com.thoughtworks.go.server.cache.GoCache)2 SendEmailMessage (com.thoughtworks.go.server.messaging.SendEmailMessage)1 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)1 HttpTestUtil (com.thoughtworks.go.server.util.HttpTestUtil)1 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)1 File (java.io.File)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 URL (java.net.URL)1 WebAppContext (org.eclipse.jetty.webapp.WebAppContext)1 BeforeClass (org.junit.BeforeClass)1 WebApplicationContext (org.springframework.web.context.WebApplicationContext)1 UrlRewriteFilter (org.tuckey.web.filters.urlrewrite.UrlRewriteFilter)1