Search in sources :

Example 86 with GitMaterialConfig

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

the class PipelineConfigTest method createAndValidatePipelineLabel.

private PipelineConfig createAndValidatePipelineLabel(String labelFormat) {
    GitMaterialConfig git = new GitMaterialConfig("git@github.com:gocd/gocd.git");
    git.setName(new CaseInsensitiveString("git"));
    PipelineConfig pipelineConfig = new PipelineConfig(new CaseInsensitiveString("cruise"), new MaterialConfigs(git));
    pipelineConfig.setLabelTemplate(labelFormat);
    pipelineConfig.validate(null);
    return pipelineConfig;
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig)

Example 87 with GitMaterialConfig

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

the class PipelineConfigTest method shouldReturnTrueWhenOneOfPipelineMaterialsIsTheSameAsConfigOriginButDestinationIsDifferent.

@Test
public void shouldReturnTrueWhenOneOfPipelineMaterialsIsTheSameAsConfigOriginButDestinationIsDifferent() {
    PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfig("pipeline", "stage", "build");
    pipelineConfig.materialConfigs().clear();
    GitMaterialConfig pipeMaterialConfig = new GitMaterialConfig("http://git");
    pipeMaterialConfig.setFolder("dest1");
    pipelineConfig.materialConfigs().add(pipeMaterialConfig);
    GitMaterialConfig repoMaterialConfig = new GitMaterialConfig("http://git");
    pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(repoMaterialConfig, "plugin"), "1233"));
    assertThat(pipelineConfig.isConfigOriginSameAsOneOfMaterials(), is(true));
}
Also used : GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) Test(org.junit.Test)

Example 88 with GitMaterialConfig

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

the class PipelineConfigValidationTest method shouldCheckForPipelineNameUniqueness.

@Test
public void shouldCheckForPipelineNameUniqueness() {
    BasicCruiseConfig cruiseConfig = GoConfigMother.configWithPipelines("p1");
    String group = "group";
    cruiseConfig.getGroups().add(new BasicPipelineConfigs(group, new Authorization()));
    PipelineConfig p1Duplicate = GoConfigMother.createPipelineConfigWithMaterialConfig("p1", new GitMaterialConfig("url"));
    cruiseConfig.addPipeline(group, p1Duplicate);
    PipelineConfigSaveValidationContext context = PipelineConfigSaveValidationContext.forChain(true, group, cruiseConfig, p1Duplicate);
    p1Duplicate.validateTree(context);
    assertThat(p1Duplicate.errors().on(PipelineConfig.NAME), is(String.format("You have defined multiple pipelines named '%s'. Pipeline names must be unique. Source(s): [cruise-config.xml]", p1Duplicate.name())));
}
Also used : GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) Test(org.junit.Test)

Example 89 with GitMaterialConfig

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

the class PipelineConfigValidationTest method shouldFailValidateWhenUpstreamStageForDependencyMaterailDoesNotExist.

@Test
public void shouldFailValidateWhenUpstreamStageForDependencyMaterailDoesNotExist() {
    String upstreamPipeline = "upstream";
    String upstreamStage = "non-existant";
    PipelineConfig upstream = GoConfigMother.createPipelineConfigWithMaterialConfig(upstreamPipeline, new GitMaterialConfig("url"));
    PipelineConfig pipelineConfig = GoConfigMother.createPipelineConfigWithMaterialConfig("downstream", new DependencyMaterialConfig(new CaseInsensitiveString(upstreamPipeline), new CaseInsensitiveString(upstreamStage)));
    BasicCruiseConfig cruiseConfig = new BasicCruiseConfig(new BasicPipelineConfigs(pipelineConfig, upstream));
    boolean isValid = pipelineConfig.validateTree(PipelineConfigSaveValidationContext.forChain(true, cruiseConfig.getGroups().first().getGroup(), cruiseConfig, pipelineConfig));
    assertThat(isValid, is(false));
    ConfigErrors materialErrors = pipelineConfig.materialConfigs().first().errors();
    assertThat(materialErrors.isEmpty(), is(false));
    assertThat(materialErrors.firstError(), is("Stage with name 'non-existant' does not exist on pipeline 'upstream', it is being referred to from pipeline 'downstream' (cruise-config.xml)"));
}
Also used : GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) Test(org.junit.Test)

Example 90 with GitMaterialConfig

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

the class ConfigSaveDeadlockDetectionIntegrationTest method configSaveThread.

private Thread configSaveThread(final int counter) throws InvalidCipherTextException, InterruptedException {
    return createThread(new Runnable() {

        @Override
        public void run() {
            goConfigService.updateConfig(new UpdateConfigCommand() {

                @Override
                public CruiseConfig update(CruiseConfig cruiseConfig) throws Exception {
                    PipelineConfig pipelineConfig = GoConfigMother.createPipelineConfigWithMaterialConfig(UUID.randomUUID().toString(), new GitMaterialConfig("FOO"));
                    cruiseConfig.addPipeline("default", pipelineConfig);
                    return cruiseConfig;
                }
            });
        }
    }, "config-save-thread" + counter);
}
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