Search in sources :

Example 1 with PipelineConfig

use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.

the class ResourcesTest method shouldValidateTree.

@Test
public void shouldValidateTree() {
    Resource resource1 = new Resource("a#");
    Resource resource2 = new Resource("b");
    Resources resources = new Resources(resource1, resource2);
    resources.validateTree(PipelineConfigSaveValidationContext.forChain(true, "group", new PipelineConfig()));
    assertThat(resource1.errors().size(), is(1));
    assertThat(resource1.errors().firstError(), is(String.format("Resource name 'a#' is not valid. Valid names much match '%s'", Resource.VALID_REGEX)));
    assertThat(resource2.errors().isEmpty(), is(true));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) Resource(com.thoughtworks.go.config.Resource) Resources(com.thoughtworks.go.config.Resources) Test(org.junit.Test)

Example 2 with PipelineConfig

use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.

the class BuildCauseProducerService method autoSchedulePipeline.

public void autoSchedulePipeline(String pipelineName, ServerHealthStateOperationResult result, long trackingId) {
    schedulingPerformanceLogger.autoSchedulePipelineStart(trackingId, pipelineName);
    try {
        PipelineConfig pipelineConfig = goConfigService.pipelineConfigNamed(new CaseInsensitiveString(pipelineName));
        newProduceBuildCause(pipelineConfig, new AutoBuild(goConfigService, pipelineService, pipelineName, systemEnvironment, materialChecker, serverHealthService), result, trackingId);
    } finally {
        schedulingPerformanceLogger.autoSchedulePipelineFinish(trackingId, pipelineName);
    }
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Example 3 with PipelineConfig

use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.

the class PipelineScheduleServiceTest method shouldNotScheduleAnyNewPipelineWhenErrorHappens.

@Test
public void shouldNotScheduleAnyNewPipelineWhenErrorHappens() throws Exception {
    String stageName = "invalidStageName";
    PipelineConfig invalidPipeline = configHelper.addPipelineWithInvalidMaterial("invalidPipeline", stageName);
    int beforeScheduling = pipelineDao.count(CaseInsensitiveString.str(invalidPipeline.name()));
    autoSchedulePipelines();
    int afterScheduling = pipelineDao.count(CaseInsensitiveString.str(invalidPipeline.name()));
    assertThat(beforeScheduling, is(afterScheduling));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Example 4 with PipelineConfig

use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.

the class GoDashboardServiceTest method shouldUpdateCacheForPipelineGivenItsConfig.

@Test
public void shouldUpdateCacheForPipelineGivenItsConfig() throws Exception {
    PipelineConfig pipelineConfig = configMother.addPipelineWithGroup(config, "group1", "pipeline1", "stage1", "job1");
    PipelineConfigs groupConfig = config.findGroup("group1");
    GoDashboardPipeline pipeline = pipeline("pipeline1");
    when(goConfigService.findGroupByPipeline(new CaseInsensitiveString("pipeline1"))).thenReturn(groupConfig);
    when(dashboardCurrentStateLoader.pipelineFor(pipelineConfig, groupConfig)).thenReturn(pipeline);
    service.updateCacheForPipeline(pipelineConfig);
    verify(cache).put(pipeline);
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) PipelineConfigs(com.thoughtworks.go.config.PipelineConfigs) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Example 5 with PipelineConfig

use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.

the class BuildAssignmentServiceTest method shouldNotMatchAnElasticJobToAnElasticAgentOnlyIfThePluginIdMatches.

@Test
public void shouldNotMatchAnElasticJobToAnElasticAgentOnlyIfThePluginIdMatches() {
    PipelineConfig pipelineWithElasticJob = PipelineConfigMother.pipelineWithElasticJob(elasticProfileId1);
    JobPlan jobPlan1 = new InstanceFactory().createJobPlan(pipelineWithElasticJob.first().getJobs().first(), schedulingContext);
    jobPlans.add(jobPlan1);
    when(elasticAgentPluginService.shouldAssignWork(elasticAgentInstance.elasticAgentMetadata(), "", jobPlan1.getElasticProfile(), null)).thenReturn(false);
    buildAssignmentService.onTimer();
    JobPlan matchingJob = buildAssignmentService.findMatchingJob(elasticAgentInstance);
    assertThat(matchingJob, is(nullValue()));
    assertThat(buildAssignmentService.jobPlans().size(), is(1));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) Test(org.junit.Test)

Aggregations

PipelineConfig (com.thoughtworks.go.config.PipelineConfig)285 Test (org.junit.jupiter.api.Test)185 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)142 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)52 TimeProvider (com.thoughtworks.go.util.TimeProvider)33 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)24 Test (org.junit.Test)23 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)21 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)19 PipelineConfigs (com.thoughtworks.go.config.PipelineConfigs)17 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)16 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)15 Materials (com.thoughtworks.go.config.materials.Materials)14 Date (java.util.Date)14 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)13 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)13 StageConfig (com.thoughtworks.go.config.StageConfig)12 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)12 Pipeline (com.thoughtworks.go.domain.Pipeline)12 Modification (com.thoughtworks.go.domain.materials.Modification)12