use of com.thoughtworks.go.domain.config.Configuration in project gocd by gocd.
the class PackageRepositoryTest method shouldOnlyDisplayFieldsWhichAreNonSecureAndPartOfIdentityInGetConfigForDisplayWhenPluginExists.
@Test
public void shouldOnlyDisplayFieldsWhichAreNonSecureAndPartOfIdentityInGetConfigForDisplayWhenPluginExists() throws Exception {
PackageConfigurations repositoryConfiguration = new PackageConfigurations();
repositoryConfiguration.addConfiguration(new PackageConfiguration("key1").with(PART_OF_IDENTITY, true).with(SECURE, false));
repositoryConfiguration.addConfiguration(new PackageConfiguration("key2").with(PART_OF_IDENTITY, false).with(SECURE, false));
repositoryConfiguration.addConfiguration(new PackageConfiguration("key3").with(PART_OF_IDENTITY, true).with(SECURE, true));
repositoryConfiguration.addConfiguration(new PackageConfiguration("key4").with(PART_OF_IDENTITY, false).with(SECURE, true));
repositoryConfiguration.addConfiguration(new PackageConfiguration("key5").with(PART_OF_IDENTITY, true).with(SECURE, false));
RepositoryMetadataStore.getInstance().addMetadataFor("plugin1", repositoryConfiguration);
Configuration configuration = new Configuration(create("key1", false, "value1"), create("key2", false, "value2"), create("key3", true, "value3"), create("key4", true, "value4"), create("key5", false, "value5"));
PackageRepository repository = PackageRepositoryMother.create("repo1", "repo1-name", "plugin1", "1", configuration);
assertThat(repository.getConfigForDisplay(), is("Repository: [key1=value1, key5=value5]"));
}
use of com.thoughtworks.go.domain.config.Configuration in project gocd by gocd.
the class PackageRepositoryTest method shouldCreatePackageBasedOnParams.
@Test
public void shouldCreatePackageBasedOnParams() throws Exception {
PackageRepository packageRepository = PackageRepositoryMother.create("repo-id1", "packageRepository", "plugin-id", "1.0", null);
Map packageDefAttr = createPackageDefinitionConfiguration("package_name", "pluginId", new ConfigurationHolder("key1", "value1"), new ConfigurationHolder("key2", "value2"));
Map map = new HashMap();
map.put("package_definition", packageDefAttr);
PackageDefinition actualPackageDefinition = packageRepository.findOrCreatePackageDefinition(map);
assertThat(actualPackageDefinition, is(PackageDefinitionMother.create(null, "package_name", new Configuration(create("key1", false, "value1"), create("key2", false, "value2")), packageRepository)));
assertThat(actualPackageDefinition.getRepository(), is(packageRepository));
}
use of com.thoughtworks.go.domain.config.Configuration in project gocd by gocd.
the class GoConfigMaterialsTest method getPackageMaterialConfigWithAutoUpdateFalse.
private PackageMaterialConfig getPackageMaterialConfigWithAutoUpdateFalse() {
PackageDefinition packageDefinition = new PackageDefinition("packageWithAutoUpdateFalse", "DLF Package", new Configuration());
packageDefinition.setRepository(PackageRepositoryMother.create("DLF"));
packageDefinition.setAutoUpdate(false);
return new PackageMaterialConfig(new CaseInsensitiveString("JamesBond"), "packageWithAutoUpdateFalse", packageDefinition);
}
use of com.thoughtworks.go.domain.config.Configuration in project gocd by gocd.
the class SCMTest method shouldCheckEqualityOfSCM.
@Test
public void shouldCheckEqualityOfSCM() {
Configuration configuration = new Configuration();
SCM scm = SCMMother.create("id", "name", "plugin-id", "version", configuration);
assertThat(scm, is(SCMMother.create("id", "name", "plugin-id", "version", configuration)));
}
use of com.thoughtworks.go.domain.config.Configuration in project gocd by gocd.
the class SCMTest method shouldConvertKeysToLowercaseInGetConfigForDisplay.
@Test
public void shouldConvertKeysToLowercaseInGetConfigForDisplay() throws Exception {
SCMMetadataStore.getInstance().addMetadataFor("plugin-id", new SCMConfigurations(), null);
Configuration configuration = new Configuration(create("kEY1", false, "vALue1"), create("KEY_MORE_2", false, "VALUE_2"), create("key_3", false, "value3"));
SCM scm = SCMMother.create("scm", "scm-name", "plugin-id", "1.0", configuration);
assertThat(scm.getConfigForDisplay(), is("[key1=vALue1, key_more_2=VALUE_2, key_3=value3]"));
}
Aggregations