Search in sources :

Example 41 with Material

use of com.thoughtworks.go.domain.materials.Material in project gocd by gocd.

the class TfsMaterialInstanceTest method shouldSetNameAsNullIfNoNameSpecified.

@Test
public void shouldSetNameAsNullIfNoNameSpecified() {
    TfsMaterialInstance instance1 = new TfsMaterialInstance("http://foo.com", "username", "CORPORATE", "some_project_path", "blah");
    Material material = instance1.toOldMaterial(null, "some_folder", "password");
    assertThat(material.getName(), is(nullValue()));
}
Also used : Material(com.thoughtworks.go.domain.materials.Material) Test(org.junit.jupiter.api.Test)

Example 42 with Material

use of com.thoughtworks.go.domain.materials.Material in project gocd by gocd.

the class PipelineMaterialRevisionTest method shouldNotSetFROMRevisionSameAsTORevisionWhenSCMMaterial.

@Test
public void shouldNotSetFROMRevisionSameAsTORevisionWhenSCMMaterial() {
    Material material = new HgMaterial("http://some_server/repo", null);
    Modification latestModification = modification(new Date(), "123", null, null);
    Modification earlierModification = modification(new Date(), "23", null, null);
    MaterialRevision revision = new MaterialRevision(material, latestModification, earlierModification);
    PipelineMaterialRevision pmr = new PipelineMaterialRevision(9, revision, null);
    assertThat(pmr.getToModification(), is(latestModification));
    assertThat(pmr.getFromModification(), is(earlierModification));
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) Material(com.thoughtworks.go.domain.materials.Material) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) Date(java.util.Date) Test(org.junit.jupiter.api.Test)

Example 43 with Material

use of com.thoughtworks.go.domain.materials.Material in project gocd by gocd.

the class DependencyMaterialTest method shouldUseACombinationOfPipelineAndStageNameAsURI.

@Test
void shouldUseACombinationOfPipelineAndStageNameAsURI() {
    Material material = new DependencyMaterial(new CaseInsensitiveString("pipeline-foo"), new CaseInsensitiveString("stage-bar"));
    assertThat(material.getUriForDisplay()).isEqualTo("pipeline-foo / stage-bar");
}
Also used : Material(com.thoughtworks.go.domain.materials.Material) Test(org.junit.jupiter.api.Test)

Example 44 with Material

use of com.thoughtworks.go.domain.materials.Material in project gocd by gocd.

the class DependencyMaterialTest method shouldNotTruncateshortRevision.

@Test
void shouldNotTruncateshortRevision() throws Exception {
    Material material = new DependencyMaterial(new CaseInsensitiveString("upstream"), new CaseInsensitiveString("first"));
    assertThat(material.getShortRevision("pipeline-name/1/stage-name/5")).isEqualTo("pipeline-name/1/stage-name/5");
}
Also used : Material(com.thoughtworks.go.domain.materials.Material) Test(org.junit.jupiter.api.Test)

Example 45 with Material

use of com.thoughtworks.go.domain.materials.Material in project gocd by gocd.

the class MaterialDatabaseUpdater method initializeMaterialWithLatestRevision.

private void initializeMaterialWithLatestRevision(Material material) {
    Materials materials = new Materials();
    materialExpansionService.expandForHistory(material, materials);
    for (Material expanded : materials) {
        addNewMaterialWithModifications(folderFor(expanded), expanded, updater(expanded));
    }
}
Also used : Materials(com.thoughtworks.go.config.materials.Materials) PackageMaterial(com.thoughtworks.go.config.materials.PackageMaterial) Material(com.thoughtworks.go.domain.materials.Material) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) PluggableSCMMaterial(com.thoughtworks.go.config.materials.PluggableSCMMaterial)

Aggregations

Material (com.thoughtworks.go.domain.materials.Material)122 Test (org.junit.jupiter.api.Test)72 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)49 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)47 Modification (com.thoughtworks.go.domain.materials.Modification)29 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)28 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)24 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)19 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)19 PluggableSCMMaterial (com.thoughtworks.go.config.materials.PluggableSCMMaterial)19 ScmMaterial (com.thoughtworks.go.config.materials.ScmMaterial)18 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)18 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)16 Materials (com.thoughtworks.go.config.materials.Materials)14 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)13 File (java.io.File)13 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)12 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)12 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)12 P4Material (com.thoughtworks.go.config.materials.perforce.P4Material)8