use of com.thoughtworks.go.plugin.api.config.Property in project gocd by gocd.
the class JsonBasedTaskExtensionHandler_V1 method configPropertiesAsMap.
private Map configPropertiesAsMap(TaskConfig taskConfig) {
HashMap properties = new HashMap();
for (Property property : taskConfig.list()) {
final HashMap propertyValue = new HashMap();
propertyValue.put("value", property.getValue());
propertyValue.put("secure", property.getOption(Property.SECURE));
propertyValue.put("required", property.getOption(Property.REQUIRED));
properties.put(property.getKey(), propertyValue);
}
return properties;
}
use of com.thoughtworks.go.plugin.api.config.Property in project gocd by gocd.
the class PluginSettings method populateSettingsMap.
public void populateSettingsMap(PluginSettingsConfiguration configuration) {
for (Property property : configuration.list()) {
String settingsKey = property.getKey();
Map<String, String> map = getSettingsMapFor(settingsKey);
map.put(VALUE_KEY, "");
}
}
use of com.thoughtworks.go.plugin.api.config.Property 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"));
}
use of com.thoughtworks.go.plugin.api.config.Property in project gocd by gocd.
the class ConfigurationPropertyBuilderTest method shouldCreateWithValueForAUnsecuredProperty.
@Test
public void shouldCreateWithValueForAUnsecuredProperty() {
Property key = new Property("key");
key.with(Property.SECURE, false);
ConfigurationProperty property = new ConfigurationPropertyBuilder().create("key", "value", null, false);
assertThat(property.getConfigurationValue().getValue(), is("value"));
assertNull(property.getEncryptedConfigurationValue());
}
use of com.thoughtworks.go.plugin.api.config.Property in project gocd by gocd.
the class TaskConfig method list.
public List<? extends Property> list() {
ArrayList<TaskConfigProperty> list = new ArrayList<>();
for (Property property : super.list()) {
list.add((TaskConfigProperty) property);
}
Collections.sort(list);
return list;
}
Aggregations