Search in sources :

Example 46 with ConfigurationProperty

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

the class PackageRepository method applyPackagePluginMetadata.

@PostConstruct
public void applyPackagePluginMetadata() {
    String pluginId = pluginConfiguration.getId();
    for (ConfigurationProperty configurationProperty : configuration) {
        RepositoryMetadataStore repositoryMetadataStore = RepositoryMetadataStore.getInstance();
        if (repositoryMetadataStore.getMetadata(pluginId) != null) {
            boolean isSecureProperty = repositoryMetadataStore.hasOption(pluginId, configurationProperty.getConfigurationKey().getName(), PackageConfiguration.SECURE);
            configurationProperty.handleSecureValueConfiguration(isSecureProperty);
        }
    }
    for (PackageDefinition packageDefinition : packages) {
        packageDefinition.applyPackagePluginMetadata(pluginId);
    }
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) RepositoryMetadataStore(com.thoughtworks.go.plugin.access.packagematerial.RepositoryMetadataStore) PostConstruct(javax.annotation.PostConstruct)

Example 47 with ConfigurationProperty

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

the class SCM method applyPluginMetadata.

@PostConstruct
public void applyPluginMetadata() {
    String pluginId = getPluginId();
    for (ConfigurationProperty configurationProperty : configuration) {
        SCMMetadataStore scmMetadataStore = SCMMetadataStore.getInstance();
        if (scmMetadataStore.getConfigurationMetadata(pluginId) != null) {
            boolean isSecureProperty = scmMetadataStore.hasOption(pluginId, configurationProperty.getConfigurationKey().getName(), SCMConfiguration.SECURE);
            configurationProperty.handleSecureValueConfiguration(isSecureProperty);
        }
    }
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) SCMMetadataStore(com.thoughtworks.go.plugin.access.scm.SCMMetadataStore) PostConstruct(javax.annotation.PostConstruct)

Example 48 with ConfigurationProperty

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

the class SCM method getConfigForDisplay.

public String getConfigForDisplay() {
    String pluginId = getPluginId();
    SCMMetadataStore metadataStore = SCMMetadataStore.getInstance();
    List<ConfigurationProperty> propertiesToBeUsedForDisplay = ConfigurationDisplayUtil.getConfigurationPropertiesToBeUsedForDisplay(metadataStore, pluginId, configuration);
    String prefix = metadataStore.hasPlugin(pluginId) ? "" : "WARNING! Plugin missing. ";
    return prefix + configuration.forDisplay(propertiesToBeUsedForDisplay);
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) SCMMetadataStore(com.thoughtworks.go.plugin.access.scm.SCMMetadataStore)

Example 49 with ConfigurationProperty

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

the class DeletePackageConfigCommandTest method setup.

@Before
public void setup() throws Exception {
    initMocks(this);
    currentUser = new Username(new CaseInsensitiveString("user"));
    cruiseConfig = new GoConfigMother().defaultCruiseConfig();
    packageUuid = "random-uuid";
    configuration = new Configuration(new ConfigurationProperty(new ConfigurationKey("PACKAGE_ID"), new ConfigurationValue("prettyjson")));
    packageDefinition = new PackageDefinition(packageUuid, "prettyjson", configuration);
    result = new HttpLocalizedOperationResult();
    PackageRepositories repositories = cruiseConfig.getPackageRepositories();
    PackageRepository repository = new PackageRepository();
    repository.addPackage(packageDefinition);
    repositories.add(repository);
    cruiseConfig.setPackageRepositories(repositories);
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) ConfigurationValue(com.thoughtworks.go.domain.config.ConfigurationValue) HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) Configuration(com.thoughtworks.go.domain.config.Configuration) ConfigurationKey(com.thoughtworks.go.domain.config.ConfigurationKey) Username(com.thoughtworks.go.server.domain.Username) PackageDefinition(com.thoughtworks.go.domain.packagerepository.PackageDefinition) PackageRepositories(com.thoughtworks.go.domain.packagerepository.PackageRepositories) PackageRepository(com.thoughtworks.go.domain.packagerepository.PackageRepository) GoConfigMother(com.thoughtworks.go.helper.GoConfigMother) Before(org.junit.Before)

Example 50 with ConfigurationProperty

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

the class ConfigurationPropertyBuilderTest method shouldCreateWithErrorsIfBothPlainAndEncryptedTextInputAreSpecifiedForSecureProperty.

@Test
public void shouldCreateWithErrorsIfBothPlainAndEncryptedTextInputAreSpecifiedForSecureProperty() {
    Property key = new Property("key");
    key.with(Property.SECURE, true);
    ConfigurationProperty property = new ConfigurationPropertyBuilder().create("key", "value", "enc_value", true);
    assertThat(property.errors().get("configurationValue").get(0), is("You may only specify `value` or `encrypted_value`, not both!"));
    assertThat(property.errors().get("encryptedValue").get(0), is("You may only specify `value` or `encrypted_value`, not both!"));
    assertThat(property.getConfigurationValue().getValue(), is("value"));
    assertThat(property.getEncryptedValue(), is("enc_value"));
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) Property(com.thoughtworks.go.plugin.api.config.Property) ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) Test(org.junit.Test)

Aggregations

ConfigurationProperty (com.thoughtworks.go.domain.config.ConfigurationProperty)74 Test (org.junit.Test)41 Configuration (com.thoughtworks.go.domain.config.Configuration)28 ConfigurationKey (com.thoughtworks.go.domain.config.ConfigurationKey)27 ConfigurationValue (com.thoughtworks.go.domain.config.ConfigurationValue)27 PluginConfiguration (com.thoughtworks.go.domain.config.PluginConfiguration)20 EncryptedConfigurationValue (com.thoughtworks.go.domain.config.EncryptedConfigurationValue)16 Property (com.thoughtworks.go.plugin.api.config.Property)12 ValidationError (com.thoughtworks.go.plugin.api.response.validation.ValidationError)10 GoCipher (com.thoughtworks.go.security.GoCipher)9 PackageConfiguration (com.thoughtworks.go.plugin.access.packagematerial.PackageConfiguration)8 ValidationResult (com.thoughtworks.go.plugin.api.response.validation.ValidationResult)8 HashMap (java.util.HashMap)6 Map (java.util.Map)6 TaskPreference (com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference)5 SCMConfiguration (com.thoughtworks.go.plugin.access.scm.SCMConfiguration)5 ElasticProfile (com.thoughtworks.go.config.elastic.ElasticProfile)4 TaskConfig (com.thoughtworks.go.plugin.api.task.TaskConfig)4 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)4 ArrayList (java.util.ArrayList)4