use of com.thoughtworks.go.domain.packagerepository.PackageDefinition in project gocd by gocd.
the class PackageMaterialAddWithExistingPackageDefinitionCommand method updateConfig.
@Override
protected void updateConfig(CruiseConfig cruiseConfig) {
PackageDefinition packageDefinition = getPackageDefinition(cruiseConfig);
packageMaterialConfig.setPackageDefinition(packageDefinition);
PipelineConfig pipelineConfig = cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipeline));
pipelineConfig.addMaterialConfig(packageMaterialConfig);
}
use of com.thoughtworks.go.domain.packagerepository.PackageDefinition in project gocd by gocd.
the class PackageMaterialAddWithNewPackageDefinitionCommand method updateConfig.
@Override
protected void updateConfig(CruiseConfig cruiseConfig) {
PackageDefinition packageDefinition = createNewPackageDefinition(cruiseConfig);
packageMaterialConfig.setPackageDefinition(packageDefinition);
PipelineConfig pipelineConfig = cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipeline));
pipelineConfig.addMaterialConfig(packageMaterialConfig);
}
use of com.thoughtworks.go.domain.packagerepository.PackageDefinition in project gocd by gocd.
the class PackageMaterialUpdateWithExistingPackageDefinitionCommand method updateConfig.
@Override
protected void updateConfig(CruiseConfig cruiseConfig) {
PackageDefinition packageDefinition = getPackageDefinition(cruiseConfig);
packageMaterialConfig = (PackageMaterialConfig) cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipeline)).materialConfigs().get(packageMaterialConfig);
packageMaterialConfig.setPackageDefinition(packageDefinition);
}
use of com.thoughtworks.go.domain.packagerepository.PackageDefinition in project gocd by gocd.
the class PackageMaterialUpdateWithNewPackageDefinitionCommand method updateConfig.
@Override
protected void updateConfig(CruiseConfig cruiseConfig) {
PackageDefinition packageDefinition = createNewPackageDefinition(cruiseConfig);
packageMaterialConfig = (PackageMaterialConfig) cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipeline)).materialConfigs().get(packageMaterialConfig);
packageMaterialConfig.setPackageDefinition(packageDefinition);
}
use of com.thoughtworks.go.domain.packagerepository.PackageDefinition in project gocd by gocd.
the class UpdatePackageConfigCommandTest method shouldValidateDuplicateIdentity.
@Test
public void shouldValidateDuplicateIdentity() throws Exception {
PackageRepository repository = cruiseConfig.getPackageRepositories().find("repoId");
PackageDefinition pkg = new PackageDefinition("Id", "name", configuration);
pkg.setRepository(repository);
repository.addPackage(pkg);
cruiseConfig.setPackageRepositories(new PackageRepositories(repository));
UpdatePackageConfigCommand command = new UpdatePackageConfigCommand(goConfigService, packageUuid, newPackageDefinition, currentUser, "md5", this.entityHashingService, result, packageDefinitionService);
command.update(cruiseConfig);
assertFalse(command.isValid(cruiseConfig));
assertThat(newPackageDefinition.errors().size(), is(1));
assertThat(newPackageDefinition.errors().firstError(), is("Cannot save package or repo, found duplicate packages. [Repo Name: 'repoName', Package Name: 'name'], [Repo Name: 'repoName', Package Name: 'prettyjson']"));
}
Aggregations