Search in sources :

Example 86 with MaterialConfig

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);
        }
    }
}
Also used : DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)

Example 87 with MaterialConfig

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));
}
Also used : ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) PluggableSCMMaterialConfig(com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) AbstractMaterialConfig(com.thoughtworks.go.config.materials.AbstractMaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) PackageMaterialConfig(com.thoughtworks.go.config.materials.PackageMaterialConfig) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) Test(org.junit.Test)

Example 88 with MaterialConfig

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));
}
Also used : ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) PluggableSCMMaterialConfig(com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) AbstractMaterialConfig(com.thoughtworks.go.config.materials.AbstractMaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) PackageMaterialConfig(com.thoughtworks.go.config.materials.PackageMaterialConfig) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) Test(org.junit.Test)

Example 89 with MaterialConfig

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));
}
Also used : ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) PluggableSCMMaterialConfig(com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) AbstractMaterialConfig(com.thoughtworks.go.config.materials.AbstractMaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) PackageMaterialConfig(com.thoughtworks.go.config.materials.PackageMaterialConfig) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) Test(org.junit.Test)

Example 90 with MaterialConfig

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));
}
Also used : GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig) P4MaterialConfig(com.thoughtworks.go.config.materials.perforce.P4MaterialConfig) TfsMaterialConfig(com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)

Aggregations

MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)171 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)90 Test (org.junit.jupiter.api.Test)86 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)74 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)64 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)48 P4MaterialConfig (com.thoughtworks.go.config.materials.perforce.P4MaterialConfig)44 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)42 PluggableSCMMaterialConfig (com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig)42 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)39 TfsMaterialConfig (com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig)36 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)20 ScmMaterialConfig (com.thoughtworks.go.config.materials.ScmMaterialConfig)19 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)19 RepoConfigOrigin (com.thoughtworks.go.config.remote.RepoConfigOrigin)18 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)17 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)13 Material (com.thoughtworks.go.domain.materials.Material)13 Modification (com.thoughtworks.go.domain.materials.Modification)13 Test (org.junit.Test)12