Search in sources :

Example 61 with GitMaterialConfig

use of com.thoughtworks.go.config.materials.git.GitMaterialConfig in project gocd by gocd.

the class GoConfigMigrationIntegrationTest method migration99_shouldMigrateGitMaterialsUnderConfigRepoAndRetainOnlyTheMinimalRequiredAttributes.

@Test
public void migration99_shouldMigrateGitMaterialsUnderConfigRepoAndRetainOnlyTheMinimalRequiredAttributes() throws Exception {
    String configXml = "<cruise schemaVersion='98'>" + "<config-repos>\n" + "   <config-repo pluginId=\"json.config.plugin\" id=\"config-repo-1\">\n" + "      <git url=\"test-repo\" dest='dest' shallowClone='true' autoUpdate='true' invertFilter='true' materialName=\"foo\">\n" + "        <filter>\n" + "          <ignore pattern=\"asdsd\" />\n" + "        </filter>\n" + "      </git>" + "   </config-repo>\n" + "</config-repos>" + "</cruise>";
    assertThat(configXml).contains("<filter>");
    assertThat(configXml).contains("dest='dest'");
    assertThat(configXml).contains("autoUpdate='true'");
    assertThat(configXml).contains("invertFilter='true'");
    assertThat(configXml).contains("shallowClone='true'");
    String migratedContent = migrateXmlString(configXml, 98);
    CruiseConfig cruiseConfig = loader.deserializeConfig(migratedContent);
    GitMaterialConfig materialConfig = (GitMaterialConfig) cruiseConfig.getConfigRepos().getConfigRepo("config-repo-1").getRepo();
    assertThat(migratedContent).doesNotContain("<filter>");
    assertThat(migratedContent).doesNotContain("dest='dest'");
    assertThat(migratedContent).doesNotContain("invertFilter='true'");
    assertThat(migratedContent).doesNotContain("shallowClone='true'");
    assertThat(materialConfig.getFolder()).isNull();
    assertThat(materialConfig.filter().size()).isEqualTo(0);
    assertThat(materialConfig.isAutoUpdate()).isTrue();
    assertThat(materialConfig.isInvertFilter()).isFalse();
    assertThat(materialConfig.isShallowClone()).isFalse();
}
Also used : GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) Test(org.junit.jupiter.api.Test)

Example 62 with GitMaterialConfig

use of com.thoughtworks.go.config.materials.git.GitMaterialConfig in project gocd by gocd.

the class PartialConfigMother method withPipelineMultipleMaterials.

public static PartialConfig withPipelineMultipleMaterials(String name, RepoConfigOrigin repoOrigin) {
    GitMaterialConfig gitMaterialConfig = MaterialConfigsMother.gitMaterialConfig();
    gitMaterialConfig.setFolder("git");
    SvnMaterialConfig svnMaterialConfig = MaterialConfigsMother.svnMaterialConfig();
    svnMaterialConfig.setFolder("svn");
    PipelineConfig pipe = PipelineConfigMother.pipelineConfig(name, new MaterialConfigs(gitMaterialConfig, svnMaterialConfig));
    BasicPipelineConfigs pipes = new BasicPipelineConfigs(pipe);
    pipes.setGroup("group");
    PartialConfig partialConfig = new PartialConfig(new PipelineGroups(pipes));
    partialConfig.setOrigins(repoOrigin);
    return partialConfig;
}
Also used : PipelineGroups(com.thoughtworks.go.domain.PipelineGroups) MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) PartialConfig(com.thoughtworks.go.config.remote.PartialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)

Example 63 with GitMaterialConfig

use of com.thoughtworks.go.config.materials.git.GitMaterialConfig in project gocd by gocd.

the class MaterialConfigsMother method git.

public static GitMaterialConfig git(String url, String username, String password) {
    GitMaterialConfig gitMaterialConfig = git(url);
    gitMaterialConfig.setUserName(username);
    gitMaterialConfig.setPassword(password);
    return gitMaterialConfig;
}
Also used : GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig)

Example 64 with GitMaterialConfig

use of com.thoughtworks.go.config.materials.git.GitMaterialConfig in project gocd by gocd.

the class MaterialConfigsMother method git.

public static GitMaterialConfig git(String url, boolean shallowClone) {
    GitMaterialConfig gitMaterialConfig = git(url);
    gitMaterialConfig.setShallowClone(shallowClone);
    return gitMaterialConfig;
}
Also used : GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig)

Example 65 with GitMaterialConfig

use of com.thoughtworks.go.config.materials.git.GitMaterialConfig in project gocd by gocd.

the class MaterialConfigsMother method git.

public static GitMaterialConfig git(String url, String userName, String password, String branch, String submoduleFolder, boolean autoUpdate, Filter filter, boolean invertFilter, String folder, CaseInsensitiveString name, Boolean shallowClone) {
    GitMaterialConfig gitMaterialConfig = git(url, branch, shallowClone);
    gitMaterialConfig.setUserName(userName);
    gitMaterialConfig.setPassword(password);
    gitMaterialConfig.setSubmoduleFolder(submoduleFolder);
    gitMaterialConfig.setAutoUpdate(autoUpdate);
    gitMaterialConfig.setFilter(filter);
    gitMaterialConfig.setInvertFilter(invertFilter);
    gitMaterialConfig.setFolder(folder);
    gitMaterialConfig.setName(name);
    return gitMaterialConfig;
}
Also used : GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig)

Aggregations

GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)138 Test (org.junit.jupiter.api.Test)73 Test (org.junit.Test)37 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)21 ScmMaterialConfig (com.thoughtworks.go.config.materials.ScmMaterialConfig)21 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)20 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)19 ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)17 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)16 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)14 P4MaterialConfig (com.thoughtworks.go.config.materials.perforce.P4MaterialConfig)14 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)13 GitMaterialInstance (com.thoughtworks.go.domain.materials.git.GitMaterialInstance)11 PluggableSCMMaterialConfig (com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig)10 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)10 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)9 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)8 Material (com.thoughtworks.go.domain.materials.Material)8 SCMs (com.thoughtworks.go.domain.scm.SCMs)8 TfsMaterialConfig (com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig)7