use of com.thoughtworks.go.domain.config.ConfigurationKey in project gocd by gocd.
the class PluginProfileCommandTest method shouldValidateIfSecurityAuthConfigIdIsNull.
@Test
public void shouldValidateIfSecurityAuthConfigIdIsNull() {
HttpLocalizedOperationResult result = new HttpLocalizedOperationResult();
SecurityAuthConfig securityAuthConfig = new SecurityAuthConfig(null, "some-plugin", new ConfigurationProperty(new ConfigurationKey("key"), new ConfigurationValue("value")));
cruiseConfig.server().security().securityAuthConfigs().add(securityAuthConfig);
PluginProfileCommand command = new StubSecurityAuthConfigCommand(goConfigService, securityAuthConfig, currentUser, result);
assertThatThrownBy(() -> command.isValid(cruiseConfig)).hasMessageContaining(EntityType.ElasticProfile.idCannotBeBlank());
}
use of com.thoughtworks.go.domain.config.ConfigurationKey in project gocd by gocd.
the class SCMTest method shouldClearConfigurationsWhichAreEmptyAndNoErrors.
@Test
public void shouldClearConfigurationsWhichAreEmptyAndNoErrors() throws Exception {
SCM scm = new SCM();
scm.getConfiguration().add(new ConfigurationProperty(new ConfigurationKey("name-one"), new ConfigurationValue()));
scm.getConfiguration().add(new ConfigurationProperty(new ConfigurationKey("name-two"), new EncryptedConfigurationValue()));
scm.getConfiguration().add(new ConfigurationProperty(new ConfigurationKey("name-three"), null, new EncryptedConfigurationValue(), null));
ConfigurationProperty configurationProperty = new ConfigurationProperty(new ConfigurationKey("name-four"), null, new EncryptedConfigurationValue(), null);
configurationProperty.addErrorAgainstConfigurationValue("error");
scm.getConfiguration().add(configurationProperty);
scm.clearEmptyConfigurations();
assertThat(scm.getConfiguration().size(), is(1));
assertThat(scm.getConfiguration().get(0).getConfigurationKey().getName(), is("name-four"));
}
use of com.thoughtworks.go.domain.config.ConfigurationKey in project gocd by gocd.
the class PackageDefinitionTest method shouldClearConfigurationsWhichAreEmptyAndNoErrors.
@Test
public void shouldClearConfigurationsWhichAreEmptyAndNoErrors() throws Exception {
PackageDefinition packageDefinition = new PackageDefinition();
packageDefinition.getConfiguration().add(new ConfigurationProperty(new ConfigurationKey("name-one"), new ConfigurationValue()));
packageDefinition.getConfiguration().add(new ConfigurationProperty(new ConfigurationKey("name-two"), new EncryptedConfigurationValue()));
packageDefinition.getConfiguration().add(new ConfigurationProperty(new ConfigurationKey("name-three"), null, new EncryptedConfigurationValue(), null));
ConfigurationProperty configurationProperty = new ConfigurationProperty(new ConfigurationKey("name-four"), null, new EncryptedConfigurationValue(), null);
configurationProperty.addErrorAgainstConfigurationValue("error");
packageDefinition.getConfiguration().add(configurationProperty);
packageDefinition.clearEmptyConfigurations();
assertThat(packageDefinition.getConfiguration().size(), is(1));
assertThat(packageDefinition.getConfiguration().get(0).getConfigurationKey().getName(), is("name-four"));
}
use of com.thoughtworks.go.domain.config.ConfigurationKey in project gocd by gocd.
the class PackageRepositoryTest method shouldClearConfigurationsWhichAreEmptyAndNoErrors.
@Test
public void shouldClearConfigurationsWhichAreEmptyAndNoErrors() throws Exception {
PackageRepository packageRepository = new PackageRepository();
packageRepository.getConfiguration().add(new ConfigurationProperty(new ConfigurationKey("name-one"), new ConfigurationValue()));
packageRepository.getConfiguration().add(new ConfigurationProperty(new ConfigurationKey("name-two"), new EncryptedConfigurationValue()));
packageRepository.getConfiguration().add(new ConfigurationProperty(new ConfigurationKey("name-three"), null, new EncryptedConfigurationValue(), null));
ConfigurationProperty configurationProperty = new ConfigurationProperty(new ConfigurationKey("name-four"), null, new EncryptedConfigurationValue(), null);
configurationProperty.addErrorAgainstConfigurationValue("error");
packageRepository.getConfiguration().add(configurationProperty);
packageRepository.clearEmptyConfigurations();
assertThat(packageRepository.getConfiguration().size(), is(1));
assertThat(packageRepository.getConfiguration().get(0).getConfigurationKey().getName(), is("name-four"));
}
use of com.thoughtworks.go.domain.config.ConfigurationKey in project gocd by gocd.
the class PluginSettings method populateSettingsMap.
public PluginSettings populateSettingsMap(PluginSettingsConfiguration configuration) {
for (Property property : configuration.list()) {
String settingsKey = property.getKey();
settingsMap.add(new ConfigurationProperty(new ConfigurationKey(settingsKey), new ConfigurationValue("")));
}
return this;
}
Aggregations