use of com.thoughtworks.go.config.materials.git.GitMaterialConfig in project gocd by gocd.
the class ConfigReposConfigTest method shouldReturnFalseThatHasConfigRepoWhenEmpty.
@Test
public void shouldReturnFalseThatHasConfigRepoWhenEmpty() {
assertThat(repos.isEmpty(), is(true));
assertThat(repos.contains(new ConfigRepoConfig(new GitMaterialConfig("http://git"), "myplugin")), is(false));
}
use of com.thoughtworks.go.config.materials.git.GitMaterialConfig in project gocd by gocd.
the class CruiseConfigTestBase method getAllUniquePostCommitSchedulableMaterials_shouldReturnMaterialsWithAutoUpdateFalseAndConfigRepos.
@Test
public void getAllUniquePostCommitSchedulableMaterials_shouldReturnMaterialsWithAutoUpdateFalseAndConfigRepos() {
GitMaterialConfig gitAutoMaterial = MaterialConfigsMother.gitMaterialConfig("url");
PipelineConfig pipelineAuto = pipelineConfig("pipelineAuto", new MaterialConfigs(gitAutoMaterial));
GitMaterialConfig gitNonAutoMaterial = new GitMaterialConfig(new UrlArgument("other-url"), "master", "dest", false, null, false, null, new CaseInsensitiveString("git"), false);
PipelineConfig pipelineTriggerable = pipelineConfig("pipelineTriggerable", new MaterialConfigs(gitNonAutoMaterial));
PipelineConfigs defaultGroup = createGroup("defaultGroup", pipelineAuto, pipelineTriggerable);
cruiseConfig = new BasicCruiseConfig(defaultGroup);
ConfigReposConfig reposConfig = new ConfigReposConfig();
GitMaterialConfig configRepoMaterial = new GitMaterialConfig("http://git");
reposConfig.add(new ConfigRepoConfig(configRepoMaterial, "myplug"));
cruiseConfig.setConfigRepos(reposConfig);
PipelineGroups pipelineGroups = new PipelineGroups(defaultGroup);
Set<MaterialConfig> materials = cruiseConfig.getAllUniquePostCommitSchedulableMaterials();
assertThat(materials.size(), is(2));
assertThat(materials, hasItem(gitNonAutoMaterial));
assertThat(materials, hasItem(configRepoMaterial));
}
use of com.thoughtworks.go.config.materials.git.GitMaterialConfig in project gocd by gocd.
the class MergeCruiseConfigTest method getAllLocalPipelineConfigs_shouldExcludePipelinesReferencedByRemoteEnvironmentWhenRequested.
@Test
public void getAllLocalPipelineConfigs_shouldExcludePipelinesReferencedByRemoteEnvironmentWhenRequested() {
pipelines = new BasicPipelineConfigs("group_main", new Authorization(), PipelineConfigMother.pipelineConfig("local-pipeline-1"));
cruiseConfig = new BasicCruiseConfig(pipelines);
ConfigReposConfig reposConfig = new ConfigReposConfig();
ConfigRepoConfig configRepoConfig = new ConfigRepoConfig(new GitMaterialConfig("http://git"), "myplug");
reposConfig.add(configRepoConfig);
cruiseConfig.setConfigRepos(reposConfig);
PartialConfig partialConfig = PartialConfigMother.withPipelineInGroup("remote-pipeline-1", "g2");
BasicEnvironmentConfig remoteEnvironment = new BasicEnvironmentConfig(new CaseInsensitiveString("UAT"));
remoteEnvironment.setOrigins(new RepoConfigOrigin());
// remote environment declares a local pipeline as member
remoteEnvironment.addPipeline(new CaseInsensitiveString("local-pipeline-1"));
partialConfig.getEnvironments().add(remoteEnvironment);
partialConfig.setOrigins(new RepoConfigOrigin(configRepoConfig, "123"));
cruiseConfig.merge(Arrays.asList(partialConfig), true);
assertThat(cruiseConfig.hasPipelineNamed(new CaseInsensitiveString("local-pipeline-1")), is(true));
List<PipelineConfig> localPipelines = cruiseConfig.getAllLocalPipelineConfigs(true);
assertThat(localPipelines.size(), is(0));
}
use of com.thoughtworks.go.config.materials.git.GitMaterialConfig 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));
}
use of com.thoughtworks.go.config.materials.git.GitMaterialConfig 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));
}
Aggregations