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