use of com.thoughtworks.go.config.BasicCruiseConfig in project gocd by gocd.
the class DiskSpaceFullCheckerTest method shouldReturnTrueIfTheArtifactFolderHasSizeLimit.
@Test
public void shouldReturnTrueIfTheArtifactFolderHasSizeLimit() {
new SystemEnvironment().setProperty(SystemEnvironment.ARTIFACT_FULL_SIZE_LIMIT, "1M");
CruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.setServerConfig(new ServerConfig(".", new SecurityConfig()));
ArtifactsDiskSpaceFullChecker fullChecker = createChecker(cruiseConfig);
ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
fullChecker.check(result);
assertThat(result.canContinue(), is(true));
}
use of com.thoughtworks.go.config.BasicCruiseConfig in project gocd by gocd.
the class GoConfigInvalidExceptionTest method shouldReturnAllErrorMessagesOnCruiseConfig.
@Test
public void shouldReturnAllErrorMessagesOnCruiseConfig() {
BasicCruiseConfig cruiseConfig = GoConfigMother.defaultCruiseConfig();
cruiseConfig.addError("BasicCruiseConfig_key", "BasicCruiseConfig_error");
PipelineConfig pipelineConfig = PipelineConfigMother.pipelineConfig("");
pipelineConfig.addError("PipelineConfig_key", "PipelineConfig_error");
cruiseConfig.addPipeline("default", pipelineConfig);
GoConfigInvalidException exception = new GoConfigInvalidException(cruiseConfig, "");
assertThat(exception.getAllErrorMessages(), is("BasicCruiseConfig_error, PipelineConfig_error"));
}
use of com.thoughtworks.go.config.BasicCruiseConfig 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 ServerSiteUrlConfig(""), new ServerSiteUrlConfig(""), 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.config.BasicCruiseConfig in project gocd by gocd.
the class SecurityAuthConfigCreateCommandTest method shouldInvokePluginValidationsBeforeSave.
@Test
public void shouldInvokePluginValidationsBeforeSave() throws Exception {
ValidationResult validationResult = new ValidationResult();
validationResult.addError(new ValidationError("key", "error"));
when(extension.validatePluginConfiguration(eq("aws"), Matchers.<Map<String, String>>any())).thenReturn(validationResult);
SecurityAuthConfig newProfile = new SecurityAuthConfig("foo", "aws", new ConfigurationProperty(new ConfigurationKey("key"), new ConfigurationValue("val")));
PluginProfileCommand command = new SecurityAuthConfigCreateCommand(mock(GoConfigService.class), newProfile, extension, null, new HttpLocalizedOperationResult());
BasicCruiseConfig cruiseConfig = new BasicCruiseConfig();
thrown.expect(PluginProfileNotFoundException.class);
thrown.expectMessage("Security auth config `foo` does not exist.");
command.isValid(cruiseConfig);
command.update(cruiseConfig);
assertThat(newProfile.first().errors().size(), is(1));
assertThat(newProfile.first().errors().asString(), is("error"));
}
use of com.thoughtworks.go.config.BasicCruiseConfig in project gocd by gocd.
the class RoleConfigCreateCommandTest method shouldAddPluginRoleConfig.
@Test
public void shouldAddPluginRoleConfig() throws Exception {
BasicCruiseConfig cruiseConfig = GoConfigMother.defaultCruiseConfig();
PluginRoleConfig role = new PluginRoleConfig("blackbird", "ldap");
RoleConfigCreateCommand command = new RoleConfigCreateCommand(null, role, extension, null, null);
command.update(cruiseConfig);
assertThat(cruiseConfig.server().security().getRoles().findByName(new CaseInsensitiveString("blackbird")), equalTo(role));
}
Aggregations