Search in sources :

Example 36 with SvnMaterialConfig

use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.

the class MaterialConfigsMother method svn.

public static SvnMaterialConfig svn(String url, String userName, String password, boolean checkExternals, String folder) {
    SvnMaterialConfig svnMaterialConfig = svn(url, userName, password, checkExternals);
    svnMaterialConfig.setFolder(folder);
    return svnMaterialConfig;
}
Also used : SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)

Example 37 with SvnMaterialConfig

use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.

the class MaterialConfigsMother method svn.

// there is no need to mock GoCipher as it already using test provider
public static SvnMaterialConfig svn(UrlArgument url, String userName, String password, boolean checkExternals, GoCipher goCipher, boolean autoUpdate, Filter filter, boolean invertFilter, String folder, CaseInsensitiveString name) {
    SvnMaterialConfig svnMaterialConfig = svn();
    svnMaterialConfig.setUrl(url.originalArgument());
    svnMaterialConfig.setUserName(userName);
    svnMaterialConfig.setPassword(password);
    svnMaterialConfig.setCheckExternals(checkExternals);
    svnMaterialConfig.setAutoUpdate(autoUpdate);
    svnMaterialConfig.setFilter(filter);
    svnMaterialConfig.setInvertFilter(invertFilter);
    svnMaterialConfig.setFolder(folder);
    svnMaterialConfig.setName(name);
    return svnMaterialConfig;
}
Also used : SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)

Example 38 with SvnMaterialConfig

use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.

the class MaterialConfigsMother method svnMaterialConfig.

public static SvnMaterialConfig svnMaterialConfig(String svnUrl, String folder, CaseInsensitiveString name) {
    SvnMaterialConfig svnMaterialConfig = svnMaterialConfig(svnUrl, folder);
    svnMaterialConfig.setName(name);
    return svnMaterialConfig;
}
Also used : SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)

Example 39 with SvnMaterialConfig

use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.

the class ConfigConverter method toScmMaterialConfig.

private ScmMaterialConfig toScmMaterialConfig(CRScmMaterial crScmMaterial) {
    String materialName = crScmMaterial.getName();
    if (crScmMaterial instanceof CRGitMaterial) {
        CRGitMaterial git = (CRGitMaterial) crScmMaterial;
        String gitBranch = git.getBranch();
        if (StringUtils.isBlank(gitBranch))
            gitBranch = GitMaterialConfig.DEFAULT_BRANCH;
        GitMaterialConfig gitConfig = new GitMaterialConfig();
        gitConfig.setUrl(git.getUrl());
        gitConfig.setBranch(gitBranch);
        gitConfig.setShallowClone(git.isShallowClone());
        setCommonMaterialMembers(gitConfig, crScmMaterial);
        setCommonScmMaterialMembers(gitConfig, git);
        return gitConfig;
    } else if (crScmMaterial instanceof CRHgMaterial) {
        CRHgMaterial hg = (CRHgMaterial) crScmMaterial;
        HgMaterialConfig hgConfig = new HgMaterialConfig();
        hgConfig.setUrl(hg.getUrl());
        hgConfig.setUserName(hg.getUsername());
        hgConfig.setPassword(hg.getPassword());
        hgConfig.setBranchAttribute(hg.getBranch());
        hgConfig.setAutoUpdate(hg.isAutoUpdate());
        hgConfig.setFilter(toFilter(crScmMaterial));
        hgConfig.setInvertFilter(false);
        hgConfig.setFolder(hg.getDestination());
        hgConfig.setName(toMaterialName(materialName));
        setCommonMaterialMembers(hgConfig, crScmMaterial);
        setCommonScmMaterialMembers(hgConfig, hg);
        return hgConfig;
    } else if (crScmMaterial instanceof CRP4Material) {
        CRP4Material crp4Material = (CRP4Material) crScmMaterial;
        P4MaterialConfig p4MaterialConfig = new P4MaterialConfig();
        p4MaterialConfig.setServerAndPort(crp4Material.getPort());
        p4MaterialConfig.setView(crp4Material.getView());
        p4MaterialConfig.setUseTickets(crp4Material.isUseTickets());
        setCommonMaterialMembers(p4MaterialConfig, crScmMaterial);
        setCommonScmMaterialMembers(p4MaterialConfig, crp4Material);
        return p4MaterialConfig;
    } else if (crScmMaterial instanceof CRSvnMaterial) {
        CRSvnMaterial crSvnMaterial = (CRSvnMaterial) crScmMaterial;
        SvnMaterialConfig svnMaterialConfig = new SvnMaterialConfig();
        svnMaterialConfig.setUrl(crSvnMaterial.getUrl());
        svnMaterialConfig.setUserName(crSvnMaterial.getUsername());
        svnMaterialConfig.setCheckExternals(crSvnMaterial.isCheckExternals());
        setCommonMaterialMembers(svnMaterialConfig, crScmMaterial);
        setCommonScmMaterialMembers(svnMaterialConfig, crSvnMaterial);
        return svnMaterialConfig;
    } else if (crScmMaterial instanceof CRTfsMaterial) {
        CRTfsMaterial crTfsMaterial = (CRTfsMaterial) crScmMaterial;
        TfsMaterialConfig tfsMaterialConfig = new TfsMaterialConfig();
        tfsMaterialConfig.setUrl(crTfsMaterial.getUrl());
        tfsMaterialConfig.setUserName(crTfsMaterial.getUsername());
        tfsMaterialConfig.setDomain(crTfsMaterial.getDomain());
        tfsMaterialConfig.setProjectPath(crTfsMaterial.getProject());
        setCommonMaterialMembers(tfsMaterialConfig, crTfsMaterial);
        setCommonScmMaterialMembers(tfsMaterialConfig, crTfsMaterial);
        return tfsMaterialConfig;
    } else
        throw new ConfigConvertionException(String.format("unknown scm material type '%s'", crScmMaterial));
}
Also used : GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) P4MaterialConfig(com.thoughtworks.go.config.materials.perforce.P4MaterialConfig) TfsMaterialConfig(com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig) HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)

Example 40 with SvnMaterialConfig

use of com.thoughtworks.go.config.materials.svn.SvnMaterialConfig in project gocd by gocd.

the class PipelineConfigDependencyGraphTest method shouldReturnTheSetOfFingerprintsOfAllMaterials.

@Test
public void shouldReturnTheSetOfFingerprintsOfAllMaterials() throws Exception {
    HgMaterialConfig common = MaterialConfigsMother.hgMaterialConfig();
    SvnMaterialConfig firstOrderSVNMaterial = MaterialConfigsMother.svnMaterialConfig();
    GitMaterialConfig firstOrderGitMaterial = MaterialConfigsMother.gitMaterialConfig("url", "submodule", "branch", false);
    P4MaterialConfig firstOrderP4Material = MaterialConfigsMother.p4MaterialConfig();
    DependencyMaterialConfig up1DependencyMaterial = new DependencyMaterialConfig(new CaseInsensitiveString("up1"), new CaseInsensitiveString("first"));
    DependencyMaterialConfig up2DependencyMaterial = new DependencyMaterialConfig(new CaseInsensitiveString("up2"), new CaseInsensitiveString("first"));
    DependencyMaterialConfig uppestDependencyMaterial = new DependencyMaterialConfig(new CaseInsensitiveString("uppest"), new CaseInsensitiveString("first"));
    PipelineConfig current = GoConfigMother.createPipelineConfigWithMaterialConfig("current", common, up1DependencyMaterial, up2DependencyMaterial);
    PipelineConfig up1 = GoConfigMother.createPipelineConfigWithMaterialConfig("up1", common, firstOrderGitMaterial, uppestDependencyMaterial);
    PipelineConfig up2 = GoConfigMother.createPipelineConfigWithMaterialConfig("up2", firstOrderSVNMaterial, common, uppestDependencyMaterial);
    PipelineConfig uppest = GoConfigMother.createPipelineConfigWithMaterialConfig("uppest", common, firstOrderP4Material);
    PipelineConfigDependencyGraph uppestGraph = new PipelineConfigDependencyGraph(uppest);
    PipelineConfigDependencyGraph up1Graph = new PipelineConfigDependencyGraph(up1, uppestGraph);
    PipelineConfigDependencyGraph up2Graph = new PipelineConfigDependencyGraph(up2, uppestGraph);
    PipelineConfigDependencyGraph dependencyGraph = new PipelineConfigDependencyGraph(current, up1Graph, up2Graph);
    assertThat(dependencyGraph.allMaterialFingerprints().size(), is(7));
    assertThat(dependencyGraph.allMaterialFingerprints(), hasItems(common.getFingerprint(), firstOrderSVNMaterial.getFingerprint(), firstOrderGitMaterial.getFingerprint(), firstOrderP4Material.getFingerprint(), up1DependencyMaterial.getFingerprint(), up2DependencyMaterial.getFingerprint(), uppestDependencyMaterial.getFingerprint()));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) P4MaterialConfig(com.thoughtworks.go.config.materials.perforce.P4MaterialConfig) HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig) MaterialConfigsMother.filteredHgMaterialConfig(com.thoughtworks.go.helper.MaterialConfigsMother.filteredHgMaterialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.jupiter.api.Test)

Aggregations

SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)92 Test (org.junit.jupiter.api.Test)60 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)25 P4MaterialConfig (com.thoughtworks.go.config.materials.perforce.P4MaterialConfig)15 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)12 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)11 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)11 GoCipher (com.thoughtworks.go.security.GoCipher)11 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)9 PluggableSCMMaterialConfig (com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig)9 TfsMaterialConfig (com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig)8 Test (org.junit.Test)8 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)7 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)6 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)5 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)4 SvnCommand (com.thoughtworks.go.domain.materials.svn.SvnCommand)4 SCMs (com.thoughtworks.go.domain.scm.SCMs)3 GoConfigMother (com.thoughtworks.go.helper.GoConfigMother)3 SvnTestRepo (com.thoughtworks.go.helper.SvnTestRepo)3