Search in sources :

Example 31 with HgMaterialConfig

use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.

the class ParamResolverTest method shouldResolveCollections.

@Test
public void shouldResolveCollections() throws NoSuchFieldException {
    PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfig("cruise", "dev", "ant");
    pipelineConfig.setLabelTemplate("2.1-${COUNT}-#{foo}-bar-#{bar}");
    HgMaterialConfig materialConfig = MaterialConfigsMother.hgMaterialConfig("http://#{foo}.com/#{bar}");
    pipelineConfig.addMaterialConfig(materialConfig);
    new ParamResolver(new ParamSubstitutionHandlerFactory(params(param("foo", "pavan"), param("bar", "jj"))), fieldCache).resolve(pipelineConfig);
    assertThat(pipelineConfig.getLabelTemplate(), is("2.1-${COUNT}-pavan-bar-jj"));
    assertThat(pipelineConfig.materialConfigs().get(1).getUriForDisplay(), is("http://pavan.com/jj"));
}
Also used : HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig) Test(org.junit.Test)

Example 32 with HgMaterialConfig

use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.

the class ParamResolverTest method shouldLexicallyScopeTheParameters.

@Test
public void shouldLexicallyScopeTheParameters() throws NoSuchFieldException {
    PipelineConfig withParams = PipelineConfigMother.createPipelineConfig("cruise", "dev", "ant");
    withParams.addParam(param("foo", "pipeline"));
    PipelineConfig withoutParams = PipelineConfigMother.createPipelineConfig("mingle", "dev", "ant");
    CruiseConfig cruiseConfig = new BasicCruiseConfig();
    cruiseConfig.addPipeline("group", withParams);
    cruiseConfig.addPipeline("group", withoutParams);
    cruiseConfig.server().setArtifactsDir("/#{foo}/#{bar}");
    HgMaterialConfig materialConfig = MaterialConfigsMother.hgMaterialConfig();
    materialConfig.setConfigAttributes(Collections.singletonMap(ScmMaterialConfig.FOLDER, "work/#{foo}/#{bar}/baz"));
    withParams.addMaterialConfig(materialConfig);
    withParams.setLabelTemplate("2.0.#{foo}-#{bar}");
    withoutParams.setLabelTemplate("2.0.#{foo}-#{bar}");
    new ParamResolver(new ParamSubstitutionHandlerFactory(params(param("foo", "global"), param("bar", "global-only"))), fieldCache).resolve(cruiseConfig);
    assertThat(withParams.materialConfigs().get(1).getFolder(), is("work/pipeline/global-only/baz"));
    assertThat(withParams.getLabelTemplate(), is("2.0.pipeline-global-only"));
    assertThat(withoutParams.getLabelTemplate(), is("2.0.global-global-only"));
}
Also used : HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig) Test(org.junit.Test)

Example 33 with HgMaterialConfig

use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.

the class MaterialConfigsTest method shouldCheckSCMMaterialsHaveDestinationCorrectly.

@Test
public void shouldCheckSCMMaterialsHaveDestinationCorrectly() {
    HgMaterialConfig materialConfigOne = new HgMaterialConfig("http://url1", null);
    materialConfigOne.setConfigAttributes(Collections.singletonMap(ScmMaterialConfig.FOLDER, "folder"));
    CruiseConfig config = GoConfigMother.configWithPipelines("one");
    PipelineConfig pipelineOne = config.pipelineConfigByName(new CaseInsensitiveString("one"));
    pipelineOne.setMaterialConfigs((new MaterialConfigs(materialConfigOne)));
    assertThat(pipelineOne.materialConfigs().scmMaterialsHaveDestination(), is(true));
    PluggableSCMMaterialConfig materialConfigTwo = new PluggableSCMMaterialConfig(null, SCMMother.create("scm-id"), null, null);
    pipelineOne.materialConfigs().add(materialConfigTwo);
    assertThat(pipelineOne.materialConfigs().scmMaterialsHaveDestination(), is(false));
}
Also used : HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig) Test(org.junit.Test)

Example 34 with HgMaterialConfig

use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.

the class MaterialConfigsTest method shouldShowAutoUpdateMismatchErrorTwiceWhenMaterialIsAddedToSamePipeline.

@Test
public void shouldShowAutoUpdateMismatchErrorTwiceWhenMaterialIsAddedToSamePipeline() throws Exception {
    HgMaterialConfig materialOne = new HgMaterialConfig("http://url1", null);
    materialOne.setConfigAttributes(Collections.singletonMap(ScmMaterialConfig.FOLDER, "some-folder"));
    materialOne.setAutoUpdate(true);
    HgMaterialConfig materialTwo = new HgMaterialConfig("http://url1", null);
    materialTwo.setConfigAttributes(Collections.singletonMap(ScmMaterialConfig.FOLDER, "some-folder-2"));
    materialTwo.setAutoUpdate(false);
    CruiseConfig config = GoConfigMother.configWithPipelines("one");
    PipelineConfig pipelineOne = config.pipelineConfigByName(new CaseInsensitiveString("one"));
    pipelineOne.setMaterialConfigs(new MaterialConfigs(materialOne, materialTwo));
    pipelineOne.materialConfigs().validate(ConfigSaveValidationContext.forChain(config));
    assertThat(pipelineOne.materialConfigs().get(0).errors().getAll().size(), is(1));
    assertThat(pipelineOne.materialConfigs().get(1).errors().getAll().size(), is(1));
}
Also used : HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig) Test(org.junit.Test)

Example 35 with HgMaterialConfig

use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.

the class MaterialConfigsTest method shouldReturnMaterialBasedOnPiplineUniqueFingerPrint.

@Test
public void shouldReturnMaterialBasedOnPiplineUniqueFingerPrint() {
    CruiseConfig cruiseConfig = new BasicCruiseConfig();
    PipelineConfig pipeline1 = goConfigMother.addPipeline(cruiseConfig, "pipeline1", "stage", "build");
    HgMaterialConfig expectedMaterial = MaterialConfigsMother.hgMaterialConfig();
    pipeline1.addMaterialConfig(expectedMaterial);
    pipeline1.addMaterialConfig(MaterialConfigsMother.gitMaterialConfig("url"));
    pipeline1.addMaterialConfig(MaterialConfigsMother.svnMaterialConfig("url", "folder"));
    MaterialConfig actualMaterialConfig = pipeline1.materialConfigs().getByFingerPrint(expectedMaterial.getPipelineUniqueFingerprint());
    assertThat(actualMaterialConfig, is(expectedMaterial));
}
Also used : HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig) 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) Test(org.junit.Test)

Aggregations

HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)73 Test (org.junit.Test)60 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)15 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)12 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)11 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)11 P4MaterialConfig (com.thoughtworks.go.config.materials.perforce.P4MaterialConfig)11 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)10 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)9 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)8 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)8 TfsMaterialConfig (com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig)8 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)7 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)6 PluggableSCMMaterialConfig (com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig)6 ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)5 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)5 Filter (com.thoughtworks.go.config.materials.Filter)4 RepoConfigOrigin (com.thoughtworks.go.config.remote.RepoConfigOrigin)4 HgUrlArgument (com.thoughtworks.go.util.command.HgUrlArgument)4