Search in sources :

Example 66 with SvnMaterialConfig

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

the class ScheduledPipelineLoaderIntegrationTest method shouldSetPasswordForExpandedSvnMaterial.

// if other materials have expansion concept at some point, add more tests here
@Test
public void shouldSetPasswordForExpandedSvnMaterial() {
    PipelineConfig pipelineConfig = PipelineConfigMother.pipelineConfig("last", new StageConfig(new CaseInsensitiveString("stage"), new JobConfigs(new JobConfig("job-one"))));
    pipelineConfig.materialConfigs().clear();
    SvnMaterialConfig materialConfig = svnRepo.materialConfig();
    materialConfig.setConfigAttributes(Collections.singletonMap(SvnMaterialConfig.CHECK_EXTERNALS, String.valueOf(true)));
    materialConfig.setPassword("boozer");
    pipelineConfig.addMaterialConfig(materialConfig);
    configHelper.addPipeline(pipelineConfig);
    Pipeline loadedPipeline = createAndLoadModifyOneFilePipeline(pipelineConfig);
    MaterialRevisions revisions = loadedPipeline.getBuildCause().getMaterialRevisions();
    assertThat(revisions.getRevisions().size(), is(2));
    assertThat(((SvnMaterial) revisions.getRevisions().get(0).getMaterial()).getPassword(), is("boozer"));
    assertThat(((SvnMaterial) revisions.getRevisions().get(1).getMaterial()).getPassword(), is("boozer"));
}
Also used : SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) Test(org.junit.Test)

Example 67 with SvnMaterialConfig

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

the class PipelineHistoryServiceIntegrationTest method shouldCreateEmptyPipelineIfThePipelineHasNeverBeenRun.

@Test
public void shouldCreateEmptyPipelineIfThePipelineHasNeverBeenRun() throws Exception {
    SvnMaterialConfig svnMaterial = new SvnMaterialConfig("https://some-url", "new-user", "new-pass", false);
    configHelper.addPipeline("new-pipeline", "new-stage", svnMaterial, "first-job");
    PipelineInstanceModels instanceModels = pipelineHistoryService.loadWithEmptyAsDefault("new-pipeline", Pagination.ONE_ITEM, "username");
    PipelineInstanceModel instanceModel = instanceModels.get(0);
    assertThat(instanceModel.getMaterials(), is(new MaterialConfigs(svnMaterial)));
    assertThat(instanceModel.getCurrentRevision(svnMaterial).getRevision(), is("No historical data"));
    assertThat(instanceModel.getLatestRevision(svnMaterial).getRevision(), is("No historical data"));
    assertThat(instanceModel.getStageHistory().size(), is(1));
    assertThat(instanceModel.getStageHistory().get(0).getName(), is("new-stage"));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) Test(org.junit.Test)

Example 68 with SvnMaterialConfig

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

the class BuildCauseProducerServiceWithFlipModificationTest method shouldMarkModificationChangedAsTrueIfMaterialsChanged.

@Test
public void shouldMarkModificationChangedAsTrueIfMaterialsChanged() throws Exception {
    SvnMaterialConfig svnMaterialConfig = setUpPipelineWithTwoMaterials();
    scheduleHelper.autoSchedulePipelinesWithRealMaterials(PIPELINE_NAME);
    consume(buildCauseForPipeline());
    configHelper.replaceMaterialForPipeline(PIPELINE_NAME, svnMaterialConfig);
    scheduleHelper.autoSchedulePipelinesWithRealMaterials(PIPELINE_NAME);
    verifyBuildCauseHasModificationsWith(pipelineScheduleQueue.toBeScheduled(), true);
}
Also used : SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) Test(org.junit.Test)

Example 69 with SvnMaterialConfig

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

the class MaterialUpdateServiceIntegrationTest method shouldClearServerHealthLogsForMaterialThatNoLongerExistsInCruiseConfig.

@Test
public void shouldClearServerHealthLogsForMaterialThatNoLongerExistsInCruiseConfig() throws Exception {
    HealthStateScope badScope = HealthStateScope.forMaterial(new SvnMaterial("non-existent-url!", "user", "pwd", false));
    serverHealthService.update(ServerHealthState.error("where's the material!", "fubar", HealthStateType.general(badScope)));
    SvnMaterialConfig goodMaterial = new SvnMaterialConfig("good-url!", "user", "pwd", false);
    HealthStateScope goodScope = HealthStateScope.forMaterialConfig(goodMaterial);
    serverHealthService.update(ServerHealthState.error("could not update!", "why", HealthStateType.general(goodScope)));
    MaterialUpdateService materialUpdateService = new MaterialUpdateService(null, null, mock(MaterialUpdateCompletedTopic.class), mock(GoConfigWatchList.class), mock(GoConfigService.class), systemEnvironment, serverHealthService, null, mock(MDUPerformanceLogger.class), materialConfigConverter, null);
    materialUpdateService.onConfigChange(configWithMaterial(goodMaterial));
    assertThat(serverHealthService, ServerHealthMatcher.containsState(HealthStateType.general(goodScope)));
}
Also used : HealthStateScope(com.thoughtworks.go.serverhealth.HealthStateScope) MDUPerformanceLogger(com.thoughtworks.go.server.perf.MDUPerformanceLogger) GoConfigWatchList(com.thoughtworks.go.config.GoConfigWatchList) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) GoConfigService(com.thoughtworks.go.server.service.GoConfigService) Test(org.junit.Test)

Example 70 with SvnMaterialConfig

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

the class MaterialExpansionServiceCachingTest method shouldExpandSvnMaterialWithExternalsIntoMultipleSvnMaterialsWhenExpandingForScheduling.

@Test
public void shouldExpandSvnMaterialWithExternalsIntoMultipleSvnMaterialsWhenExpandingForScheduling() {
    SvnMaterialConfig svnMaterialConfig = svnMaterialConfig(svnRepo.projectRepositoryUrl(), "mainRepo");
    MaterialConfigs materialConfigs = new MaterialConfigs();
    materialExpansionService.expandForScheduling(svnMaterialConfig, materialConfigs);
    assertThat(materialConfigs.size(), is(2));
    assertThat(materialConfigs.get(0), is(svnMaterialConfig));
    assertThat(((SvnMaterialConfig) materialConfigs.get(1)).getUrl(), endsWith("end2end/"));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)

Aggregations

SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)72 Test (org.junit.Test)54 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)22 P4MaterialConfig (com.thoughtworks.go.config.materials.perforce.P4MaterialConfig)12 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)11 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)11 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)8 GoCipher (com.thoughtworks.go.security.GoCipher)8 PluggableSCMMaterialConfig (com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig)7 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)6 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)6 TfsMaterialConfig (com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig)6 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)6 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)4 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)4 SvnCommand (com.thoughtworks.go.domain.materials.svn.SvnCommand)4 SvnTestRepo (com.thoughtworks.go.helper.SvnTestRepo)3 ScmMaterialConfig (com.thoughtworks.go.config.materials.ScmMaterialConfig)2 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)2 ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)2