Search in sources :

Example 51 with SvnMaterialConfig

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

the class MaterialExpansionServiceTest method shouldExpandSvnMaterialWithFolders.

@Test
public void shouldExpandSvnMaterialWithFolders() {
    SvnMaterialConfig svn = svnMaterialConfig(svnRepo.projectRepositoryUrl(), null);
    SvnMaterialConfig svnExt = svnMaterialConfig(svnRepo.externalRepositoryUrl(), "end2end");
    svnExt.setName(null);
    PipelineConfig pipelineConfig = new PipelineConfig();
    pipelineConfig.addMaterialConfig(svn);
    String cacheKeyForSvn = MaterialExpansionService.class + "_cacheKeyForSvnMaterialCheckExternalCommand_" + svn.getFingerprint();
    String cacheKeyForSvnExt = MaterialExpansionService.class + "_cacheKeyForSvnMaterialCheckExternalCommand_" + svnExt.getFingerprint();
    when(goCache.get(cacheKeyForSvn)).thenReturn(null);
    when(goCache.get(cacheKeyForSvnExt)).thenReturn(null);
    MaterialConfigs materialConfigs = materialExpansionService.expandMaterialConfigsForScheduling(pipelineConfig.materialConfigs());
    assertThat(materialConfigs.size(), is(2));
    assertThat(materialConfigs.get(0), is(svn));
    assertThat(materialConfigs.get(1), is(svnExt));
    assertThat(materialConfigs.get(1).filter(), is(svn.filter()));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) PipelineConfig(com.thoughtworks.go.config.PipelineConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)

Example 52 with SvnMaterialConfig

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

the class MaterialExpansionServiceTest method shouldNotExapandSVNExternalsIfCheckExternalsIsFalse.

@Test
public void shouldNotExapandSVNExternalsIfCheckExternalsIsFalse() {
    PipelineConfig pipelineConfig = new PipelineConfig();
    SvnMaterialConfig svn = svnMaterialConfig(svnRepo.projectRepositoryUrl(), null);
    svn.setConfigAttributes(Collections.singletonMap(SvnMaterialConfig.CHECK_EXTERNALS, String.valueOf(false)));
    pipelineConfig.addMaterialConfig(svn);
    String cacheKeyForSvn = MaterialExpansionService.class + "_cacheKeyForSvnMaterialCheckExternalCommand_" + svn.getFingerprint();
    when(goCache.get(cacheKeyForSvn)).thenReturn(null);
    MaterialConfigs materialConfigs = materialExpansionService.expandMaterialConfigsForScheduling(pipelineConfig.materialConfigs());
    assertThat(materialConfigs.size(), is(1));
    assertThat(materialConfigs.get(0), is(svn));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) PipelineConfig(com.thoughtworks.go.config.PipelineConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)

Example 53 with SvnMaterialConfig

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

the class PipelineConfigDependencyGraphTest method shouldReturnIfSharedRevisionsAreIgnoredByAllDaddys.

@Test
public void shouldReturnIfSharedRevisionsAreIgnoredByAllDaddys() throws Exception {
    SvnMaterialConfig firstOrderSVNMaterial = MaterialConfigsMother.svnMaterialConfig();
    GitMaterialConfig firstOrderGitMaterial = MaterialConfigsMother.gitMaterialConfig("url");
    P4MaterialConfig firstOrderP4Material = MaterialConfigsMother.p4MaterialConfig();
    firstOrderP4Material.setFilter(new Filter(new IgnoredFiles("foo")));
    PipelineConfig current = GoConfigMother.createPipelineConfigWithMaterialConfig("current", MaterialConfigsMother.hgMaterialConfig(), new DependencyMaterialConfig(new CaseInsensitiveString("up1"), new CaseInsensitiveString("first")), new DependencyMaterialConfig(new CaseInsensitiveString("up2"), new CaseInsensitiveString("first")));
    PipelineConfig up1 = GoConfigMother.createPipelineConfigWithMaterialConfig("up1", filteredHgMaterialConfig("phigar"), firstOrderGitMaterial, new DependencyMaterialConfig(new CaseInsensitiveString("uppest"), new CaseInsensitiveString("first")));
    PipelineConfig up2 = GoConfigMother.createPipelineConfigWithMaterialConfig("up2", firstOrderSVNMaterial, firstOrderP4Material, filteredHgMaterialConfig("phigar"), new DependencyMaterialConfig(new CaseInsensitiveString("uppest"), new CaseInsensitiveString("first")));
    PipelineConfig uppest = GoConfigMother.createPipelineConfigWithMaterialConfig("uppest", filteredHgMaterialConfig("phigar"), firstOrderP4Material);
    PipelineConfigDependencyGraph uppestGraph = new PipelineConfigDependencyGraph(uppest);
    PipelineConfigDependencyGraph up1Graph = new PipelineConfigDependencyGraph(up1, uppestGraph);
    PipelineConfigDependencyGraph up2Graph = new PipelineConfigDependencyGraph(up2, uppestGraph);
    PipelineConfigDependencyGraph dependencyGraph = new PipelineConfigDependencyGraph(current, up1Graph, up2Graph);
    Modification modification = new Modification("user", "comment", "i@u.com", new Date(), "foo");
    modification.createModifiedFile("phigar", "", ModifiedAction.added);
    boolean ignored = dependencyGraph.isRevisionsOfSharedMaterialsIgnored(ModificationsMother.createHgMaterialWithMultipleRevisions(1, modification));
    assertThat(ignored, is(true));
    ignored = dependencyGraph.isRevisionsOfSharedMaterialsIgnored(ModificationsMother.createHgMaterialWithMultipleRevisions(1, ModificationsMother.oneModifiedFile("Silly")));
    assertThat(ignored, is(false));
    MaterialRevisions materialRevisions = ModificationsMother.createSvnMaterialRevisions(modification);
    materialRevisions.addAll(ModificationsMother.createP4MaterialRevisions(modification));
    materialRevisions.addAll(ModificationsMother.createHgMaterialWithMultipleRevisions(1, modification));
    ignored = up2Graph.isRevisionsOfSharedMaterialsIgnored(materialRevisions);
    assertThat(ignored, is(true));
    ignored = up2Graph.isRevisionsOfSharedMaterialsIgnored(ModificationsMother.createHgMaterialWithMultipleRevisions(1, ModificationsMother.oneModifiedFile("Silly")));
    assertThat(ignored, is(false));
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) PipelineConfig(com.thoughtworks.go.config.PipelineConfig) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Date(java.util.Date) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) P4MaterialConfig(com.thoughtworks.go.config.materials.perforce.P4MaterialConfig) Filter(com.thoughtworks.go.config.materials.Filter) IgnoredFiles(com.thoughtworks.go.config.materials.IgnoredFiles) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) Test(org.junit.Test)

Example 54 with SvnMaterialConfig

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

the class PipelineConfigDependencyGraphTest method shouldReturnTheListOfFirstOrderMaterialsIgnoringDestFoldersForScmMaterials.

@Test
public void shouldReturnTheListOfFirstOrderMaterialsIgnoringDestFoldersForScmMaterials() throws Exception {
    HgMaterialConfig common1 = MaterialConfigsMother.hgMaterialConfig("hg-url", "one-folder");
    HgMaterialConfig common2 = MaterialConfigsMother.hgMaterialConfig("hg-url", "another-folder");
    SvnMaterialConfig firstOrderSVNMaterial = MaterialConfigsMother.svnMaterialConfig();
    GitMaterialConfig firstOrderGitMaterial = MaterialConfigsMother.gitMaterialConfig("url", "submodule", "branch", false);
    P4MaterialConfig firstOrderP4Material = MaterialConfigsMother.p4MaterialConfig();
    DependencyMaterialConfig up1DependencyMaterial = new DependencyMaterialConfig(new CaseInsensitiveString("up1"), new CaseInsensitiveString("first"));
    DependencyMaterialConfig up2DependencyMaterial = new DependencyMaterialConfig(new CaseInsensitiveString("up2"), new CaseInsensitiveString("first"));
    DependencyMaterialConfig uppestDependencyMaterial = new DependencyMaterialConfig(new CaseInsensitiveString("uppest"), new CaseInsensitiveString("first"));
    PipelineConfig current = GoConfigMother.createPipelineConfigWithMaterialConfig("current", common1, up1DependencyMaterial, up2DependencyMaterial);
    PipelineConfig up1 = GoConfigMother.createPipelineConfigWithMaterialConfig("up1", common2, firstOrderGitMaterial, uppestDependencyMaterial);
    PipelineConfig up2 = GoConfigMother.createPipelineConfigWithMaterialConfig("up2", firstOrderSVNMaterial, common2, uppestDependencyMaterial);
    PipelineConfig uppest = GoConfigMother.createPipelineConfigWithMaterialConfig("uppest", common1, firstOrderP4Material);
    PipelineConfigDependencyGraph uppestGraph = new PipelineConfigDependencyGraph(uppest);
    PipelineConfigDependencyGraph up1Graph = new PipelineConfigDependencyGraph(up1, uppestGraph);
    PipelineConfigDependencyGraph up2Graph = new PipelineConfigDependencyGraph(up2, uppestGraph);
    PipelineConfigDependencyGraph dependencyGraph = new PipelineConfigDependencyGraph(current, up1Graph, up2Graph);
    assertThat(dependencyGraph.unsharedMaterialConfigs().size(), is(2));
    assertThat(dependencyGraph.unsharedMaterialConfigs().get(0), is(up1DependencyMaterial));
    assertThat(dependencyGraph.unsharedMaterialConfigs().get(1), is(up2DependencyMaterial));
    assertThat(up1Graph.unsharedMaterialConfigs().size(), is(2));
    assertThat(up1Graph.unsharedMaterialConfigs().get(0), is(firstOrderGitMaterial));
    assertThat(up1Graph.unsharedMaterialConfigs().get(1), is(uppestDependencyMaterial));
    assertThat(up2Graph.unsharedMaterialConfigs().size(), is(2));
    assertThat(up2Graph.unsharedMaterialConfigs().get(0), is(firstOrderSVNMaterial));
    assertThat(up2Graph.unsharedMaterialConfigs().get(1), is(uppestDependencyMaterial));
    assertThat(uppestGraph.unsharedMaterialConfigs().size(), is(2));
    assertThat(uppestGraph.unsharedMaterialConfigs().get(0), is(common1));
    assertThat(uppestGraph.unsharedMaterialConfigs().get(1), is(firstOrderP4Material));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) P4MaterialConfig(com.thoughtworks.go.config.materials.perforce.P4MaterialConfig) HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig) MaterialConfigsMother.filteredHgMaterialConfig(com.thoughtworks.go.helper.MaterialConfigsMother.filteredHgMaterialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Example 55 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 = new HgMaterialConfig("url", null);
    HgMaterial hgMaterial = new HgMaterial("url", null);
    SvnMaterial svnMaterial = new SvnMaterial("url", null, null, false);
    SvnMaterialConfig svnMaterialConfig = new SvnMaterialConfig("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.Test)

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