use of com.thoughtworks.go.domain.packagerepository.PackageRepositories in project gocd by gocd.
the class PackageConfigCommand method isValid.
public boolean isValid(CruiseConfig preprocessedConfig, String repositoryId) {
PackageRepositories packageRepositories = preprocessedConfig.getPackageRepositories();
PackageRepository repository = packageRepositories.find(repositoryId);
Packages packages = repository.getPackages();
preprocessedPackageDefinition = packages.find(this.packageDefinition.getId());
preprocessedPackageDefinition.validate(null);
if (preprocessedPackageDefinition.getAllErrors().isEmpty()) {
packageRepositories.validate(null);
packages.validate(null);
packageDefinitionService.validatePackageConfiguration(preprocessedPackageDefinition);
BasicCruiseConfig.copyErrors(preprocessedPackageDefinition, packageDefinition);
return preprocessedPackageDefinition.getAllErrors().isEmpty() && result.isSuccessful();
}
BasicCruiseConfig.copyErrors(preprocessedPackageDefinition, packageDefinition);
return false;
}
use of com.thoughtworks.go.domain.packagerepository.PackageRepositories in project gocd by gocd.
the class CreatePackageRepositoryCommand method update.
@Override
public void update(CruiseConfig modifiedConfig) {
PackageRepositories repositories = modifiedConfig.getPackageRepositories();
repositories.add(this.repository);
modifiedConfig.setPackageRepositories(repositories);
}
use of com.thoughtworks.go.domain.packagerepository.PackageRepositories in project gocd by gocd.
the class ConfigConverterTest method shouldConvertPackageMaterialConfig.
@Test
void shouldConvertPackageMaterialConfig() {
PackageRepositories repositories = new PackageRepositories();
PackageRepository packageRepository = new PackageRepository();
PackageDefinition definition = new PackageDefinition("package-id", "n", new Configuration());
packageRepository.addPackage(definition);
repositories.add(packageRepository);
BasicCruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.setPackageRepositories(repositories);
when(cachedGoConfig.currentConfig()).thenReturn(cruiseConfig);
PackageMaterialConfig packageMaterialConfig = new PackageMaterialConfig(new CaseInsensitiveString("name"), "package-id", definition);
CRPackageMaterial crPackageMaterial = (CRPackageMaterial) configConverter.materialToCRMaterial(packageMaterialConfig);
assertThat(crPackageMaterial.getName()).isEqualTo("name");
assertThat(crPackageMaterial.getPackageId()).isEqualTo("package-id");
}
use of com.thoughtworks.go.domain.packagerepository.PackageRepositories in project gocd by gocd.
the class GoConfigMigratorIntegrationTest method shouldValidatePackageRepositoriesConfiguration.
@Test
public void shouldValidatePackageRepositoriesConfiguration() throws Exception {
String configString = "<cruise schemaVersion='66'>" + "<repositories>" + "<repository id='go-repo' name='go-repo'>" + " <pluginConfiguration id='plugin-id' version='1.0'/>" + " <configuration>" + " <property><key>url</key><value>http://fake-yum-repo</value></property>" + " <property><key>username</key><value>godev</value></property>" + " <property><key>password</key><value>password</value></property>" + " </configuration>" + " <packages>" + " <package id='go-server' name='go-server'>" + " <configuration>" + " <property><key>name</key><value>go-server-13.2.0-1-i386</value></property>" + " </configuration>" + " </package>" + " </packages>" + "</repository>" + "</repositories>" + "</cruise>";
CruiseConfig cruiseConfig = migrateConfigAndLoadTheNewConfig(configString);
PackageRepositories packageRepositories = cruiseConfig.getPackageRepositories();
assertThat(packageRepositories.size()).isEqualTo(1);
assertThat(packageRepositories.get(0).getId()).isEqualTo("go-repo");
assertThat(packageRepositories.get(0).getName()).isEqualTo("go-repo");
assertThat(packageRepositories.get(0).getPluginConfiguration().getId()).isEqualTo("plugin-id");
assertThat(packageRepositories.get(0).getPluginConfiguration().getVersion()).isEqualTo("1.0");
assertThat(packageRepositories.get(0).getConfiguration()).isNotNull();
assertThat(packageRepositories.get(0).getPackages().size()).isEqualTo(1);
assertConfiguration(packageRepositories.get(0).getConfiguration(), asList(new List[] { asList("url", Boolean.FALSE, "http://fake-yum-repo"), asList("username", Boolean.FALSE, "godev"), asList("password", Boolean.FALSE, "password") }));
assertThat(packageRepositories.get(0).getPackages().get(0).getId()).isEqualTo("go-server");
assertThat(packageRepositories.get(0).getPackages().get(0).getName()).isEqualTo("go-server");
assertConfiguration(packageRepositories.get(0).getPackages().get(0).getConfiguration(), asList(new List[] { asList("name", Boolean.FALSE, "go-server-13.2.0-1-i386") }));
}
use of com.thoughtworks.go.domain.packagerepository.PackageRepositories in project gocd by gocd.
the class PackageRepositoryServiceIntegrationTest method tearDown.
@AfterEach
public void tearDown() throws Exception {
configHelper.onTearDown();
pluginSqlMapDao.deleteAllPlugins();
goConfigService.getConfigForEditing().setPackageRepositories(new PackageRepositories());
}
Aggregations