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"))));
}
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);
}
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);
}
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"));
}
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"));
}
Aggregations