Search in sources :

Example 31 with ConfigurationProperty

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

the class XmlPartialConfigProvider method getFiles.

public File[] getFiles(File configRepoCheckoutDirectory, PartialConfigLoadContext context) {
    String pattern = defaultPattern;
    Configuration configuration = context.configuration();
    if (configuration != null) {
        ConfigurationProperty explicitPattern = configuration.getProperty("pattern");
        if (explicitPattern != null) {
            pattern = explicitPattern.getValue();
        }
    }
    return getFiles(configRepoCheckoutDirectory, pattern);
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) Configuration(com.thoughtworks.go.domain.config.Configuration)

Example 32 with ConfigurationProperty

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

the class ConfigurationPropertyBuilderTest method shouldCreateConfigurationPropertyWithEncyrptedValueForSecureProperty.

@Test
public void shouldCreateConfigurationPropertyWithEncyrptedValueForSecureProperty() {
    Property key = new Property("key");
    key.with(Property.SECURE, true);
    ConfigurationProperty property = new ConfigurationPropertyBuilder().create("key", null, "enc_value", true);
    assertThat(property.getConfigKeyName(), is("key"));
    assertThat(property.getEncryptedValue(), is("enc_value"));
    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)

Example 33 with ConfigurationProperty

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

the class ConfigurationPropertyBuilderTest method shouldCreateWithEncyrptedValueForOnlyPlainTextInputForSecureProperty.

@Test
public void shouldCreateWithEncyrptedValueForOnlyPlainTextInputForSecureProperty() throws Exception {
    Property key = new Property("key");
    key.with(Property.SECURE, true);
    ConfigurationProperty property = new ConfigurationPropertyBuilder().create("key", "value", null, true);
    assertThat(property.getConfigKeyName(), is("key"));
    assertThat(property.getEncryptedValue(), is(new GoCipher().encrypt("value")));
    assertNull(property.getConfigurationValue());
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) GoCipher(com.thoughtworks.go.security.GoCipher) Property(com.thoughtworks.go.plugin.api.config.Property) ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) Test(org.junit.Test)

Example 34 with ConfigurationProperty

use of com.thoughtworks.go.domain.config.ConfigurationProperty 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)

Example 35 with ConfigurationProperty

use of com.thoughtworks.go.domain.config.ConfigurationProperty 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)

Aggregations

ConfigurationProperty (com.thoughtworks.go.domain.config.ConfigurationProperty)113 Test (org.junit.Test)71 ConfigurationKey (com.thoughtworks.go.domain.config.ConfigurationKey)51 ConfigurationValue (com.thoughtworks.go.domain.config.ConfigurationValue)49 EncryptedConfigurationValue (com.thoughtworks.go.domain.config.EncryptedConfigurationValue)30 Configuration (com.thoughtworks.go.domain.config.Configuration)29 PluginConfiguration (com.thoughtworks.go.domain.config.PluginConfiguration)21 Property (com.thoughtworks.go.plugin.api.config.Property)13 ValidationError (com.thoughtworks.go.plugin.api.response.validation.ValidationError)13 ValidationResult (com.thoughtworks.go.plugin.api.response.validation.ValidationResult)11 GoCipher (com.thoughtworks.go.security.GoCipher)11 PluggableInstanceSettings (com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings)10 PluginRoleConfig (com.thoughtworks.go.config.PluginRoleConfig)8 PackageConfiguration (com.thoughtworks.go.plugin.access.packagematerial.PackageConfiguration)8 SecurityAuthConfig (com.thoughtworks.go.config.SecurityAuthConfig)7 ElasticProfile (com.thoughtworks.go.config.elastic.ElasticProfile)7 PluginConfiguration (com.thoughtworks.go.plugin.domain.common.PluginConfiguration)7 Metadata (com.thoughtworks.go.plugin.domain.common.Metadata)6 ArrayList (java.util.ArrayList)6 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)5