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;
}
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;
}
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()));
}
}
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"));
}
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());
}
Aggregations