use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MergeEnvironmentConfigTest method shouldReturnTrueWhenOnlyPartIsLocal.
@Test
void shouldReturnTrueWhenOnlyPartIsLocal() {
BasicEnvironmentConfig uatLocalPart = new BasicEnvironmentConfig(new CaseInsensitiveString("UAT"));
uatLocalPart.setOrigins(new FileConfigOrigin());
environmentConfig = new MergeEnvironmentConfig(uatLocalPart);
assertThat(environmentConfig.isLocal()).isTrue();
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MergeEnvironmentConfigTest method shouldReturnCorrectOriginOfDefinedPipeline.
@Test
void shouldReturnCorrectOriginOfDefinedPipeline() {
BasicEnvironmentConfig uatLocalPart = new BasicEnvironmentConfig(new CaseInsensitiveString("UAT"));
uatLocalPart.setOrigins(new FileConfigOrigin());
String localPipeline = "local-pipeline";
uatLocalPart.addPipeline(new CaseInsensitiveString(localPipeline));
BasicEnvironmentConfig uatRemotePart = new BasicEnvironmentConfig(new CaseInsensitiveString("UAT"));
uatRemotePart.setOrigins(new RepoConfigOrigin());
String remotePipeline = "remote-pipeline";
uatRemotePart.addPipeline(new CaseInsensitiveString(remotePipeline));
MergeEnvironmentConfig environmentConfig = new MergeEnvironmentConfig(uatLocalPart, uatRemotePart);
assertThat(environmentConfig.getOriginForPipeline(new CaseInsensitiveString(localPipeline))).isEqualTo(new FileConfigOrigin());
assertThat(environmentConfig.getOriginForPipeline(new CaseInsensitiveString(remotePipeline))).isEqualTo(new RepoConfigOrigin());
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MagicalGoConfigXmlLoaderTest method shouldSetConfigOriginInEnvironment_AfterLoadingConfigFile.
@Test
void shouldSetConfigOriginInEnvironment_AfterLoadingConfigFile() throws Exception {
String content = configWithEnvironments("<environments>" + " <environment name='uat'>" + " </environment>" + "</environments>", CONFIG_SCHEMA_VERSION);
EnvironmentsConfig environmentsConfig = xmlLoader.deserializeConfig(content).getEnvironments();
EnvironmentConfig uat = environmentsConfig.get(0);
assertThat(uat.getOrigin()).isEqualTo(new FileConfigOrigin());
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class DependencyMaterialConfigTest method shouldValidateTree.
@Test
void shouldValidateTree() {
DependencyMaterialConfig dependencyMaterialConfig = new DependencyMaterialConfig(new CaseInsensitiveString("upstream_stage"), new CaseInsensitiveString("upstream_pipeline"), new CaseInsensitiveString("stage"));
PipelineConfig pipeline = new PipelineConfig(new CaseInsensitiveString("p"), new MaterialConfigs());
pipeline.setOrigin(new FileConfigOrigin());
dependencyMaterialConfig.validateTree(PipelineConfigSaveValidationContext.forChain(true, "group", config, pipeline));
assertThat(dependencyMaterialConfig.errors().on(DependencyMaterialConfig.PIPELINE_STAGE_NAME)).isEqualTo("Pipeline with name 'upstream_pipeline' does not exist, it is defined as a dependency for pipeline 'p' (cruise-config.xml)");
}
use of com.thoughtworks.go.config.remote.FileConfigOrigin in project gocd by gocd.
the class MaterialConfigsTest method shouldAllowToDependOnPipelineDefinedInFile_WhenInFile.
@Test
public void shouldAllowToDependOnPipelineDefinedInFile_WhenInFile() 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 FileConfigOrigin());
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 dep = pipeline2.materialConfigs().findDependencyMaterial(new CaseInsensitiveString("pipeline1"));
assertThat(dep.errors().isEmpty(), is(true));
}
Aggregations