Search in sources :

Example 81 with SvnMaterialConfig

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

the class ConfigConverterTest method shouldConvertSvmMaterialWhenPlainPassword.

@Test
void shouldConvertSvmMaterialWhenPlainPassword() {
    CRSvnMaterial crSvnMaterial = new CRSvnMaterial("name", "folder", true, false, "username", filter, "url", true);
    crSvnMaterial.setPassword("password");
    SvnMaterialConfig svnMaterialConfig = (SvnMaterialConfig) configConverter.toMaterialConfig(crSvnMaterial, context, new SCMs());
    assertThat(svnMaterialConfig.getName().toLower()).isEqualTo("name");
    assertThat(svnMaterialConfig.getFolder()).isEqualTo("folder");
    assertThat(svnMaterialConfig.getAutoUpdate()).isTrue();
    assertThat(svnMaterialConfig.getFilterAsString()).isEqualTo("filter");
    assertThat(svnMaterialConfig.getUrl()).isEqualTo("url");
    assertThat(svnMaterialConfig.getUserName()).isEqualTo("username");
    assertThat(svnMaterialConfig.getPassword()).isEqualTo("password");
    assertThat(svnMaterialConfig.isCheckExternals()).isTrue();
}
Also used : SCMs(com.thoughtworks.go.domain.scm.SCMs) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) Test(org.junit.jupiter.api.Test)

Example 82 with SvnMaterialConfig

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

the class ConfigConverterTest method shouldConvertSvmMaterialWhenEncryptedPassword.

@Test
void shouldConvertSvmMaterialWhenEncryptedPassword() throws CryptoException {
    String encryptedPassword = new GoCipher().encrypt("plain-text-password");
    CRSvnMaterial crSvnMaterial = new CRSvnMaterial("name", "folder", true, false, "username", filter, "url", true);
    crSvnMaterial.setEncryptedPassword(encryptedPassword);
    SvnMaterialConfig svnMaterialConfig = (SvnMaterialConfig) configConverter.toMaterialConfig(crSvnMaterial, context, new SCMs());
    assertThat(svnMaterialConfig.getName().toLower()).isEqualTo("name");
    assertThat(svnMaterialConfig.getFolder()).isEqualTo("folder");
    assertThat(svnMaterialConfig.getAutoUpdate()).isTrue();
    assertThat(svnMaterialConfig.getFilterAsString()).isEqualTo("filter");
    assertThat(svnMaterialConfig.getUrl()).isEqualTo("url");
    assertThat(svnMaterialConfig.getUserName()).isEqualTo("username");
    assertThat(svnMaterialConfig.getPassword()).isEqualTo("plain-text-password");
    assertThat(svnMaterialConfig.isCheckExternals()).isTrue();
}
Also used : SCMs(com.thoughtworks.go.domain.scm.SCMs) GoCipher(com.thoughtworks.go.security.GoCipher) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) Test(org.junit.jupiter.api.Test)

Example 83 with SvnMaterialConfig

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

the class ConfigConverterTest method shouldConvertSvmMaterialConfigWhenEncryptedPassword.

@Test
void shouldConvertSvmMaterialConfigWhenEncryptedPassword() throws CryptoException {
    String encryptedPassword = new GoCipher().encrypt("plain-text-password");
    SvnMaterialConfig svnMaterialConfig = svn("url", true);
    svnMaterialConfig.setName(new CaseInsensitiveString("name"));
    svnMaterialConfig.setEncryptedPassword(encryptedPassword);
    svnMaterialConfig.setFolder("folder");
    svnMaterialConfig.setFilter(Filter.create("filter"));
    svnMaterialConfig.setUserName("username");
    CRSvnMaterial crSvnMaterial = (CRSvnMaterial) configConverter.materialToCRMaterial(svnMaterialConfig);
    assertThat(crSvnMaterial.getName()).isEqualTo("name");
    assertThat(crSvnMaterial.getDestination()).isEqualTo("folder");
    assertThat(crSvnMaterial.isAutoUpdate()).isTrue();
    assertThat(crSvnMaterial.getFilterList()).contains("filter");
    assertThat(crSvnMaterial.getUrl()).isEqualTo("url");
    assertThat(crSvnMaterial.getUsername()).isEqualTo("username");
    assertThat(crSvnMaterial.getEncryptedPassword()).isEqualTo(encryptedPassword);
    assertThat(crSvnMaterial.getPassword()).isNull();
    assertThat(crSvnMaterial.isCheckExternals()).isTrue();
}
Also used : GoCipher(com.thoughtworks.go.security.GoCipher) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) Test(org.junit.jupiter.api.Test)

Example 84 with SvnMaterialConfig

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

the class ConfigConverterTest method shouldConvertPipelineConfigToCRPipeline.

@Test
void shouldConvertPipelineConfigToCRPipeline() {
    TrackingTool trackingTool = new TrackingTool();
    trackingTool.setLink("link");
    TimerConfig timerConfig = new TimerConfig("timer", true);
    PipelineConfig pipeline = new PipelineConfig();
    pipeline.setName("p1");
    pipeline.setTimer(timerConfig);
    pipeline.setTrackingTool(trackingTool);
    pipeline.addEnvironmentVariable("testing", "123");
    pipeline.setDisplayOrderWeight(10);
    StageConfig stage = new StageConfig();
    stage.setName(new CaseInsensitiveString("build"));
    JobConfig job = new JobConfig();
    job.setName("buildjob");
    job.setTasks(new Tasks(new RakeTask()));
    stage.setJobs(new JobConfigs(job));
    pipeline.addStageWithoutValidityAssertion(stage);
    SvnMaterialConfig mat = svn();
    mat.setName(new CaseInsensitiveString("mat"));
    mat.setUrl("url");
    pipeline.addMaterialConfig(mat);
    CRPipeline crPipeline = configConverter.pipelineConfigToCRPipeline(pipeline, "group1");
    assertThat(crPipeline.getName()).isEqualTo("p1");
    assertThat(crPipeline.getGroup()).isEqualTo("group1");
    assertThat(crPipeline.getMaterialByName("mat") instanceof CRSvnMaterial).isTrue();
    assertThat(crPipeline.getLabelTemplate()).isEqualTo(PipelineLabel.COUNT_TEMPLATE);
    assertThat(crPipeline.getMaterials().size()).isEqualTo(1);
    assertThat(crPipeline.hasEnvironmentVariable("testing")).isTrue();
    assertThat(crPipeline.getTrackingTool().getLink()).isEqualTo("link");
    assertThat(crPipeline.getTimer().getSpec()).isEqualTo("timer");
    assertThat(crPipeline.getStages().get(0).getName()).isEqualTo("build");
    assertThat(crPipeline.getStages().get(0).getJobs().size()).isEqualTo(1);
    assertThat(crPipeline.getDisplayOrderWeight()).isEqualTo(10);
}
Also used : SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) Test(org.junit.jupiter.api.Test)

Example 85 with SvnMaterialConfig

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

the class BuildCauseProducerServiceTest method shouldCheckForModificationsWhenManuallyScheduling.

@Test
public void shouldCheckForModificationsWhenManuallyScheduling() throws Exception {
    HgMaterialConfig hgMaterialConfig = hg("url", null);
    HgMaterial hgMaterial = new HgMaterial("url", null);
    SvnMaterial svnMaterial = new SvnMaterial("url", null, null, false);
    SvnMaterialConfig svnMaterialConfig = svn("url", null, null, false);
    pipelineConfig.addMaterialConfig(hgMaterialConfig);
    pipelineConfig.addMaterialConfig(svnMaterialConfig);
    when(materialConfigConverter.toMaterial(hgMaterialConfig)).thenReturn(hgMaterial);
    when(materialConfigConverter.toMaterial(svnMaterialConfig)).thenReturn(svnMaterial);
    ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
    buildCauseProducerService.manualSchedulePipeline(Username.ANONYMOUS, pipelineConfig.name(), new ScheduleOptions(), result);
    assertThat(result.getServerHealthState().isSuccess(), is(true));
    verify(mockMaterialUpdateService, times(2)).updateMaterial(any(Material.class));
    verify(mockMaterialUpdateStatusNotifier).registerListenerFor(eq(pipelineConfig), any(MaterialUpdateStatusListener.class));
}
Also used : SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) Material(com.thoughtworks.go.domain.materials.Material) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) Test(org.junit.jupiter.api.Test)

Aggregations

SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)92 Test (org.junit.jupiter.api.Test)60 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)25 P4MaterialConfig (com.thoughtworks.go.config.materials.perforce.P4MaterialConfig)15 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)12 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)11 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)11 GoCipher (com.thoughtworks.go.security.GoCipher)11 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)9 PluggableSCMMaterialConfig (com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig)9 TfsMaterialConfig (com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig)8 Test (org.junit.Test)8 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)7 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)6 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)5 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)4 SvnCommand (com.thoughtworks.go.domain.materials.svn.SvnCommand)4 SCMs (com.thoughtworks.go.domain.scm.SCMs)3 GoConfigMother (com.thoughtworks.go.helper.GoConfigMother)3 SvnTestRepo (com.thoughtworks.go.helper.SvnTestRepo)3