use of com.thoughtworks.go.config.materials.MaterialConfigs in project gocd by gocd.
the class PipelineDependencyGraphOldTest method shouldShouldbeAbleToTellIfUpStreamMaterialIsAvailableForTrigger.
@Test
public void shouldShouldbeAbleToTellIfUpStreamMaterialIsAvailableForTrigger() throws Exception {
StageInstanceModels stages = new StageInstanceModels();
stages.add(new StageInstanceModel("stage-0", "21", StageResult.Cancelled, new StageIdentifier("blahUpStream", 23, "stage-0", "21")));
PipelineInstanceModel upStream = PipelineHistoryMother.singlePipeline("blahUpStream", stages);
PipelineInstanceModel down1 = pim("blahDown1");
down1.setMaterialConfigs(new MaterialConfigs(dependencyMaterialConfig("blahUpStream", "stage-1")));
PipelineDependencyGraphOld graph = new PipelineDependencyGraphOld(upStream, PipelineInstanceModels.createPipelineInstanceModels(down1));
assertThat(graph.hasUpStreamRevisionFor(down1), is(false));
}
use of com.thoughtworks.go.config.materials.MaterialConfigs in project gocd by gocd.
the class PipelineDependencyGraphOldTest method assertThatTriggerIsPossibleOnlyIfUpStreamPassed.
private void assertThatTriggerIsPossibleOnlyIfUpStreamPassed(StageResult upstreamResult) {
StageInstanceModels stages = new StageInstanceModels();
stages.add(new StageInstanceModel("stage-0", "21", upstreamResult, new StageIdentifier("blahUpStream", 23, "stage-0", "21")));
PipelineInstanceModel upStream = PipelineHistoryMother.singlePipeline("blahUpStream", stages);
PipelineInstanceModel down1 = pim("blahDown1");
down1.setMaterialConfigs(new MaterialConfigs(dependencyMaterialConfig("blahUpStream", "stage-0")));
PipelineDependencyGraphOld graph = new PipelineDependencyGraphOld(upStream, PipelineInstanceModels.createPipelineInstanceModels(down1));
assertThat(graph.hasUpStreamRevisionFor(graph.dependencies().find("blahDown1")), is(upstreamResult == StageResult.Passed));
}
use of com.thoughtworks.go.config.materials.MaterialConfigs in project gocd by gocd.
the class ServerHealthServiceTest method shouldRemoveErrorLogWhenCorrespondingMaterialIsMissing.
@Test
public void shouldRemoveErrorLogWhenCorrespondingMaterialIsMissing() throws Exception {
serverHealthService.update(ServerHealthState.error("hg-message", "description", HealthStateType.general(forMaterial(MaterialsMother.hgMaterial()))));
SvnMaterialConfig svnMaterialConfig = MaterialConfigsMother.svnMaterialConfig();
serverHealthService.update(ServerHealthState.error("svn-message", "description", HealthStateType.general(forMaterialConfig(svnMaterialConfig))));
CruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.addPipeline("defaultGroup", new PipelineConfig(new CaseInsensitiveString("dev"), new MaterialConfigs(svnMaterialConfig), new StageConfig(new CaseInsensitiveString("first"), new JobConfigs())));
serverHealthService.purgeStaleHealthMessages(cruiseConfig);
assertThat(serverHealthService.logs().size(), is(1));
}
use of com.thoughtworks.go.config.materials.MaterialConfigs 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.MaterialConfigs 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);
}
Aggregations