Search in sources :

Example 36 with MaterialRevisions

use of com.thoughtworks.go.domain.MaterialRevisions in project gocd by gocd.

the class PipelineInstanceModelTest method shouldUnderstandPipelineStatusMessage.

@Test
public void shouldUnderstandPipelineStatusMessage() throws Exception {
    MaterialRevisions revisions = ModificationsMother.modifyOneFile(MaterialsMother.hgMaterials("url"), "revision");
    StageInstanceModels stages = new StageInstanceModels();
    stages.addStage("unit1", JobHistory.withJob("test", JobState.Completed, JobResult.Passed, new Date()));
    stages.addFutureStage("unit2", false);
    PipelineInstanceModel model = PipelineInstanceModel.createPipeline("pipeline", -1, "label", BuildCause.createWithModifications(revisions, ""), stages);
    assertThat(model.getPipelineStatusMessage(), is("Passed: unit1"));
}
Also used : MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) Date(java.util.Date) Test(org.junit.Test)

Example 37 with MaterialRevisions

use of com.thoughtworks.go.domain.MaterialRevisions in project gocd by gocd.

the class PipelineInstanceModelTest method hgMaterialWithNoModifications.

private PipelineInstanceModel hgMaterialWithNoModifications() {
    MaterialRevisions revisions = new MaterialRevisions();
    revisions.addRevision(MaterialsMother.hgMaterial(), new ArrayList<>());
    PipelineInstanceModel model = PipelineInstanceModel.createPipeline("pipeline", -1, "label", null, new StageInstanceModels());
    model.setLatestRevisions(revisions);
    return model;
}
Also used : MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions)

Example 38 with MaterialRevisions

use of com.thoughtworks.go.domain.MaterialRevisions in project gocd by gocd.

the class PipelineInstanceModelTest method shouldGetCurrentMaterialRevisionForMaterial.

@Test
public void shouldGetCurrentMaterialRevisionForMaterial() {
    MaterialRevisions revisions = new MaterialRevisions();
    HgMaterial material = MaterialsMother.hgMaterial();
    revisions.addRevision(material, HG_MATERIAL_MODIFICATION);
    PipelineInstanceModel model = PipelineInstanceModel.createPipeline("pipeline", -1, "label", BuildCause.createWithModifications(revisions, ""), new StageInstanceModels());
    assertThat(model.findCurrentMaterialRevisionForUI(material.config()), is(revisions.getMaterialRevision(0)));
}
Also used : MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) Test(org.junit.Test)

Example 39 with MaterialRevisions

use of com.thoughtworks.go.domain.MaterialRevisions in project gocd by gocd.

the class PipelineInstanceModelTest method shouldGetCurrentRevisionForMaterialByName.

@Test
public void shouldGetCurrentRevisionForMaterialByName() {
    MaterialRevisions revisions = new MaterialRevisions();
    HgMaterial material = MaterialsMother.hgMaterial();
    SvnMaterial svnMaterial = MaterialsMother.svnMaterial();
    material.setName(new CaseInsensitiveString("hg_material"));
    revisions.addRevision(svnMaterial, new Modification(new Date(), "1024", "MOCK_LABEL-12", null));
    revisions.addRevision(material, HG_MATERIAL_MODIFICATION);
    BuildCause buildCause = BuildCause.createWithModifications(revisions, "");
    PipelineInstanceModel model = PipelineInstanceModel.createPipeline("pipeline", -1, "label", buildCause, new StageInstanceModels());
    assertThat(model.getCurrentRevision("hg_material").getRevision(), is("a087402bd2a7828a130c1bdf43f2d9ef8f48fd46"));
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Date(java.util.Date) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) Test(org.junit.Test)

Example 40 with MaterialRevisions

use of com.thoughtworks.go.domain.MaterialRevisions in project gocd by gocd.

the class PipelineInstanceModelTest method setUpModificationForHgMaterial.

private PipelineInstanceModel setUpModificationForHgMaterial() {
    MaterialRevisions revisions = new MaterialRevisions();
    revisions.addRevision(MaterialsMother.hgMaterial(), HG_MATERIAL_MODIFICATION);
    PipelineInstanceModel model = PipelineInstanceModel.createPipeline("pipeline", -1, "label", null, new StageInstanceModels());
    model.setLatestRevisions(revisions);
    return model;
}
Also used : MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions)

Aggregations

MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)212 Test (org.junit.Test)166 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)111 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)68 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)55 Date (java.util.Date)49 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)46 Modification (com.thoughtworks.go.domain.materials.Modification)38 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)33 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)33 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)31 PipelineConfigDependencyGraph (com.thoughtworks.go.server.domain.PipelineConfigDependencyGraph)31 Materials (com.thoughtworks.go.config.materials.Materials)27 Pipeline (com.thoughtworks.go.domain.Pipeline)20 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)19 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)17 Material (com.thoughtworks.go.domain.materials.Material)16 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)15 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)14 File (java.io.File)12