Search in sources :

Example 6 with SecureSiteUrl

use of com.thoughtworks.go.domain.SecureSiteUrl 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)

Example 7 with SecureSiteUrl

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

the class SiteUrlsTest method shouldAddErrorsIfSiteUrlsAreInvalid.

@Test
void shouldAddErrorsIfSiteUrlsAreInvalid() {
    SiteUrls siteUrls = new SiteUrls(new SiteUrl("htp://foo.bar"), new SecureSiteUrl("http://foo.bar"));
    siteUrls.validate(null);
    assertThat(siteUrls.getSiteUrl().errors()).hasSize(1).containsEntry("siteUrl", Collections.singletonList("Invalid format for site url. 'htp://foo.bar' must start with http/s"));
    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)

Example 8 with SecureSiteUrl

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

the class SiteUrlsTest method shouldAddErrorsIfSiteUrlIsInvalid.

@Test
void shouldAddErrorsIfSiteUrlIsInvalid() {
    SiteUrls siteUrls = new SiteUrls(new SiteUrl("htp://foo.bar"), new SecureSiteUrl("https://foo.bar"));
    siteUrls.validate(null);
    assertThat(siteUrls.getSiteUrl().errors()).hasSize(1).containsEntry("siteUrl", Collections.singletonList("Invalid format for site url. 'htp://foo.bar' must start with http/s"));
}
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 9 with SecureSiteUrl

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

the class SiteUrlsTest method shouldNotAddErrorsIfSiteUrlsAreValid.

@Test
void shouldNotAddErrorsIfSiteUrlsAreValid() {
    SiteUrls siteUrls = new SiteUrls(new SiteUrl("http://foo.bar"), new SecureSiteUrl("https://foo.bar"));
    siteUrls.validate(null);
    assertThat(siteUrls.errors()).hasSize(0);
}
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 10 with SecureSiteUrl

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

the class BaseUrlChangeListenerTest method shouldNotFlushCacheWhenBaseUrlConfigIsNotChanged.

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

Aggregations

SecureSiteUrl (com.thoughtworks.go.domain.SecureSiteUrl)20 SiteUrl (com.thoughtworks.go.domain.SiteUrl)19 Test (org.junit.jupiter.api.Test)16 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