Search in sources :

Example 66 with GitMaterialConfig

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

the class UpdatePackageConfigCommandTest method shouldUpdatePackageConfigurationOnAssociatedPipelines.

@Test
public void shouldUpdatePackageConfigurationOnAssociatedPipelines() {
    GitMaterialConfig git = git("http://example.com");
    PackageMaterialConfig packageMaterial = packageMaterialConfig();
    PipelineConfig p1 = pipelineConfig("p1", new MaterialConfigs(git, packageMaterial));
    PipelineConfig p2 = pipelineConfig("p2", new MaterialConfigs(git));
    PipelineConfig p3 = pipelineConfig("p3", new MaterialConfigs(packageMaterial));
    PipelineConfigs group1 = createGroup("group1", p1, p2);
    PipelineConfigs group2 = createGroup("group2", p3);
    cruiseConfig.setGroup(new PipelineGroups(group1, group2));
    Configuration updatedConfiguration = new Configuration(create("new_key1", "new_value1"), create("new_key2", "new_value2"));
    newPackageDefinition = PackageDefinitionMother.create(packageMaterial.getPackageId(), "prettyjson", updatedConfiguration, packageMaterial.getPackageDefinition().getRepository());
    UpdatePackageConfigCommand command = new UpdatePackageConfigCommand(goConfigService, packageUuid, newPackageDefinition, currentUser, "digest", this.entityHashingService, result, packageDefinitionService);
    command.update(cruiseConfig);
    PackageMaterialConfig materialConfig1 = cruiseConfig.getPipelineConfigByName(new CaseInsensitiveString("p1")).packageMaterialConfigs().get(0);
    assertThat(materialConfig1.getPackageDefinition(), is(newPackageDefinition));
    PackageMaterialConfig materialConfig2 = cruiseConfig.getPipelineConfigByName(new CaseInsensitiveString("p3")).packageMaterialConfigs().get(0);
    assertThat(materialConfig2.getPackageDefinition(), is(newPackageDefinition));
}
Also used : PipelineGroups(com.thoughtworks.go.domain.PipelineGroups) MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) PackageMaterialConfig(com.thoughtworks.go.config.materials.PackageMaterialConfig) PipelineConfig(com.thoughtworks.go.config.PipelineConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) PipelineConfigs(com.thoughtworks.go.config.PipelineConfigs) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.jupiter.api.Test)

Example 67 with GitMaterialConfig

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

the class ConfigReposConfigTest method shouldReturnTrueThatHasConfigRepoWhenAddedConfigRepo.

@Test
public void shouldReturnTrueThatHasConfigRepoWhenAddedConfigRepo() {
    repos.add(new ConfigRepoConfig(new GitMaterialConfig("http://git"), "myplugin", "repo-id"));
    assertThat(repos.contains(new ConfigRepoConfig(new GitMaterialConfig("http://git"), "myplugin", "repo-id")), is(true));
}
Also used : GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) Test(org.junit.Test)

Example 68 with GitMaterialConfig

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

the class ConfigReposConfigTest method shouldFindConfigRepoWithSpecifiedId.

@Test
public void shouldFindConfigRepoWithSpecifiedId() {
    String id = "repo1";
    ConfigRepoConfig configRepo1 = new ConfigRepoConfig(new GitMaterialConfig("http://git"), "myplugin", id);
    repos.add(configRepo1);
    assertThat(repos.getConfigRepo(id), is(configRepo1));
}
Also used : GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) Test(org.junit.Test)

Example 69 with GitMaterialConfig

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

the class ConfigReposConfigTest method shouldErrorWhenEmptyIdIsProvided.

@Test
public void shouldErrorWhenEmptyIdIsProvided() {
    ConfigRepoConfig repo1 = new ConfigRepoConfig(new GitMaterialConfig("http://git1"), "myplugin", "  ");
    repos.add(repo1);
    repos.validate(null);
    assertThat(repo1.errors().on("id"), is("Invalid config-repo id"));
}
Also used : GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) Test(org.junit.Test)

Example 70 with GitMaterialConfig

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

the class ConfigReposConfigTest method shouldNotErrorWhenReposFingerprintDiffer.

@Test
public void shouldNotErrorWhenReposFingerprintDiffer() {
    ConfigRepoConfig repo1 = new ConfigRepoConfig(new GitMaterialConfig("http://git"), "myplugin", "id1");
    ConfigRepoConfig repo2 = new ConfigRepoConfig(new GitMaterialConfig("https://git", "develop"), "myotherplugin", "id2");
    repos.add(repo1);
    repos.add(repo2);
    repos.validate(null);
    assertThat(repo1.errors().isEmpty(), is(true));
    assertThat(repo2.errors().isEmpty(), is(true));
}
Also used : GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) Test(org.junit.Test)

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