use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class GoConfigMother method addPipelineWithGroupAndTimer.
public PipelineConfig addPipelineWithGroupAndTimer(CruiseConfig cruiseConfig, String groupName, String pipelineName, MaterialConfigs materialConfigs, String stageName, TimerConfig timer, String... buildNames) {
String cronSpec = timer == null ? null : timer.getTimerSpec();
boolean shouldTriggerOnlyOnMaterialChanges = timer != null && timer.shouldTriggerOnlyOnChanges();
StageConfig stageConfig = StageConfigMother.custom(stageName, defaultBuildPlans(buildNames));
PipelineConfig pipelineConfig = new PipelineConfig(new CaseInsensitiveString(pipelineName), PipelineLabel.COUNT_TEMPLATE, cronSpec, shouldTriggerOnlyOnMaterialChanges, materialConfigs, asList(stageConfig));
pipelineConfig.setOrigin(new FileConfigOrigin());
cruiseConfig.addPipeline(groupName, pipelineConfig);
return pipelineConfig;
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MagicalGoConfigXmlLoaderTest method shouldSetConfigOriginInPipeline_AfterLoadingConfigFile.
@Test
public void shouldSetConfigOriginInPipeline_AfterLoadingConfigFile() throws Exception {
CruiseConfig cruiseConfig = xmlLoader.loadConfigHolder(CONFIG).config;
PipelineConfig pipelineConfig1 = cruiseConfig.pipelineConfigByName(new CaseInsensitiveString("pipeline1"));
assertThat(pipelineConfig1.getOrigin(), Is.<ConfigOrigin>is(new FileConfigOrigin()));
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MaterialConfigsTest method shouldNotAllowToDependOnPipelineDefinedInConfigRepository_WhenDownstreamInFile.
@Test
public void shouldNotAllowToDependOnPipelineDefinedInConfigRepository_WhenDownstreamInFile() throws Exception {
CruiseConfig cruiseConfig = new BasicCruiseConfig();
PipelineConfig pipeline1 = goConfigMother.addPipeline(cruiseConfig, "pipeline1", "stage", "build");
PipelineConfig pipeline2 = goConfigMother.addPipeline(cruiseConfig, "pipeline2", "stage", "build");
goConfigMother.setDependencyOn(cruiseConfig, pipeline2, "pipeline1", "stage");
pipeline1.setOrigin(new RepoConfigOrigin());
pipeline2.setOrigin(new FileConfigOrigin());
pipeline1.materialConfigs().validate(ConfigSaveValidationContext.forChain(cruiseConfig, new BasicPipelineConfigs(), pipeline1));
assertThat(pipeline1.materialConfigs().errors().isEmpty(), is(true));
pipeline2.materialConfigs().validate(ConfigSaveValidationContext.forChain(cruiseConfig, new BasicPipelineConfigs(), pipeline2));
DependencyMaterialConfig invalidDependency = pipeline2.materialConfigs().findDependencyMaterial(new CaseInsensitiveString("pipeline1"));
assertThat(invalidDependency.errors().isEmpty(), is(false));
assertThat(invalidDependency.errors().on(DependencyMaterialConfig.ORIGIN), startsWith("Dependency from pipeline defined in"));
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MagicalGoConfigXmlLoader method deserializeConfig.
public CruiseConfig deserializeConfig(String content) throws Exception {
String md5 = CachedDigestUtils.md5Hex(content);
Element element = parseInputStream(new ByteArrayInputStream(content.getBytes()));
LOGGER.debug("[Config Save] Updating config cache with new XML");
CruiseConfig configForEdit = classParser(element, BasicCruiseConfig.class, configCache, new GoCipher(), registry, new ConfigReferenceElements()).parse();
setMd5(configForEdit, md5);
configForEdit.setOrigins(new FileConfigOrigin());
return configForEdit;
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class PipelineConfigsTestBase method shouldNotErrorWhenAuthorizationIsDefinedLocally.
@Test
public void shouldNotErrorWhenAuthorizationIsDefinedLocally() {
BasicPipelineConfigs group = new BasicPipelineConfigs(new FileConfigOrigin());
group.setGroup("gr");
group.setConfigAttributes(m(BasicPipelineConfigs.AUTHORIZATION, a(m(Authorization.NAME, "loser", Authorization.TYPE, USER.toString(), Authorization.PRIVILEGES, privileges(ON, DISABLED, DISABLED)), m(Authorization.NAME, "boozer", Authorization.TYPE, USER.toString(), Authorization.PRIVILEGES, privileges(OFF, ON, ON)), m(Authorization.NAME, "geezer", Authorization.TYPE, USER.toString(), Authorization.PRIVILEGES, privileges(DISABLED, OFF, ON)), m(Authorization.NAME, "gang_of_losers", Authorization.TYPE, ROLE.toString(), Authorization.PRIVILEGES, privileges(DISABLED, OFF, ON)), m(Authorization.NAME, "blinds", Authorization.TYPE, ROLE.toString(), Authorization.PRIVILEGES, privileges(ON, ON, OFF)))));
group.validate(null);
assertThat(group.errors().isEmpty(), is(true));
}
Aggregations