use of com.thoughtworks.go.config.materials.MaterialConfigs 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.getAllLogs().get(0)).getPipelineNames(config).isEmpty());
}
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.getAllLogs().get(0)).getPipelineNames(config);
assertEquals(Sets.newHashSet("pipeline2"), pipelines);
}
use of com.thoughtworks.go.config.materials.MaterialConfigs in project gocd by gocd.
the class InstanceFactoryTest method shouldCreateAStageInstanceThroughInstanceFactory.
@Test
public void shouldCreateAStageInstanceThroughInstanceFactory() {
PipelineConfig pipelineConfig = new PipelineConfig(new CaseInsensitiveString("cruise"), new MaterialConfigs(), new StageConfig(new CaseInsensitiveString("first"), new JobConfigs(new JobConfig("job1"), new JobConfig("job2"))));
Stage actualStage = instanceFactory.createStageInstance(pipelineConfig, new CaseInsensitiveString("first"), new DefaultSchedulingContext(), "md5", clock);
JobInstances jobInstances = new JobInstances();
jobInstances.add(new JobInstance("job1", clock));
jobInstances.add(new JobInstance("job2", clock));
Stage expectedStage = new Stage("first", jobInstances, "Unknown", Approval.SUCCESS, clock);
assertThat(actualStage, is(expectedStage));
}
use of com.thoughtworks.go.config.materials.MaterialConfigs in project gocd by gocd.
the class InstanceFactoryTest method shouldSchedulePipelineWithFirstStage.
@Test
public void shouldSchedulePipelineWithFirstStage() {
StageConfig stageOneConfig = StageConfigMother.stageConfig("dev", BuildPlanMother.withBuildPlans("functional", "unit"));
StageConfig stageTwoConfig = StageConfigMother.stageConfig("qa", BuildPlanMother.withBuildPlans("suiteOne", "suiteTwo"));
MaterialConfigs materialConfigs = MaterialConfigsMother.defaultMaterialConfigs();
PipelineConfig pipelineConfig = new PipelineConfig(new CaseInsensitiveString("mingle"), materialConfigs, stageOneConfig, stageTwoConfig);
BuildCause buildCause = BuildCause.createManualForced(modifyOneFile(pipelineConfig), Username.ANONYMOUS);
Pipeline pipeline = instanceFactory.createPipelineInstance(pipelineConfig, buildCause, new DefaultSchedulingContext("test"), "some-md5", new TimeProvider());
assertThat(pipeline.getName(), is("mingle"));
assertThat(pipeline.getStages().size(), is(1));
assertThat(pipeline.getStages().get(0).getName(), is("dev"));
assertThat(pipeline.getStages().get(0).getJobInstances().get(0).getName(), is("functional"));
}
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.getAllLogs().get(0)).getPipelineNames(config);
assertEquals(Sets.newHashSet("pipeline", "pipeline2"), pipelines);
}
Aggregations