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)));
}
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"));
}
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);
}
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);
}
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());
}
Aggregations