use of com.thoughtworks.go.plugin.api.material.packagerepository.PackageMaterialProperty in project gocd by gocd.
the class PackageRepositoryService method populateConfiguration.
private RepositoryConfiguration populateConfiguration(Configuration configuration) {
RepositoryConfiguration repositoryConfiguration = new RepositoryConfiguration();
for (ConfigurationProperty configurationProperty : configuration) {
String value = configurationProperty.getValue();
repositoryConfiguration.add(new PackageMaterialProperty(configurationProperty.getConfigurationKey().getName(), value));
}
return repositoryConfiguration;
}
use of com.thoughtworks.go.plugin.api.material.packagerepository.PackageMaterialProperty in project gocd by gocd.
the class PackageConfigurationsTest method shouldConstructPackageConfigurationFromApiRepositoryConfiguration.
@Test
public void shouldConstructPackageConfigurationFromApiRepositoryConfiguration() throws Exception {
RepositoryConfiguration configuration = new RepositoryConfiguration();
configuration.add(new PackageMaterialProperty("k1", "v1").with(Property.SECURE, Boolean.TRUE));
PackageConfigurations packageConfigurations = new PackageConfigurations(configuration);
assertThat(packageConfigurations.list().size(), is(1));
assertThat(packageConfigurations.list().get(0).getKey(), is("k1"));
assertThat(packageConfigurations.list().get(0).getValue(), is("v1"));
assertThat(packageConfigurations.list().get(0).getOption(PackageConfiguration.REQUIRED), is(true));
assertThat(packageConfigurations.list().get(0).getOption(PackageConfiguration.PART_OF_IDENTITY), is(true));
assertThat(packageConfigurations.list().get(0).getOption(PackageConfiguration.SECURE), is(true));
assertThat(packageConfigurations.list().get(0).getOption(PackageConfiguration.DISPLAY_NAME), is(""));
assertThat(packageConfigurations.list().get(0).getOption(PackageConfiguration.DISPLAY_ORDER), is(0));
}
Aggregations