Search in sources :

Example 61 with RepoConfigOrigin

use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.

the class MergePipelineConfigsTest method createWithPipelines.

@Override
protected PipelineConfigs createWithPipelines(PipelineConfig first, PipelineConfig second) {
    BasicPipelineConfigs pipelineConfigsLocal = new BasicPipelineConfigs(first, second);
    pipelineConfigsLocal.setOrigin(new FileConfigOrigin());
    BasicPipelineConfigs pipelineConfigsRemote = new BasicPipelineConfigs();
    pipelineConfigsRemote.setOrigin(new RepoConfigOrigin());
    return new MergePipelineConfigs(pipelineConfigsLocal, pipelineConfigsRemote);
}
Also used : FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin)

Example 62 with RepoConfigOrigin

use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.

the class MergePipelineConfigsTest method shouldReturnNullForGetLocalWhenOnlyRemoteParts.

@Test
public void shouldReturnNullForGetLocalWhenOnlyRemoteParts() {
    BasicPipelineConfigs firstPart = new BasicPipelineConfigs();
    firstPart.setOrigin(new RepoConfigOrigin());
    BasicPipelineConfigs secondPart = new BasicPipelineConfigs();
    secondPart.setOrigin(new RepoConfigOrigin());
    MergePipelineConfigs merge = new MergePipelineConfigs(firstPart, secondPart);
    assertNull(merge.getLocal());
}
Also used : RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) Test(org.junit.Test)

Example 63 with RepoConfigOrigin

use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.

the class MergePipelineConfigsTest method shouldReturnFilePartForGetLocalWhenHasRemoteAndFilePart.

@Test
public void shouldReturnFilePartForGetLocalWhenHasRemoteAndFilePart() {
    BasicPipelineConfigs filePart = new BasicPipelineConfigs();
    filePart.setOrigin(new FileConfigOrigin());
    BasicPipelineConfigs secondPart = new BasicPipelineConfigs();
    secondPart.setOrigin(new RepoConfigOrigin());
    MergePipelineConfigs merge = new MergePipelineConfigs(filePart, secondPart);
    assertThat(merge.getLocal(), Matchers.<PipelineConfigs>is(filePart));
}
Also used : FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) Test(org.junit.Test)

Example 64 with RepoConfigOrigin

use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.

the class ConfigRepoPartialPreprocessorTest method shouldMergePartialsSetOnConfig.

@Test
public void shouldMergePartialsSetOnConfig() {
    final PartialConfig partialConfig = PartialConfigMother.withPipeline("partial");
    partialConfig.setOrigin(new RepoConfigOrigin(configRepoConfig, "sha-1"));
    ConfigRepoPartialPreprocessor preprocessor = new ConfigRepoPartialPreprocessor();
    PipelineConfig pipelineInMain = PipelineConfigMother.createPipelineConfig("main_pipeline", "stage", "job");
    BasicCruiseConfig cruiseConfig = new BasicCruiseConfig(new BasicPipelineConfigs(pipelineInMain));
    cruiseConfig.setConfigRepos(reposConfig);
    cruiseConfig.setPartials(asList(partialConfig));
    preprocessor.process(cruiseConfig);
    assertThat(cruiseConfig.getAllPipelineNames().contains(pipelineInMain.name()), is(true));
    assertThat(cruiseConfig.getAllPipelineNames().contains(partialConfig.getGroups().first().get(0).name()), is(true));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) PartialConfig(com.thoughtworks.go.config.remote.PartialConfig) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) BasicPipelineConfigs(com.thoughtworks.go.config.BasicPipelineConfigs) Test(org.junit.Test)

Example 65 with RepoConfigOrigin

use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.

the class MaterialConfigsTest method shouldAllowToDependOnPipelineDefinedInConfigRepository_WhenInConfigRepository.

@Test
public void shouldAllowToDependOnPipelineDefinedInConfigRepository_WhenInConfigRepository() 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(new ConfigRepoConfig(new SvnMaterialConfig("http://mysvn", false), "myplugin"), "123"));
    pipeline2.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(new SvnMaterialConfig("http://othersvn", false), "myplugin"), "2222"));
    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));
}
Also used : ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) 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