Search in sources :

Example 6 with PackageMaterialProperty

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;
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) PackageMaterialProperty(com.thoughtworks.go.plugin.api.material.packagerepository.PackageMaterialProperty) RepositoryConfiguration(com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration)

Example 7 with PackageMaterialProperty

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));
}
Also used : PackageMaterialProperty(com.thoughtworks.go.plugin.api.material.packagerepository.PackageMaterialProperty) RepositoryConfiguration(com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration) Test(org.junit.Test)

Aggregations

PackageMaterialProperty (com.thoughtworks.go.plugin.api.material.packagerepository.PackageMaterialProperty)7 RepositoryConfiguration (com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration)5 Test (org.junit.Test)3 ConfigurationProperty (com.thoughtworks.go.domain.config.ConfigurationProperty)2 PackageConfigurations (com.thoughtworks.go.plugin.access.packagematerial.PackageConfigurations)2 Before (org.junit.Before)2 GoConfigInvalidException (com.thoughtworks.go.config.exceptions.GoConfigInvalidException)1 Configuration (com.thoughtworks.go.domain.config.Configuration)1 ConfigurationKey (com.thoughtworks.go.domain.config.ConfigurationKey)1 ConfigurationValue (com.thoughtworks.go.domain.config.ConfigurationValue)1 PluginSettingsConfiguration (com.thoughtworks.go.plugin.access.common.settings.PluginSettingsConfiguration)1 PackageConfiguration (com.thoughtworks.go.plugin.access.packagematerial.PackageConfiguration)1 PackageConfiguration (com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration)1 GoPluginApiRequest (com.thoughtworks.go.plugin.api.request.GoPluginApiRequest)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1