Search in sources :

Example 21 with SecretConfig

use of com.thoughtworks.go.config.SecretConfig in project gocd by gocd.

the class RuleAwarePluginProfileCommandTest method shouldValidateIfSecretConfigIdIsNull.

@Test
public void shouldValidateIfSecretConfigIdIsNull() {
    HttpLocalizedOperationResult result = new HttpLocalizedOperationResult();
    SecretConfig securityAuthConfig = new SecretConfig(null, "some-plugin", new ConfigurationProperty(new ConfigurationKey("key"), new ConfigurationValue("value")));
    cruiseConfig.getSecretConfigs().add(securityAuthConfig);
    RuleAwarePluginProfileCommand command = new StubSecretConfigCommand(goConfigService, securityAuthConfig, currentUser, result);
    assertThatThrownBy(() -> command.isValid(cruiseConfig)).hasMessageContaining(EntityType.ElasticProfile.idCannotBeBlank());
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) ConfigurationValue(com.thoughtworks.go.domain.config.ConfigurationValue) SecretConfig(com.thoughtworks.go.config.SecretConfig) ConfigurationKey(com.thoughtworks.go.domain.config.ConfigurationKey) Test(org.junit.jupiter.api.Test)

Aggregations

SecretConfig (com.thoughtworks.go.config.SecretConfig)21 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)13 Test (org.junit.jupiter.api.Test)13 BasicCruiseConfig (com.thoughtworks.go.config.BasicCruiseConfig)2 ConfigurationKey (com.thoughtworks.go.domain.config.ConfigurationKey)2 ConfigurationProperty (com.thoughtworks.go.domain.config.ConfigurationProperty)2 ConfigurationValue (com.thoughtworks.go.domain.config.ConfigurationValue)2 SecretConfigs (com.thoughtworks.go.config.SecretConfigs)1 GoConfigInvalidException (com.thoughtworks.go.config.exceptions.GoConfigInvalidException)1 RecordNotFoundException (com.thoughtworks.go.config.exceptions.RecordNotFoundException)1 SecretConfigUsage (com.thoughtworks.go.domain.SecretConfigUsage)1 ValidationError (com.thoughtworks.go.plugin.api.response.validation.ValidationError)1 ValidationResult (com.thoughtworks.go.plugin.api.response.validation.ValidationResult)1 EntityHashingService (com.thoughtworks.go.server.service.EntityHashingService)1 GoConfigService (com.thoughtworks.go.server.service.GoConfigService)1 HashSet (java.util.HashSet)1