use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.
the class ReportingFanInGraph method buildRestOfTheGraph.
private void buildRestOfTheGraph(ReportingDependencyFanInNode root, PipelineConfig target, HashSet<String> scmMaterialSet) {
for (MaterialConfig material : target.materialConfigs()) {
ReportingFanInNode node = createNode(material);
root.children.add(node);
node.parents.add(root);
if (node instanceof ReportingDependencyFanInNode) {
DependencyMaterialConfig dependencyMaterial = (DependencyMaterialConfig) material;
fingerprintDepMaterialMap.put(dependencyMaterial.getFingerprint(), dependencyMaterial);
handleDependencyMaterial(scmMaterialSet, dependencyMaterial, (ReportingDependencyFanInNode) node);
} else {
handleScmMaterial(scmMaterialSet, material);
}
}
}
use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.
the class PipelineConfigTest method shouldReturnFalseWhenConfigRevisionIsNotEqualToQuery.
@Test
public void shouldReturnFalseWhenConfigRevisionIsNotEqualToQuery() {
PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfig("pipeline", "stage", "build");
MaterialConfig material = pipelineConfig.materialConfigs().first();
pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(material, "plugin"), "1233"));
assertThat(pipelineConfig.isConfigOriginFromRevision("32"), is(false));
}
use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.
the class PipelineConfigTest method shouldReturnTrueWhenConfigRevisionIsEqualToQuery.
@Test
public void shouldReturnTrueWhenConfigRevisionIsEqualToQuery() {
PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfig("pipeline", "stage", "build");
MaterialConfig material = pipelineConfig.materialConfigs().first();
pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(material, "plugin"), "1233"));
assertThat(pipelineConfig.isConfigOriginFromRevision("1233"), is(true));
}
use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.
the class PipelineConfigTest method shouldReturnTrueWhenOneOfPipelineMaterialsIsTheSameAsConfigOrigin.
@Test
public void shouldReturnTrueWhenOneOfPipelineMaterialsIsTheSameAsConfigOrigin() {
PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfig("pipeline", "stage", "build");
MaterialConfig material = pipelineConfig.materialConfigs().first();
pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(material, "plugin"), "1233"));
assertThat(pipelineConfig.isConfigOriginSameAsOneOfMaterials(), is(true));
}
use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.
the class ConfigConverter method toMaterialConfig.
public MaterialConfig toMaterialConfig(CRMaterial crMaterial, PartialConfigLoadContext context) {
if (crMaterial == null)
throw new ConfigConvertionException("material cannot be null");
if (crMaterial instanceof CRDependencyMaterial)
return toDependencyMaterialConfig((CRDependencyMaterial) crMaterial);
else if (crMaterial instanceof CRScmMaterial) {
CRScmMaterial crScmMaterial = (CRScmMaterial) crMaterial;
return toScmMaterialConfig(crScmMaterial);
} else if (crMaterial instanceof CRPluggableScmMaterial) {
CRPluggableScmMaterial crPluggableScmMaterial = (CRPluggableScmMaterial) crMaterial;
return toPluggableScmMaterialConfig(crPluggableScmMaterial);
} else if (crMaterial instanceof CRPackageMaterial) {
CRPackageMaterial crPackageMaterial = (CRPackageMaterial) crMaterial;
return toPackageMaterial(crPackageMaterial);
} else if (crMaterial instanceof CRConfigMaterial) {
CRConfigMaterial crConfigMaterial = (CRConfigMaterial) crMaterial;
MaterialConfig repoMaterial = cloner.deepClone(context.configMaterial());
if (StringUtils.isNotEmpty(crConfigMaterial.getName()))
repoMaterial.setName(new CaseInsensitiveString(crConfigMaterial.getName()));
if (StringUtils.isNotEmpty(crConfigMaterial.getDestination()))
setDestination(repoMaterial, crConfigMaterial.getDestination());
if (crConfigMaterial.getFilter() != null && !crConfigMaterial.getFilter().isEmpty()) {
if (repoMaterial instanceof ScmMaterialConfig) {
ScmMaterialConfig scmMaterialConfig = (ScmMaterialConfig) repoMaterial;
scmMaterialConfig.setFilter(toFilter(crConfigMaterial.getFilter().getList()));
scmMaterialConfig.setInvertFilter(crConfigMaterial.getFilter().isWhitelist());
} else // must be a pluggable SCM
{
PluggableSCMMaterialConfig pluggableSCMMaterial = (PluggableSCMMaterialConfig) repoMaterial;
pluggableSCMMaterial.setFilter(toFilter(crConfigMaterial.getFilter().getList()));
if (crConfigMaterial.getFilter().isWhitelist())
throw new ConfigConvertionException("Plugable SCMs do not support whitelisting");
}
}
return repoMaterial;
} else
throw new ConfigConvertionException(String.format("unknown material type '%s'", crMaterial));
}
Aggregations