use of com.thoughtworks.go.domain.ServerSiteUrlConfig in project gocd by gocd.
the class ArtifactsDiskSpaceFullCheckerTest method configWithSiteUrl.
private static CruiseConfig configWithSiteUrl() {
ServerConfig serverConfig = new ServerConfig(null, null, new ServerSiteUrlConfig("http://test.host"), new ServerSiteUrlConfig("https://test.host"));
CruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.setServerConfig(serverConfig);
return cruiseConfig;
}
use of com.thoughtworks.go.domain.ServerSiteUrlConfig in project gocd by gocd.
the class DiskSpaceFullCheckerTest method shouldFormatLowDiskSpaceWarningMailWithHelpLinksHttpAndSiteUrl.
@Test
public void shouldFormatLowDiskSpaceWarningMailWithHelpLinksHttpAndSiteUrl() throws URISyntaxException {
String expectedHelpUrl = "https://docs.gocd.org/current/installation/configuring_server_details.html";
ServerConfig serverConfig = new ServerConfig(null, null, new ServerSiteUrlConfig("http://test.host"), new ServerSiteUrlConfig("https://test.host"));
CruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.setServerConfig(serverConfig);
GoConfigService goConfigService = mock(GoConfigService.class);
when(goConfigService.artifactsDir()).thenReturn(null);
when(goConfigService.currentCruiseConfig()).thenReturn(cruiseConfig);
when(goConfigService.adminEmail()).thenReturn("admin@email.com");
ArtifactsDiskSpaceFullChecker diskSpaceFullChecker = new ArtifactsDiskSpaceFullChecker(new SystemEnvironment(), null, goConfigService, null) {
@Override
protected String targetFolderCanonicalPath() {
return "";
}
};
SendEmailMessage actual = diskSpaceFullChecker.createEmail();
assertThat(actual.getBody(), Matchers.containsString(expectedHelpUrl));
}
use of com.thoughtworks.go.domain.ServerSiteUrlConfig in project gocd by gocd.
the class UrlRewriterIntegrationTest method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
ServletHelper.init();
httpUtil = new HttpTestUtil(new HttpTestUtil.ContextCustomizer() {
public void customize(WebAppContext ctx) throws Exception {
wac = mock(WebApplicationContext.class);
ctx.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
URL resource = getClass().getClassLoader().getResource("WEB-INF/urlrewrite.xml");
if (resource == null) {
throw new RuntimeException("Cannot load WEB-INF/urlrewrite.xml");
}
ctx.setBaseResource(Resource.newResource(new File(resource.getFile()).getParent()));
ctx.addFilter(UrlRewriteFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST)).setInitParameter("confPath", "/urlrewrite.xml");
ctx.addServlet(HttpTestUtil.EchoServlet.class, "/*");
}
});
httpUtil.httpConnector(HTTP);
httpUtil.httpsConnector(HTTPS);
when(wac.getBean("serverConfigService")).thenReturn(new BaseUrlProvider() {
public boolean hasAnyUrlConfigured() {
return useConfiguredUrls;
}
public String siteUrlFor(String url, boolean forceSsl) throws URISyntaxException {
ServerSiteUrlConfig siteUrl = forceSsl ? new ServerSiteUrlConfig("https://127.2.2.2:" + 9071) : new ServerSiteUrlConfig("http://127.2.2.2:" + 5197);
return siteUrl.siteUrlFor(url);
}
});
httpUtil.start();
originalSslPort = System.getProperty(SystemEnvironment.CRUISE_SERVER_SSL_PORT);
System.setProperty(SystemEnvironment.CRUISE_SERVER_SSL_PORT, String.valueOf(9071));
}
use of com.thoughtworks.go.domain.ServerSiteUrlConfig in project gocd by gocd.
the class ServerConfigTest method shouldReturnDefaultTaskRepositoryLocation.
@Test
public void shouldReturnDefaultTaskRepositoryLocation() {
ServerConfig serverConfig = new ServerConfig(null, null, new ServerSiteUrlConfig("http://foo.bar:813"), new ServerSiteUrlConfig());
assertThat(serverConfig.getCommandRepositoryLocation(), Is.is("default"));
}
use of com.thoughtworks.go.domain.ServerSiteUrlConfig in project gocd by gocd.
the class ServerConfigTest method shouldReturnAnEmptyForSecureSiteUrlIfOnlySiteUrlIsConfigured.
@Test
public void shouldReturnAnEmptyForSecureSiteUrlIfOnlySiteUrlIsConfigured() throws Exception {
ServerConfig serverConfig = new ServerConfig(null, null, new ServerSiteUrlConfig("http://foo.bar:813"), new ServerSiteUrlConfig());
assertThat(serverConfig.getHttpsUrl(), is(new ServerSiteUrlConfig()));
}
Aggregations