Search in sources :

Example 26 with PluggableSCMMaterialConfig

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

the class ConfigConverterTest method shouldConvertConfigMaterialWhenPluggableScmMaterial.

@Test
void shouldConvertConfigMaterialWhenPluggableScmMaterial() {
    SCM myscm = new SCM("scmid", new PluginConfiguration(), new Configuration());
    SCMs scms = new SCMs(myscm);
    BasicCruiseConfig cruiseConfig = new BasicCruiseConfig();
    cruiseConfig.setSCMs(scms);
    when(cachedGoConfig.currentConfig()).thenReturn(cruiseConfig);
    PluggableSCMMaterialConfig configRepoMaterial = new PluggableSCMMaterialConfig(new CaseInsensitiveString("scmid"), myscm, null, null, false);
    when(context.configMaterial()).thenReturn(configRepoMaterial);
    CRConfigMaterial crConfigMaterial = new CRConfigMaterial("example", "dest1", null);
    PluggableSCMMaterialConfig pluggableSCMMaterialConfig = (PluggableSCMMaterialConfig) configConverter.toMaterialConfig(crConfigMaterial, context, scms);
    assertThat(pluggableSCMMaterialConfig.getName().toLower()).isEqualTo("example");
    assertThat(pluggableSCMMaterialConfig.getSCMConfig()).isEqualTo(myscm);
    assertThat(pluggableSCMMaterialConfig.getScmId()).isEqualTo("scmid");
    assertThat(pluggableSCMMaterialConfig.getFolder()).isEqualTo("dest1");
    assertThat(pluggableSCMMaterialConfig.getFilterAsString()).isEqualTo("");
}
Also used : SCMs(com.thoughtworks.go.domain.scm.SCMs) SCM(com.thoughtworks.go.domain.scm.SCM) PluggableSCMMaterialConfig(com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig) Test(org.junit.jupiter.api.Test)

Example 27 with PluggableSCMMaterialConfig

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

the class ConfigConverterTest method shouldConvertPluggableScmMaterial.

@Test
void shouldConvertPluggableScmMaterial() {
    SCM myscm = new SCM("scmid", new PluginConfiguration(), new Configuration());
    SCMs scms = new SCMs(myscm);
    BasicCruiseConfig cruiseConfig = new BasicCruiseConfig();
    cruiseConfig.setSCMs(scms);
    when(cachedGoConfig.currentConfig()).thenReturn(cruiseConfig);
    CRPluggableScmMaterial crPluggableScmMaterial = new CRPluggableScmMaterial("name", "scmid", "directory", filter, true);
    PluggableSCMMaterialConfig pluggableSCMMaterialConfig = (PluggableSCMMaterialConfig) configConverter.toMaterialConfig(crPluggableScmMaterial, context, scms);
    assertThat(pluggableSCMMaterialConfig.getFilterAsString()).isEqualTo("filter");
    assertTrue(pluggableSCMMaterialConfig.isInvertFilter());
}
Also used : SCMs(com.thoughtworks.go.domain.scm.SCMs) SCM(com.thoughtworks.go.domain.scm.SCM) PluggableSCMMaterialConfig(com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig) Test(org.junit.jupiter.api.Test)

Example 28 with PluggableSCMMaterialConfig

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

the class ConfigConverterTest method shouldConvertPluggableScmMaterialWithANewSCMDefinitionWithoutAnSCMID.

@Test
void shouldConvertPluggableScmMaterialWithANewSCMDefinitionWithoutAnSCMID() {
    BasicCruiseConfig cruiseConfig = new BasicCruiseConfig();
    cruiseConfig.setSCMs(new SCMs());
    when(cachedGoConfig.currentConfig()).thenReturn(cruiseConfig);
    CRPluggableScmMaterial crPluggableScmMaterial = new CRPluggableScmMaterial("name", null, "directory", filter, false);
    crPluggableScmMaterial.setPluginConfiguration(new CRPluginConfiguration("plugin_id", "1.0"));
    PluggableSCMMaterialConfig pluggableSCMMaterialConfig = (PluggableSCMMaterialConfig) configConverter.toMaterialConfig(crPluggableScmMaterial, context, new SCMs());
    assertThat(pluggableSCMMaterialConfig.getScmId()).isNotNull();
}
Also used : SCMs(com.thoughtworks.go.domain.scm.SCMs) PluggableSCMMaterialConfig(com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig) Test(org.junit.jupiter.api.Test)

Example 29 with PluggableSCMMaterialConfig

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

the class ConfigConverterTest method shouldConvertPluggableScmMaterialConfig.

@Test
void shouldConvertPluggableScmMaterialConfig() {
    SCM myscm = new SCM("scmid", new PluginConfiguration(), new Configuration());
    SCMs scms = new SCMs(myscm);
    BasicCruiseConfig cruiseConfig = new BasicCruiseConfig();
    cruiseConfig.setSCMs(scms);
    when(cachedGoConfig.currentConfig()).thenReturn(cruiseConfig);
    PluggableSCMMaterialConfig pluggableSCMMaterialConfig = new PluggableSCMMaterialConfig(new CaseInsensitiveString("name"), myscm, "directory", Filter.create("filter"), false);
    CRPluggableScmMaterial crPluggableScmMaterial = (CRPluggableScmMaterial) configConverter.materialToCRMaterial(pluggableSCMMaterialConfig);
    assertThat(crPluggableScmMaterial.getName()).isEqualTo("name");
    assertThat(crPluggableScmMaterial.getScmId()).isEqualTo("scmid");
    assertThat(crPluggableScmMaterial.getDestination()).isEqualTo("directory");
    assertThat(crPluggableScmMaterial.getFilterList()).contains("filter");
}
Also used : SCMs(com.thoughtworks.go.domain.scm.SCMs) SCM(com.thoughtworks.go.domain.scm.SCM) PluggableSCMMaterialConfig(com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig) Test(org.junit.jupiter.api.Test)

Example 30 with PluggableSCMMaterialConfig

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

the class ConfigConverterTest method shouldConvertPluggableScmMaterialWithADuplicateSCMFingerPrintShouldUseWhatAlreadyExists.

@Test
void shouldConvertPluggableScmMaterialWithADuplicateSCMFingerPrintShouldUseWhatAlreadyExists() {
    Configuration config = new Configuration();
    config.addNewConfigurationWithValue("url", "url", false);
    SCM scm = new SCM("scmid", new PluginConfiguration("plugin_id", "1.0"), config);
    scm.setName("noName");
    SCMs scms = new SCMs(scm);
    BasicCruiseConfig cruiseConfig = new BasicCruiseConfig();
    cruiseConfig.setSCMs(scms);
    when(cachedGoConfig.currentConfig()).thenReturn(cruiseConfig);
    CRPluggableScmMaterial crPluggableScmMaterial = new CRPluggableScmMaterial("name", "scmid", "directory", filter, false);
    crPluggableScmMaterial.setPluginConfiguration(new CRPluginConfiguration("plugin_id", "1.0"));
    crPluggableScmMaterial.getConfiguration().add(new CRConfigurationProperty("url", "url"));
    PluggableSCMMaterialConfig pluggableSCMMaterialConfig = (PluggableSCMMaterialConfig) configConverter.toMaterialConfig(crPluggableScmMaterial, context, scms);
    assertThat(pluggableSCMMaterialConfig.getSCMConfig()).isEqualTo(scm);
}
Also used : SCMs(com.thoughtworks.go.domain.scm.SCMs) SCM(com.thoughtworks.go.domain.scm.SCM) PluggableSCMMaterialConfig(com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig) Test(org.junit.jupiter.api.Test)

Aggregations

PluggableSCMMaterialConfig (com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig)36 Test (org.junit.jupiter.api.Test)25 SCM (com.thoughtworks.go.domain.scm.SCM)14 SCMs (com.thoughtworks.go.domain.scm.SCMs)11 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)9 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)8 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)7 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)6 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)6 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)5 P4MaterialConfig (com.thoughtworks.go.config.materials.perforce.P4MaterialConfig)5 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)4 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)4 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)4 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)4 GoConfigHolder (com.thoughtworks.go.config.GoConfigHolder)3 ScmMaterialConfig (com.thoughtworks.go.config.materials.ScmMaterialConfig)3 TfsMaterialConfig (com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig)3 ErrorGetter (com.thoughtworks.go.api.representers.ErrorGetter)2 Filter (com.thoughtworks.go.config.materials.Filter)2