Search in sources :

Example 16 with PackageDefinition

use of com.thoughtworks.go.domain.packagerepository.PackageDefinition in project gocd by gocd.

the class PackageDefinitionCreator method createNewPackageDefinition.

public PackageDefinition createNewPackageDefinition(CruiseConfig cruiseConfig) {
    Map packageDefinitionMap = (Map) params.get(PACKAGE_DEFINITION);
    String repositoryId = (String) packageDefinitionMap.get(REPOSITORY_ID);
    PackageRepository packageRepository = cruiseConfig.getPackageRepositories().find(repositoryId);
    PackageDefinition packageDefinition = new PackageDefinition();
    packageDefinition.setRepository(packageRepository);
    packageDefinition.setConfigAttributes(packageDefinitionMap);
    if (packageRepository != null) {
        validatePackageDefinition(packageDefinition);
        cruiseConfig.savePackageDefinition(packageDefinition);
    }
    return packageDefinition;
}
Also used : PackageDefinition(com.thoughtworks.go.domain.packagerepository.PackageDefinition) PackageRepository(com.thoughtworks.go.domain.packagerepository.PackageRepository) Map(java.util.Map)

Example 17 with PackageDefinition

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);
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) PackageDefinition(com.thoughtworks.go.domain.packagerepository.PackageDefinition) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Example 18 with PackageDefinition

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);
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) PackageDefinition(com.thoughtworks.go.domain.packagerepository.PackageDefinition) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Example 19 with PackageDefinition

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);
}
Also used : PackageDefinition(com.thoughtworks.go.domain.packagerepository.PackageDefinition) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Example 20 with 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);
}
Also used : PackageDefinition(com.thoughtworks.go.domain.packagerepository.PackageDefinition) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Aggregations

PackageDefinition (com.thoughtworks.go.domain.packagerepository.PackageDefinition)68 Test (org.junit.Test)47 PackageRepository (com.thoughtworks.go.domain.packagerepository.PackageRepository)41 PackageRepositories (com.thoughtworks.go.domain.packagerepository.PackageRepositories)28 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)12 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)12 Configuration (com.thoughtworks.go.domain.config.Configuration)12 Packages (com.thoughtworks.go.domain.packagerepository.Packages)12 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)7 Serializable (java.io.Serializable)7 PackageMaterial (com.thoughtworks.go.config.materials.PackageMaterial)6 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)6 Before (org.junit.Before)6 GoConfigInvalidException (com.thoughtworks.go.config.exceptions.GoConfigInvalidException)4 RepositoryConfiguration (com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration)4 Matchers.containsString (org.hamcrest.Matchers.containsString)4 GoConfigMother (com.thoughtworks.go.helper.GoConfigMother)3 Username (com.thoughtworks.go.server.domain.Username)3 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)2 PluggableSCMMaterial (com.thoughtworks.go.config.materials.PluggableSCMMaterial)2