Search in sources :

Example 6 with Property

use of com.thoughtworks.go.plugin.api.config.Property in project gocd by gocd.

the class PluggableTaskPluginInfoBuilder method configurations.

static List<PluginConfiguration> configurations(TaskConfig config) {
    ArrayList<PluginConfiguration> pluginConfigurations = new ArrayList<>();
    for (Property property : config.list()) {
        Map<String, Object> metaData = new HashMap<>();
        metaData.put("required", property.getOption(Property.REQUIRED));
        metaData.put("secure", property.getOption(Property.SECURE));
        pluginConfigurations.add(new PluginConfiguration(property.getKey(), metaData));
    }
    return pluginConfigurations;
}
Also used : PluginConfiguration(com.thoughtworks.go.server.ui.plugins.PluginConfiguration) Property(com.thoughtworks.go.plugin.api.config.Property)

Example 7 with Property

use of com.thoughtworks.go.plugin.api.config.Property in project gocd by gocd.

the class PluggableTaskViewModelBuilder method configurations.

private List<PluginConfiguration> configurations(TaskConfig config) {
    ArrayList<PluginConfiguration> pluginConfigurations = new ArrayList<>();
    for (Property property : config.list()) {
        Map<String, Object> metaData = new HashMap<>();
        metaData.put(REQUIRED_OPTION, property.getOption(Property.REQUIRED));
        metaData.put(SECURE_OPTION, property.getOption(Property.SECURE));
        pluginConfigurations.add(new PluginConfiguration(property.getKey(), metaData));
    }
    return pluginConfigurations;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) PluginConfiguration(com.thoughtworks.go.server.ui.plugins.PluginConfiguration) Property(com.thoughtworks.go.plugin.api.config.Property)

Example 8 with Property

use of com.thoughtworks.go.plugin.api.config.Property in project gocd by gocd.

the class PluggableSCMMaterialPollerTest method assertConfiguration.

private void assertConfiguration(com.thoughtworks.go.plugin.api.config.Configuration configurationsSentToPlugin, Configuration configurationInMaterial) {
    assertThat(configurationsSentToPlugin.size(), is(configurationInMaterial.size()));
    for (ConfigurationProperty property : configurationInMaterial) {
        Property configuration = configurationsSentToPlugin.get(property.getConfigurationKey().getName());
        assertThat(configuration.getValue(), is(property.getValue()));
    }
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) Property(com.thoughtworks.go.plugin.api.config.Property) ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty)

Example 9 with Property

use of com.thoughtworks.go.plugin.api.config.Property in project gocd by gocd.

the class ConfigurationPropertyBuilderTest method shouldCreateWithErrorsInPresenceOfEncryptedTextInputForUnSecuredProperty.

@Test
public void shouldCreateWithErrorsInPresenceOfEncryptedTextInputForUnSecuredProperty() {
    Property key = new Property("key");
    key.with(Property.SECURE, false);
    ConfigurationProperty property = new ConfigurationPropertyBuilder().create("key", null, "enc_value", false);
    assertThat(property.errors().get("encryptedValue").get(0), is("encrypted_value cannot be specified to a unsecured property."));
    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)

Example 10 with Property

use of com.thoughtworks.go.plugin.api.config.Property in project gocd by gocd.

the class ConfigurationPropertyBuilderTest method shouldCreatePropertyInAbsenceOfPlainAndEncryptedTextInputForSecureProperty.

@Test
public void shouldCreatePropertyInAbsenceOfPlainAndEncryptedTextInputForSecureProperty() throws Exception {
    Property key = new Property("key");
    key.with(Property.SECURE, true);
    ConfigurationProperty property = new ConfigurationPropertyBuilder().create("key", null, null, true);
    assertThat(property.errors().size(), is(0));
    assertThat(property.getConfigKeyName(), is("key"));
    assertNull(property.getEncryptedConfigurationValue());
    assertNull(property.getConfigurationValue());
}
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

Property (com.thoughtworks.go.plugin.api.config.Property)26 Test (org.junit.Test)15 ConfigurationProperty (com.thoughtworks.go.domain.config.ConfigurationProperty)13 TaskConfigProperty (com.thoughtworks.go.plugin.api.task.TaskConfigProperty)8 TaskConfig (com.thoughtworks.go.plugin.api.task.TaskConfig)4 TaskProperty (com.thoughtworks.go.domain.TaskProperty)3 PluginConfiguration (com.thoughtworks.go.domain.config.PluginConfiguration)3 TaskPreference (com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference)3 ArrayList (java.util.ArrayList)3 PluggableTask (com.thoughtworks.go.config.pluggabletask.PluggableTask)2 Configuration (com.thoughtworks.go.domain.config.Configuration)2 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)2 PluginConfiguration (com.thoughtworks.go.server.ui.plugins.PluginConfiguration)2 HashMap (java.util.HashMap)2 ConfigurationValue (com.thoughtworks.go.domain.config.ConfigurationValue)1 PluginSettingsProperty (com.thoughtworks.go.plugin.access.common.settings.PluginSettingsProperty)1 GoPluginApiRequest (com.thoughtworks.go.plugin.api.request.GoPluginApiRequest)1 ValidationError (com.thoughtworks.go.plugin.api.response.validation.ValidationError)1 ValidationResult (com.thoughtworks.go.plugin.api.response.validation.ValidationResult)1 GoCipher (com.thoughtworks.go.security.GoCipher)1