use of com.thoughtworks.go.config.BasicCruiseConfig in project gocd by gocd.
the class SecurityAuthConfigCreateCommandTest method shouldAddSecurityAuthConfig.
@Test
public void shouldAddSecurityAuthConfig() throws Exception {
BasicCruiseConfig cruiseConfig = GoConfigMother.defaultCruiseConfig();
SecurityAuthConfig authConfig = new SecurityAuthConfig("foo", "ldap");
SecurityAuthConfigCreateCommand command = new SecurityAuthConfigCreateCommand(null, authConfig, extension, null, null);
command.update(cruiseConfig);
assertThat(cruiseConfig.server().security().securityAuthConfigs().find("foo"), equalTo(authConfig));
}
use of com.thoughtworks.go.config.BasicCruiseConfig in project gocd by gocd.
the class DiskSpaceFullCheckerTest method shouldFormatLowDiskSpaceWarningMailWithHelpLinksHttpAndSiteUrl.
@Test
public void shouldFormatLowDiskSpaceWarningMailWithHelpLinksHttpAndSiteUrl() throws URISyntaxException {
String expectedHelpUrl = "https://docs.gocd.io/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.config.BasicCruiseConfig 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.config.BasicCruiseConfig 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.config.BasicCruiseConfig in project gocd by gocd.
the class PackageDefinitionTest method shouldValidateIfNameIsMissing.
@Test
public void shouldValidateIfNameIsMissing() {
PackageDefinition packageDefinition = new PackageDefinition();
packageDefinition.validate(new ConfigSaveValidationContext(new BasicCruiseConfig(), null));
assertThat(packageDefinition.errors().isEmpty(), is(false));
assertThat(packageDefinition.errors().getAllOn("name"), is(asList("Package name is mandatory")));
}
Aggregations