Search in sources :

Example 71 with GitMaterialConfig

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));
}
Also used : GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) Test(org.junit.Test)

Example 72 with GitMaterialConfig

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));
}
Also used : UrlArgument(com.thoughtworks.go.util.command.UrlArgument) MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) PluggableSCMMaterialConfig(com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig) P4MaterialConfig(com.thoughtworks.go.config.materials.perforce.P4MaterialConfig) TfsMaterialConfig(com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) PackageMaterialConfig(com.thoughtworks.go.config.materials.PackageMaterialConfig) ScmMaterialConfig(com.thoughtworks.go.config.materials.ScmMaterialConfig) MergePipelineConfigs(com.thoughtworks.go.config.merge.MergePipelineConfigs) Test(org.junit.Test)

Example 73 with GitMaterialConfig

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));
}
Also used : PipelineConfigMother.createPipelineConfig(com.thoughtworks.go.helper.PipelineConfigMother.createPipelineConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) Test(org.junit.Test)

Example 74 with GitMaterialConfig

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));
}
Also used : HttpOperationResult(com.thoughtworks.go.server.service.result.HttpOperationResult) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) Test(org.junit.Test)

Example 75 with GitMaterialConfig

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));
}
Also used : HttpOperationResult(com.thoughtworks.go.server.service.result.HttpOperationResult) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) 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