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();
}
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();
}
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();
}
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);
}
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));
}
Aggregations