Search in sources :

Example 26 with MaterialConfigs

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());
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) Test(org.junit.Test)

Example 27 with MaterialConfigs

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);
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) Test(org.junit.Test)

Example 28 with MaterialConfigs

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));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) Test(org.junit.Test)

Example 29 with MaterialConfigs

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"));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) TimeProvider(com.thoughtworks.go.util.TimeProvider) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) Test(org.junit.Test)

Example 30 with MaterialConfigs

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);
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) Test(org.junit.Test)

Aggregations

MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)208 Test (org.junit.Test)160 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)40 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)35 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)33 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)30 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)26 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)24 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)23 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)22 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)20 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)18 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)18 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)15 ValueStreamMapPresentationModel (com.thoughtworks.go.server.presentation.models.ValueStreamMapPresentationModel)15 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)14 Material (com.thoughtworks.go.domain.materials.Material)13 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)12 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)12 ArrayList (java.util.ArrayList)12