use of com.thoughtworks.go.domain.SiteUrl in project gocd by gocd.
the class CreateOrUpdateConfigServerSiteUrlsCommandTest method shouldAddBackupConfig.
@Test
void shouldAddBackupConfig() throws Exception {
SiteUrls siteUrls = new SiteUrls(new SiteUrl("http://foo"), new SecureSiteUrl("https://bar"));
CreateOrUpdateConfigServerSiteUrlsCommand command = new CreateOrUpdateConfigServerSiteUrlsCommand(siteUrls);
command.update(cruiseConfig);
assertThat(cruiseConfig.server().getSiteUrls()).isEqualTo(siteUrls);
}
use of com.thoughtworks.go.domain.SiteUrl in project gocd by gocd.
the class BaseUrlChangeListenerTest method shouldFlushCacheWhenBaseUrlConfigChangesAndUpdateTheSiteURLAndSecureSiteURLToTheNewValues.
@Test
public void shouldFlushCacheWhenBaseUrlConfigChangesAndUpdateTheSiteURLAndSecureSiteURLToTheNewValues() throws IOException {
GoCache cache = mock(GoCache.class);
BaseUrlChangeListener listener = new BaseUrlChangeListener(new SiteUrl(""), new SecureSiteUrl(""), cache);
CruiseConfig newCruiseConfig = new BasicCruiseConfig();
newCruiseConfig.setServerConfig(serverConfigWith("http://blah.com", "https://blah.com"));
listener.onConfigChange(newCruiseConfig);
listener.onConfigChange(newCruiseConfig);
verify(cache, times(1)).remove("urls_cache");
}
use of com.thoughtworks.go.domain.SiteUrl in project gocd by gocd.
the class SecurityServiceIntegrationTest method shouldReturnSecureSiteUrlAsCasServiceBaseUrlIfBothSiteUrlAndSecureSiteUrlAreDefined.
@Test
public void shouldReturnSecureSiteUrlAsCasServiceBaseUrlIfBothSiteUrlAndSecureSiteUrlAreDefined() throws Exception {
configHelper.setBaseUrls(new SiteUrl("http://example.com"), new SecureSiteUrl("https://example.com"));
assertThat(securityService.casServiceBaseUrl(), is("https://example.com"));
}
use of com.thoughtworks.go.domain.SiteUrl in project gocd by gocd.
the class ServerConfigServiceIntegrationTest method shouldUseTheSecureSiteUrlInspiteOfCallerNotForcingSsl_whenAlreadyUsingHTTPS.
@Test
public void shouldUseTheSecureSiteUrlInspiteOfCallerNotForcingSsl_whenAlreadyUsingHTTPS() throws URISyntaxException {
configHelper.setBaseUrls(new SiteUrl("http://foo.com:80"), new SecureSiteUrl("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"));
}
Aggregations