use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class EnvironmentsConfigTest method shouldGetLocalPartsWhenOriginIsRepo.
@Test
public void shouldGetLocalPartsWhenOriginIsRepo() {
env.setOrigins(new RepoConfigOrigin());
assertThat(configs.getLocal().size(), is(0));
}
use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class EnvironmentsConfigTest method shouldGetLocalPartsWhenOriginIsMixed.
@Test
public void shouldGetLocalPartsWhenOriginIsMixed() {
env.setOrigins(new FileConfigOrigin());
BasicEnvironmentConfig prodLocalPart = new BasicEnvironmentConfig(new CaseInsensitiveString("PROD"));
prodLocalPart.addAgent("1235");
prodLocalPart.setOrigins(new FileConfigOrigin());
BasicEnvironmentConfig prodRemotePart = new BasicEnvironmentConfig(new CaseInsensitiveString("PROD"));
prodRemotePart.setOrigins(new RepoConfigOrigin());
MergeEnvironmentConfig pairEnvironmentConfig = new MergeEnvironmentConfig(prodLocalPart, prodRemotePart);
configs.add(pairEnvironmentConfig);
assertThat(configs.getLocal().size(), is(2));
assertThat(configs.getLocal(), hasItem(env));
assertThat(configs.getLocal(), hasItem(prodLocalPart));
}
use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class MergeEnvironmentConfigTest method shouldReturnCorrectOriginOfDefinedPipeline.
@Test
public void shouldReturnCorrectOriginOfDefinedPipeline() throws Exception {
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)), is(new FileConfigOrigin()));
assertThat(environmentConfig.getOriginForPipeline(new CaseInsensitiveString(remotePipeline)), is(new RepoConfigOrigin()));
}
use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class MergePipelineConfigsTest method createWithPipeline.
@Override
protected PipelineConfigs createWithPipeline(PipelineConfig pipelineConfig) {
BasicPipelineConfigs pipelineConfigsLocal = new BasicPipelineConfigs(pipelineConfig);
pipelineConfigsLocal.setOrigin(new FileConfigOrigin());
BasicPipelineConfigs pipelineConfigsRemote = new BasicPipelineConfigs();
pipelineConfigsRemote.setOrigin(new RepoConfigOrigin());
return new MergePipelineConfigs(pipelineConfigsRemote, pipelineConfigsLocal);
}
use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class MergePipelineConfigsTest method shouldFailToAddPipelineAtIndex_WhenWouldLandInNonEditablePart.
@Test
public void shouldFailToAddPipelineAtIndex_WhenWouldLandInNonEditablePart() {
PipelineConfig pipeline0 = PipelineConfigMother.pipelineConfig("pipeline0");
PipelineConfig pipeline1 = PipelineConfigMother.pipelineConfig("pipeline1");
PipelineConfig pipeline3 = PipelineConfigMother.pipelineConfig("pipeline3");
PipelineConfig pipeline5 = PipelineConfigMother.pipelineConfig("pipeline5");
PipelineConfig pipeline2 = PipelineConfigMother.pipelineConfig("pipeline2");
PipelineConfig pipeline4 = PipelineConfigMother.pipelineConfig("pipeline4");
BasicPipelineConfigs pipelineConfigsMiddle = new BasicPipelineConfigs(pipeline3);
pipelineConfigsMiddle.setOrigin(new FileConfigOrigin());
BasicPipelineConfigs bottom = new BasicPipelineConfigs(pipeline0, pipeline1, pipeline2);
BasicPipelineConfigs top = new BasicPipelineConfigs(pipeline4, pipeline5);
bottom.setOrigin(new RepoConfigOrigin());
top.setOrigin(new RepoConfigOrigin());
PipelineConfigs group = new MergePipelineConfigs(bottom, pipelineConfigsMiddle, top);
PipelineConfig p1 = PipelineConfigMother.pipelineConfig("pipelineToInsert");
tryAddAndAssertThatFailed(group, p1, 0);
tryAddAndAssertThatFailed(group, p1, 1);
tryAddAndAssertThatFailed(group, p1, 2);
tryAddAndAssertThatFailed(group, p1, 5);
tryAddAndAssertThatFailed(group, p1, 4);
}
Aggregations