Search in sources :

Example 6 with ServerSiteUrlConfig

use of com.thoughtworks.go.domain.ServerSiteUrlConfig 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 ServerSiteUrlConfig("siteURL"), new ServerSiteUrlConfig("secureURL"));
    one.addError("siteUrl", "I dont like this url");
    assertThat(one, is(new ServerConfig(new SecurityConfig(), new MailHost(new GoCipher()), new ServerSiteUrlConfig("siteURL"), new ServerSiteUrlConfig("secureURL"))));
}
Also used : GoCipher(com.thoughtworks.go.security.GoCipher) ServerSiteUrlConfig(com.thoughtworks.go.domain.ServerSiteUrlConfig) Test(org.junit.Test)

Example 7 with ServerSiteUrlConfig

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

the class ServerConfigService method siteUrlFor.

public String siteUrlFor(String url, boolean forceSsl) throws URISyntaxException {
    String scheme = new URI(url).getScheme();
    ServerSiteUrlConfig siteUrl = forceSsl || (scheme != null && scheme.equals("https")) ? getSecureSiteUrl() : serverConfig().getSiteUrl();
    return siteUrl.siteUrlFor(url, false);
}
Also used : URI(java.net.URI) ServerSiteUrlConfig(com.thoughtworks.go.domain.ServerSiteUrlConfig)

Example 8 with ServerSiteUrlConfig

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

the class BaseUrlChangeListenerTest method shouldNotFlushCacheWhenBaseUrlConfigIsNotChanged.

@Test
public void shouldNotFlushCacheWhenBaseUrlConfigIsNotChanged() {
    GoCache cache = mock(GoCache.class);
    BaseUrlChangeListener listener = new BaseUrlChangeListener(new ServerSiteUrlConfig(""), new ServerSiteUrlConfig(""), cache);
    CruiseConfig newCruiseConfig = new BasicCruiseConfig();
    newCruiseConfig.setServerConfig(serverConfigWith("", ""));
    listener.onConfigChange(newCruiseConfig);
    verifyZeroInteractions(cache);
}
Also used : GoCache(com.thoughtworks.go.server.cache.GoCache) 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 9 with ServerSiteUrlConfig

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

the class SecurityServiceIntegrationTest method shouldReturnSiteUrlAsCasServiceBaseUrlIfOnlySiteUrlIsDefined.

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

Example 10 with ServerSiteUrlConfig

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

the class ServerConfigServiceIntegrationTest method shouldUseTheSiteUrlWhenSecureSiteUrlIsNotPresentAndOnlyIfSiteUrlIsHttps.

@Test
public void shouldUseTheSiteUrlWhenSecureSiteUrlIsNotPresentAndOnlyIfSiteUrlIsHttps() throws URISyntaxException {
    configHelper.setBaseUrls(new ServerSiteUrlConfig("https://foo.com"), new ServerSiteUrlConfig());
    assertThat(serverConfigService.siteUrlFor("http://test.host/foo/bar", true), is("https://foo.com/foo/bar"));
    assertThat(serverConfigService.siteUrlFor("http://test.host/foo/bar", false), is("https://foo.com/foo/bar"));
}
Also used : 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