Search in sources :

Example 41 with HgMaterialConfig

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

the class MaterialConfigsMother method filteredHgMaterialConfig.

public static HgMaterialConfig filteredHgMaterialConfig(String pattern) {
    HgMaterialConfig materialConfig = hgMaterialConfig();
    materialConfig.setFilter(new Filter(new IgnoredFiles(pattern)));
    return materialConfig;
}
Also used : HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)

Example 42 with HgMaterialConfig

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

the class MaterialExpansionServiceTest method shouldExpandMaterialForScheduling.

@Test
public void shouldExpandMaterialForScheduling() {
    HgMaterialConfig hg = MaterialConfigsMother.hgMaterialConfig();
    MaterialConfigs materialConfigs = new MaterialConfigs();
    materialExpansionService.expandForScheduling(hg, materialConfigs);
    assertThat(materialConfigs.size(), is(1));
    assertThat(materialConfigs.get(0), is(hg));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)

Example 43 with HgMaterialConfig

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

the class AutoBuildCauseTest method shouldReturnPeggedRevisionsForUpstreamMaterialWhenFirstOrderDependencyMaterialIsChanged.

@Test
public void shouldReturnPeggedRevisionsForUpstreamMaterialWhenFirstOrderDependencyMaterialIsChanged() throws Exception {
    HgMaterialConfig hg = MaterialConfigsMother.hgMaterialConfig();
    PipelineConfig third = PipelineConfigMother.pipelineConfig("third", MaterialConfigsMother.dependencyMaterialConfig("second", "mingle"), new JobConfigs());
    PipelineConfig second = PipelineConfigMother.pipelineConfig("second", MaterialConfigsMother.dependencyMaterialConfig("first", "mingle"), new JobConfigs());
    PipelineConfig first = PipelineConfigMother.pipelineConfig("first", hg, new JobConfigs());
    PipelineConfigDependencyGraph dependencyGraph = new PipelineConfigDependencyGraph(third, new PipelineConfigDependencyGraph(second, new PipelineConfigDependencyGraph(first)), new PipelineConfigDependencyGraph(first));
    MaterialRevisions revisions = new MaterialRevisions();
    MaterialRevision firstRev = dependencyMaterialRevision("first", 10, "label", "mingle", 1, new Date());
    firstRev.markAsNotChanged();
    MaterialRevision secondRev = dependencyMaterialRevision("second", 1, "label", "mingle", 1, new Date());
    secondRev.markAsChanged();
    revisions.addRevision(secondRev);
    revisions.addRevision(firstRev);
    when(goConfigService.upstreamDependencyGraphOf("third", cruiseConfig)).thenReturn(dependencyGraph);
    MaterialRevisions expectedRevisions = new MaterialRevisions();
    when(pipelineService.getRevisionsBasedOnDependencies(eq(revisions), eq(cruiseConfig), eq(dependencyGraph.getCurrent().name()))).thenReturn(expectedRevisions);
    assertThat(new AutoBuild(goConfigService, pipelineService, "third", new SystemEnvironment(), materialChecker).onModifications(revisions, false, null).getMaterialRevisions(), sameInstance(expectedRevisions));
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) PipelineConfigDependencyGraph(com.thoughtworks.go.server.domain.PipelineConfigDependencyGraph) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig) MaterialRevision(com.thoughtworks.go.domain.MaterialRevision) Date(java.util.Date) Test(org.junit.Test)

Example 44 with HgMaterialConfig

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

the class AutoBuildCauseTest method shouldReturnNullIfUpstreamMaterialHasChangedButNoFirstOrderMaterialHas_WithFaninOff.

@Test
public void shouldReturnNullIfUpstreamMaterialHasChangedButNoFirstOrderMaterialHas_WithFaninOff() throws Exception {
    HgMaterialConfig hg = MaterialConfigsMother.hgMaterialConfig();
    PipelineConfig third = PipelineConfigMother.pipelineConfig("third", MaterialConfigsMother.dependencyMaterialConfig("second", "mingle"), new JobConfigs());
    PipelineConfig second = PipelineConfigMother.pipelineConfig("second", MaterialConfigsMother.dependencyMaterialConfig("first", "mingle"), new JobConfigs());
    PipelineConfig first = PipelineConfigMother.pipelineConfig("first", hg, new JobConfigs());
    PipelineConfigDependencyGraph dependencyGraph = new PipelineConfigDependencyGraph(third, new PipelineConfigDependencyGraph(second, new PipelineConfigDependencyGraph(first)), new PipelineConfigDependencyGraph(first));
    MaterialRevisions revisions = new MaterialRevisions();
    MaterialRevision firstRev = dependencyMaterialRevision("first", 1, "label", "mingle", 1, new Date());
    firstRev.markAsChanged();
    MaterialRevision secondRev = dependencyMaterialRevision("second", 1, "label", "mingle", 1, new Date());
    secondRev.markAsNotChanged();
    revisions.addRevision(secondRev);
    revisions.addRevision(firstRev);
    when(goConfigService.upstreamDependencyGraphOf("third", cruiseConfig)).thenReturn(dependencyGraph);
    when(systemEnvironment.enforceRevisionCompatibilityWithUpstream()).thenReturn(false);
    AutoBuild build = new AutoBuild(goConfigService, pipelineService, "third", systemEnvironment, materialChecker);
    BuildCause cause = build.onModifications(revisions, false, null);
    assertThat(cause, is(nullValue()));
}
Also used : PipelineConfigDependencyGraph(com.thoughtworks.go.server.domain.PipelineConfigDependencyGraph) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig) MaterialRevision(com.thoughtworks.go.domain.MaterialRevision) Date(java.util.Date) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) Test(org.junit.Test)

Example 45 with HgMaterialConfig

use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig 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)

Aggregations

HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)73 Test (org.junit.Test)60 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)15 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)12 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)11 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)11 P4MaterialConfig (com.thoughtworks.go.config.materials.perforce.P4MaterialConfig)11 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)10 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)9 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)8 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)8 TfsMaterialConfig (com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig)8 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)7 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)6 PluggableSCMMaterialConfig (com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig)6 ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)5 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)5 Filter (com.thoughtworks.go.config.materials.Filter)4 RepoConfigOrigin (com.thoughtworks.go.config.remote.RepoConfigOrigin)4 HgUrlArgument (com.thoughtworks.go.util.command.HgUrlArgument)4