Search in sources :

Example 81 with MaterialConfig

use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.

the class ConfigRepoConfig method validateAutoUpdateState.

private void validateAutoUpdateState(ValidationContext validationContext) {
    if (validationContext == null)
        return;
    MaterialConfig material = this.getMaterialConfig();
    MaterialConfigs allMaterialsByFingerPrint = validationContext.getAllMaterialsByFingerPrint(material.getFingerprint());
    if (allMaterialsByFingerPrint != null) {
        for (MaterialConfig other : allMaterialsByFingerPrint) {
            if (!other.isAutoUpdate())
                ((ScmMaterialConfig) other).setAutoUpdateMismatchErrorWithConfigRepo();
        }
    }
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) ScmMaterialConfig(com.thoughtworks.go.config.materials.ScmMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig)

Example 82 with MaterialConfig

use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.

the class MaterialConfigServiceTest method shouldPopulateErrorCorrectlyWhenUnauthorizedToViewMaterial_getMaterialConfigByFingerprint.

@Test
public void shouldPopulateErrorCorrectlyWhenUnauthorizedToViewMaterial_getMaterialConfigByFingerprint() {
    HttpOperationResult result = new HttpOperationResult();
    GitMaterialConfig gitMaterialConfig = new GitMaterialConfig("http://another.com");
    MaterialConfig materialConfig = materialConfigService.getMaterialConfig(user, gitMaterialConfig.getFingerprint(), result);
    assertThat(materialConfig, is(nullValue()));
    assertThat(result.httpCode(), is(401));
}
Also used : HttpOperationResult(com.thoughtworks.go.server.service.result.HttpOperationResult) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) Test(org.junit.Test)

Example 83 with MaterialConfig

use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.

the class MaterialConfigServiceTest method shouldGetMaterialConfigByFingerprint.

@Test
public void shouldGetMaterialConfigByFingerprint() {
    HttpOperationResult result = new HttpOperationResult();
    GitMaterialConfig gitMaterialConfig = new GitMaterialConfig("http://crap.com");
    MaterialConfig materialConfig = materialConfigService.getMaterialConfig(user, gitMaterialConfig.getFingerprint(), result);
    assertThat(materialConfig, is(gitMaterialConfig));
    assertThat(result.canContinue(), is(true));
}
Also used : HttpOperationResult(com.thoughtworks.go.server.service.result.HttpOperationResult) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) Test(org.junit.Test)

Example 84 with MaterialConfig

use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.

the class PipelineConfig method allowedTemplateVariables.

public List<String> allowedTemplateVariables() {
    List<String> names = new ArrayList<>();
    for (MaterialConfig material : materialConfigs) {
        if (!CaseInsensitiveString.isBlank(material.getName())) {
            names.add(CaseInsensitiveString.str(material.getName()));
        }
    }
    names.add("COUNT");
    return names;
}
Also used : PluggableSCMMaterialConfig(com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) PackageMaterialConfig(com.thoughtworks.go.config.materials.PackageMaterialConfig)

Example 85 with MaterialConfig

use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.

the class MaterialConfigs method allowedFolders.

private List<String> allowedFolders() {
    ArrayList<String> allowed = new ArrayList<>();
    for (MaterialConfig material : this) {
        if (!StringUtils.isBlank(material.getFolder())) {
            allowed.add(material.getFolder());
        }
    }
    allowed.add(ArtifactLogUtil.CRUISE_OUTPUT_FOLDER);
    return allowed;
}
Also used : TfsMaterialConfig(com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig) P4MaterialConfig(com.thoughtworks.go.config.materials.perforce.P4MaterialConfig)

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