Search in sources :

Example 56 with RepoConfigOrigin

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));
}
Also used : RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) Test(org.junit.Test)

Example 57 with RepoConfigOrigin

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));
}
Also used : FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) BasicEnvironmentConfig(com.thoughtworks.go.config.BasicEnvironmentConfig) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) MergeEnvironmentConfig(com.thoughtworks.go.config.merge.MergeEnvironmentConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Example 58 with RepoConfigOrigin

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()));
}
Also used : FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) Test(org.junit.Test)

Example 59 with 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);
}
Also used : FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin)

Example 60 with RepoConfigOrigin

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);
}
Also used : FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) Test(org.junit.Test)

Aggregations

RepoConfigOrigin (com.thoughtworks.go.config.remote.RepoConfigOrigin)97 Test (org.junit.Test)74 ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)34 PartialConfig (com.thoughtworks.go.config.remote.PartialConfig)29 FileConfigOrigin (com.thoughtworks.go.config.remote.FileConfigOrigin)23 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)15 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)13 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)11 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)11 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)11 StringContains.containsString (org.hamcrest.core.StringContains.containsString)11 File (java.io.File)9 IOException (java.io.IOException)8 GitAPIException (org.eclipse.jgit.api.errors.GitAPIException)8 ExpectedException (org.junit.rules.ExpectedException)8 Cloner (com.rits.cloning.Cloner)7 FullConfigUpdateCommand (com.thoughtworks.go.config.update.FullConfigUpdateCommand)7 Modification (com.thoughtworks.go.domain.materials.Modification)7 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)6 GoConfigInvalidException (com.thoughtworks.go.config.exceptions.GoConfigInvalidException)6