Search in sources :

Example 56 with ConfigurationValue

use of com.thoughtworks.go.domain.config.ConfigurationValue in project gocd by gocd.

the class RoleConfigurationValidatorTest method shouldAddErrorsInAbsenceOfPlugin.

@Test
public void shouldAddErrorsInAbsenceOfPlugin() throws Exception {
    ConfigurationProperty property = new ConfigurationProperty(new ConfigurationKey("username"), new ConfigurationValue("view"));
    PluginRoleConfig roleConfig = new PluginRoleConfig("admin", "auth_id", property);
    when(extension.validateRoleConfiguration("pluginId", Collections.singletonMap("username", "view"))).thenThrow(new PluginNotFoundException("not found"));
    validator.validate(roleConfig, "pluginId");
    assertTrue(roleConfig.hasErrors());
    assertThat(roleConfig.errors().get("pluginRole").get(0), is("Unable to validate `pluginRole` configuration, missing plugin: pluginId"));
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) ConfigurationValue(com.thoughtworks.go.domain.config.ConfigurationValue) ConfigurationKey(com.thoughtworks.go.domain.config.ConfigurationKey) PluginNotFoundException(com.thoughtworks.go.plugin.access.PluginNotFoundException) PluginRoleConfig(com.thoughtworks.go.config.PluginRoleConfig) Test(org.junit.Test)

Aggregations

ConfigurationValue (com.thoughtworks.go.domain.config.ConfigurationValue)56 ConfigurationProperty (com.thoughtworks.go.domain.config.ConfigurationProperty)50 ConfigurationKey (com.thoughtworks.go.domain.config.ConfigurationKey)49 Test (org.junit.Test)47 EncryptedConfigurationValue (com.thoughtworks.go.domain.config.EncryptedConfigurationValue)28 Configuration (com.thoughtworks.go.domain.config.Configuration)20 PluginConfiguration (com.thoughtworks.go.domain.config.PluginConfiguration)14 GoCipher (com.thoughtworks.go.security.GoCipher)10 PackageConfiguration (com.thoughtworks.go.plugin.access.packagematerial.PackageConfiguration)9 PluggableInstanceSettings (com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings)9 ValidationResult (com.thoughtworks.go.plugin.api.response.validation.ValidationResult)7 Metadata (com.thoughtworks.go.plugin.domain.common.Metadata)7 PluginConfiguration (com.thoughtworks.go.plugin.domain.common.PluginConfiguration)7 ValidationError (com.thoughtworks.go.plugin.api.response.validation.ValidationError)6 ElasticProfile (com.thoughtworks.go.config.elastic.ElasticProfile)5 PluginRoleConfig (com.thoughtworks.go.config.PluginRoleConfig)4 SCMConfiguration (com.thoughtworks.go.plugin.access.scm.SCMConfiguration)4 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)4 SecurityAuthConfig (com.thoughtworks.go.config.SecurityAuthConfig)3 SCM (com.thoughtworks.go.domain.scm.SCM)3