use of com.thoughtworks.go.plugin.access.configrepo.contract.CRConfigurationProperty in project gocd by gocd.
the class CRPluggableTask method getErrors.
@Override
public void getErrors(ErrorCollection errors, String parentLocation) {
String location = getLocation(parentLocation);
errors.checkMissing(location, "plugin_configuration", plugin_configuration);
if (this.plugin_configuration != null)
this.plugin_configuration.getErrors(errors, location);
if (this.configuration != null) {
for (CRConfigurationProperty p : configuration) {
p.getErrors(errors, location);
}
}
validateKeyUniqueness(errors, location);
}
use of com.thoughtworks.go.plugin.access.configrepo.contract.CRConfigurationProperty in project gocd by gocd.
the class ConfigRepoPlugin method getCrConfigurations.
public static List<CRConfigurationProperty> getCrConfigurations(Configuration configuration) {
List<CRConfigurationProperty> config = new ArrayList<>();
for (ConfigurationProperty prop : configuration) {
String configKeyName = prop.getConfigKeyName();
if (!prop.isSecure())
config.add(new CRConfigurationProperty(configKeyName, prop.getValue(), null));
else {
CRConfigurationProperty crProp = new CRConfigurationProperty(configKeyName, null, prop.getEncryptedValue());
config.add(crProp);
}
}
return config;
}
use of com.thoughtworks.go.plugin.access.configrepo.contract.CRConfigurationProperty in project gocd by gocd.
the class ConfigRepoPluginTest method shouldGetCRConfigurationFromConfigurationWhenInsecureValue.
@Test
public void shouldGetCRConfigurationFromConfigurationWhenInsecureValue() {
Configuration configuration = new Configuration();
configuration.addNewConfigurationWithValue("key1", "value1", false);
List<CRConfigurationProperty> crConfigurations = ConfigRepoPlugin.getCrConfigurations(configuration);
assertThat(crConfigurations.size(), is(1));
CRConfigurationProperty prop = crConfigurations.get(0);
assertThat(prop.getKey(), is("key1"));
assertThat(prop.getValue(), is("value1"));
}
use of com.thoughtworks.go.plugin.access.configrepo.contract.CRConfigurationProperty in project gocd by gocd.
the class ConfigRepoPluginTest method shouldGetCRConfigurationFromConfigurationWhenSecureValue.
@Test
public void shouldGetCRConfigurationFromConfigurationWhenSecureValue() {
Configuration configuration = new Configuration();
configuration.addNewConfigurationWithValue("key1", "@$$%^1234", true);
List<CRConfigurationProperty> crConfigurations = ConfigRepoPlugin.getCrConfigurations(configuration);
assertThat(crConfigurations.size(), is(1));
CRConfigurationProperty prop = crConfigurations.get(0);
assertThat(prop.getKey(), is("key1"));
assertThat(prop.getEncryptedValue(), is("@$$%^1234"));
}
use of com.thoughtworks.go.plugin.access.configrepo.contract.CRConfigurationProperty in project gocd by gocd.
the class ConfigRepoPlugin method load.
@Override
public PartialConfig load(File configRepoCheckoutDirectory, PartialConfigLoadContext context) {
Collection<CRConfigurationProperty> cRconfigurations = getCrConfigurations(context.configuration());
CRParseResult crPartialConfig = parseDirectory(configRepoCheckoutDirectory, cRconfigurations);
return configConverter.toPartialConfig(crPartialConfig, context);
}
Aggregations