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));
}
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));
}
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));
}
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"));
}
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));
}
Aggregations