Search in sources :

Example 11 with PipelineTemplateConfig

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

the class PipelineTemplateConfigViewModelTest method shouldSetConfigAttributesWithNoExistingPipeline.

@Test
public void shouldSetConfigAttributesWithNoExistingPipeline() {
    PipelineTemplateConfigViewModel viewModel = new PipelineTemplateConfigViewModel();
    Map m = m("template", m(PipelineTemplateConfig.NAME, "template_name"), PipelineTemplateConfigViewModel.USE_EXISTING_PIPELINE, "0", PipelineTemplateConfigViewModel.PIPELINE_NAMES, "quux");
    viewModel.setConfigAttributes(m);
    PipelineTemplateConfig template = viewModel.templateConfig();
    assertThat(template.name(), is(new CaseInsensitiveString("template_name")));
    assertThat(template.size(), is(1));
    assertThat(template.get(0).name().toString(), is(StageConfig.DEFAULT_NAME));
    JobConfigs jobs = template.get(0).getJobs();
    assertThat(jobs.size(), is(1));
    assertThat(jobs.get(0).name().toString(), is(JobConfig.DEFAULT_NAME));
}
Also used : PipelineTemplateConfig(com.thoughtworks.go.config.PipelineTemplateConfig) JobConfigs(com.thoughtworks.go.config.JobConfigs) Map(java.util.Map) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Aggregations

PipelineTemplateConfig (com.thoughtworks.go.config.PipelineTemplateConfig)11 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)9 Test (org.junit.Test)9 JobConfigs (com.thoughtworks.go.config.JobConfigs)2 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)2 Map (java.util.Map)2 Before (org.junit.Before)2 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)1 JobConfig (com.thoughtworks.go.config.JobConfig)1 StageConfig (com.thoughtworks.go.config.StageConfig)1 TemplatesConfig (com.thoughtworks.go.config.TemplatesConfig)1 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)1 GoConfigMother (com.thoughtworks.go.helper.GoConfigMother)1 Username (com.thoughtworks.go.server.domain.Username)1 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)1 ArrayList (java.util.ArrayList)1