Search in sources :

Example 11 with HgMaterial

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

the class MaterialsTest method shouldReturnMaterialBasedOnPiplineUniqueFingerPrint.

@Test
public void shouldReturnMaterialBasedOnPiplineUniqueFingerPrint() {
    Materials materials = new Materials();
    HgMaterial expectedMaterial = MaterialsMother.hgMaterial();
    materials.add(expectedMaterial);
    materials.add(MaterialsMother.gitMaterial("url"));
    materials.add(MaterialsMother.svnMaterial("url", "folder"));
    Material actualMaterial = materials.getByFingerPrint(expectedMaterial.getPipelineUniqueFingerprint());
    assertThat(actualMaterial, is(expectedMaterial));
}
Also used : HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) P4Material(com.thoughtworks.go.config.materials.perforce.P4Material) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) GitMaterial(com.thoughtworks.go.config.materials.git.GitMaterial) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) Test(org.junit.Test)

Example 12 with HgMaterial

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

the class Materials method latestModification.

/**
 * @deprecated Used only in tests
 */
public MaterialRevisions latestModification(File baseDir, final SubprocessExecutionContext execCtx) {
    MaterialRevisions revisions = new MaterialRevisions();
    for (Material material : this) {
        List<Modification> modifications = new ArrayList<>();
        if (material instanceof SvnMaterial) {
            modifications = ((SvnMaterial) material).latestModification(baseDir, execCtx);
        }
        if (material instanceof HgMaterial) {
            modifications = ((HgMaterial) material).latestModification(baseDir, execCtx);
        }
        if (material instanceof GitMaterial) {
            modifications = ((GitMaterial) material).latestModification(baseDir, execCtx);
        }
        if (material instanceof P4Material) {
            modifications = ((P4Material) material).latestModification(baseDir, execCtx);
        }
        if (material instanceof TfsMaterial) {
            modifications = ((TfsMaterial) material).latestModification(baseDir, execCtx);
        }
        if (material instanceof DependencyMaterial) {
            modifications = ((DependencyMaterial) material).latestModification(baseDir, execCtx);
        }
        revisions.addRevision(material, modifications);
    }
    return revisions;
}
Also used : TfsMaterial(com.thoughtworks.go.config.materials.tfs.TfsMaterial) GitMaterial(com.thoughtworks.go.config.materials.git.GitMaterial) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) ArrayList(java.util.ArrayList) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) P4Material(com.thoughtworks.go.config.materials.perforce.P4Material) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) GitMaterial(com.thoughtworks.go.config.materials.git.GitMaterial) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) TfsMaterial(com.thoughtworks.go.config.materials.tfs.TfsMaterial) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) P4Material(com.thoughtworks.go.config.materials.perforce.P4Material)

Example 13 with HgMaterial

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

the class MaterialsTest method shouldNotGetDependencyMaterialWhenOneOtherScmMaterialWithNoFolder.

@Test
public void shouldNotGetDependencyMaterialWhenOneOtherScmMaterialWithNoFolder() {
    Materials materials = new Materials();
    Material material1 = new DependencyMaterial(new CaseInsensitiveString("foo"), new CaseInsensitiveString("bar"));
    Material material2 = new HgMaterial("", null);
    materials.add(material1);
    materials.add(material2);
    assertThat(materials.byFolder(null), is(material2));
}
Also used : HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) P4Material(com.thoughtworks.go.config.materials.perforce.P4Material) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) GitMaterial(com.thoughtworks.go.config.materials.git.GitMaterial) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Example 14 with HgMaterial

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

the class MaterialsTest method shouldGetMaterialByFolder.

@Test
public void shouldGetMaterialByFolder() {
    Materials materials = new Materials();
    HgMaterial material1 = MaterialsMother.hgMaterial();
    material1.setFolder("folder1");
    HgMaterial material2 = MaterialsMother.hgMaterial();
    material2.setFolder("folder2");
    materials.add(material1);
    materials.add(material2);
    assertThat(materials.byFolder("folder1"), is(material1));
}
Also used : HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) Test(org.junit.Test)

Example 15 with HgMaterial

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

the class MaterialsTest method shouldGetPluggableSCMMaterial_byFolder.

@Test
public void shouldGetPluggableSCMMaterial_byFolder() {
    Materials materials = new Materials();
    PluggableSCMMaterial material1 = new PluggableSCMMaterial("scm-id");
    material1.setFolder("folder");
    Material material2 = new HgMaterial("", "folder");
    materials.add(material1);
    materials.add(material2);
    assertThat(materials.byFolder("folder"), is(material1));
}
Also used : HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) P4Material(com.thoughtworks.go.config.materials.perforce.P4Material) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) GitMaterial(com.thoughtworks.go.config.materials.git.GitMaterial) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) Test(org.junit.Test)

Aggregations

HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)121 Test (org.junit.Test)107 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)34 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)29 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)23 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)23 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)20 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)18 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)16 Material (com.thoughtworks.go.domain.materials.Material)15 P4Material (com.thoughtworks.go.config.materials.perforce.P4Material)10 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)10 Date (java.util.Date)10 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)9 ScheduleTestUtil (com.thoughtworks.go.server.service.ScheduleTestUtil)9 TimeProvider (com.thoughtworks.go.util.TimeProvider)8 Pagination (com.thoughtworks.go.server.util.Pagination)7 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)6 Modification (com.thoughtworks.go.domain.materials.Modification)6 File (java.io.File)6