use of com.thoughtworks.go.config.materials.PackageMaterialConfig in project gocd by gocd.
the class PipelineConfigTest method shouldGetPackageMaterialConfigs.
@Test
public void shouldGetPackageMaterialConfigs() throws Exception {
SvnMaterialConfig svn = new SvnMaterialConfig("svn", false);
PackageMaterialConfig packageMaterialOne = new PackageMaterialConfig();
PackageMaterialConfig packageMaterialTwo = new PackageMaterialConfig();
PipelineConfig pipelineConfig = PipelineConfigMother.pipelineConfig("p1", new MaterialConfigs(svn, packageMaterialOne, packageMaterialTwo));
List<PackageMaterialConfig> packageMaterialConfigs = pipelineConfig.packageMaterialConfigs();
assertThat(packageMaterialConfigs.size(), is(2));
assertThat(packageMaterialConfigs, hasItems(packageMaterialOne, packageMaterialTwo));
}
use of com.thoughtworks.go.config.materials.PackageMaterialConfig in project gocd by gocd.
the class PipelineConfigValidationTest method isValid_shouldAllowColonForLabelTemplate.
@Test
public void isValid_shouldAllowColonForLabelTemplate() throws Exception {
pipeline.setLabelTemplate("pipeline-${COUNT}-${repo:name}");
pipeline.addMaterialConfig(new PackageMaterialConfig(new CaseInsensitiveString("repo:name"), "package-id", PackageDefinitionMother.create("package-id")));
pipeline.validate(validationContext);
assertThat(pipeline.errors().getAllOn("labelTemplate"), is(nullValue()));
}
use of com.thoughtworks.go.config.materials.PackageMaterialConfig in project gocd by gocd.
the class PackageMaterialAddWithExistingPackageDefinitionCommandTest method shouldHandleDeletedPackageRepo.
@Test
public void shouldHandleDeletedPackageRepo() {
PackageDefinition packageDefinition = cruiseConfig.getPackageRepositories().get(0).getPackages().get(0);
String repoId = "deleted-repo";
String pkgId = packageDefinition.getId();
HashMap<String, Serializable> params = PackageDefinitionMother.paramsForPackageMaterialAssociation(repoId, pkgId);
PackageMaterialConfig materialToBeCreated = new PackageMaterialConfig();
PackageMaterialAddWithExistingPackageDefinitionCommand command = new PackageMaterialAddWithExistingPackageDefinitionCommand(packageDefinitionService, securityService, pipelineName, materialToBeCreated, admin, params);
command.update(cruiseConfig);
PipelineConfig pipelineConfig = cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipelineName));
assertThat(pipelineConfig.materialConfigs().last() instanceof PackageMaterialConfig, is(true));
PackageMaterialConfig packageMaterial = (PackageMaterialConfig) pipelineConfig.materialConfigs().last();
assertThat(packageMaterial, is(materialToBeCreated));
assertThat(packageMaterial.getPackageDefinition(), is(nullValue()));
assertThat(packageMaterial.getPackageId(), is(nullValue()));
verify(packageDefinitionService, never()).performPluginValidationsFor(Matchers.<PackageDefinition>any());
}
use of com.thoughtworks.go.config.materials.PackageMaterialConfig in project gocd by gocd.
the class PackageMaterialAddWithExistingPackageDefinitionCommandTest method shouldHandleDeletedPackageDefinition.
@Test
public void shouldHandleDeletedPackageDefinition() {
PackageDefinition packageDefinition = cruiseConfig.getPackageRepositories().get(0).getPackages().get(0);
String repoId = packageDefinition.getRepository().getId();
String pkgId = "deleted-package-definition";
HashMap<String, Serializable> params = PackageDefinitionMother.paramsForPackageMaterialAssociation(repoId, pkgId);
PackageMaterialConfig materialToBeCreated = new PackageMaterialConfig();
PackageMaterialAddWithExistingPackageDefinitionCommand command = new PackageMaterialAddWithExistingPackageDefinitionCommand(packageDefinitionService, securityService, pipelineName, materialToBeCreated, admin, params);
command.update(cruiseConfig);
PipelineConfig pipelineConfig = cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipelineName));
assertThat(pipelineConfig.materialConfigs().last() instanceof PackageMaterialConfig, is(true));
PackageMaterialConfig packageMaterial = (PackageMaterialConfig) pipelineConfig.materialConfigs().last();
assertThat(packageMaterial, is(materialToBeCreated));
assertThat(packageMaterial.getPackageDefinition(), is(nullValue()));
assertThat(packageMaterial.getPackageId(), is(nullValue()));
verify(packageDefinitionService, never()).performPluginValidationsFor(Matchers.<PackageDefinition>any());
}
use of com.thoughtworks.go.config.materials.PackageMaterialConfig in project gocd by gocd.
the class PackageMaterialAddWithExistingPackageDefinitionCommandTest method shouldUpdateConfigWithNewMaterial.
@Test
public void shouldUpdateConfigWithNewMaterial() {
PackageDefinition packageDefinition = cruiseConfig.getPackageRepositories().get(0).getPackages().get(0);
String repoId = packageDefinition.getRepository().getId();
String pkgId = packageDefinition.getId();
HashMap<String, Serializable> params = PackageDefinitionMother.paramsForPackageMaterialAssociation(repoId, pkgId);
PackageMaterialConfig materialToBeCreated = new PackageMaterialConfig();
PackageMaterialAddWithExistingPackageDefinitionCommand command = new PackageMaterialAddWithExistingPackageDefinitionCommand(packageDefinitionService, securityService, pipelineName, materialToBeCreated, admin, params);
command.update(cruiseConfig);
PipelineConfig pipelineConfig = cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipelineName));
assertThat(pipelineConfig.materialConfigs().last() instanceof PackageMaterialConfig, is(true));
PackageMaterialConfig packageMaterial = (PackageMaterialConfig) pipelineConfig.materialConfigs().last();
assertThat(packageMaterial, is(materialToBeCreated));
assertThat(packageMaterial.getPackageDefinition(), is(packageDefinition));
verify(packageDefinitionService, never()).performPluginValidationsFor(packageDefinition);
}
Aggregations