Search in sources :

Example 31 with HgMaterial

use of com.thoughtworks.go.config.materials.mercurial.HgMaterial 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 32 with HgMaterial

use of com.thoughtworks.go.config.materials.mercurial.HgMaterial 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 33 with HgMaterial

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

the class ServerHealthServiceTest method faninErrorStateRelatedPipelineNames.

@Test
public void faninErrorStateRelatedPipelineNames() {
    HgMaterial hgMaterial = MaterialsMother.hgMaterial();
    CruiseConfig config = new BasicCruiseConfig();
    config.addPipeline("group", PipelineConfigMother.pipelineConfig(PIPELINE_NAME, new MaterialConfigs(hgMaterial.config())));
    config.addPipeline("group", PipelineConfigMother.pipelineConfig("pipeline2", new MaterialConfigs(hgMaterial.config())));
    config.addPipeline("group", PipelineConfigMother.pipelineConfig("pipeline3"));
    serverHealthService.update(ServerHealthState.error("message", "description", HealthStateType.general(HealthStateScope.forFanin("pipeline2"))));
    Set<String> pipelines = (serverHealthService.logs().get(0)).getPipelineNames(config);
    assertEquals(Sets.newHashSet("pipeline2"), pipelines);
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) Test(org.junit.Test)

Example 34 with HgMaterial

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

the class ServerHealthServiceTest method materialStateRelatedPipelineNames.

@Test
public void materialStateRelatedPipelineNames() {
    HgMaterial hgMaterial = MaterialsMother.hgMaterial();
    CruiseConfig config = new BasicCruiseConfig();
    config.addPipeline("group", PipelineConfigMother.pipelineConfig(PIPELINE_NAME, new MaterialConfigs(hgMaterial.config())));
    config.addPipeline("group", PipelineConfigMother.pipelineConfig("pipeline2", new MaterialConfigs(hgMaterial.config())));
    config.addPipeline("group", PipelineConfigMother.pipelineConfig("pipeline3"));
    serverHealthService.update(ServerHealthState.error("message", "description", HealthStateType.general(forMaterial(hgMaterial))));
    Set<String> pipelines = (serverHealthService.logs().get(0)).getPipelineNames(config);
    assertEquals(Sets.newHashSet("pipeline", "pipeline2"), pipelines);
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) Test(org.junit.Test)

Example 35 with HgMaterial

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

the class ServerHealthServiceTest method globalStateRelatedPipelineNames.

@Test
public void globalStateRelatedPipelineNames() {
    HgMaterial hgMaterial = MaterialsMother.hgMaterial();
    CruiseConfig config = new BasicCruiseConfig();
    config.addPipeline("group", PipelineConfigMother.pipelineConfig(PIPELINE_NAME, new MaterialConfigs(hgMaterial.config())));
    config.addPipeline("group", PipelineConfigMother.pipelineConfig("pipeline2", new MaterialConfigs(hgMaterial.config())));
    config.addPipeline("group", PipelineConfigMother.pipelineConfig("pipeline3"));
    serverHealthService.update(ServerHealthState.error("message", "description", HealthStateType.invalidConfig()));
    assertTrue((serverHealthService.logs().get(0)).getPipelineNames(config).isEmpty());
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) 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