Search in sources :

Example 51 with RepoConfigOrigin

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

the class BuildCauseTest method shouldThrowWhenMaterialAndConfigOriginRevisionDontMatch_WhenAutoTrigger.

@Test
public void shouldThrowWhenMaterialAndConfigOriginRevisionDontMatch_WhenAutoTrigger() {
    SvnMaterial material = MaterialsMother.svnMaterial();
    MaterialConfig materialConfig = material.config();
    MaterialRevisions first = new MaterialRevisions(new MaterialRevision(material, oneModifiedFile("revision1")));
    BuildCause buildCause = BuildCause.createWithModifications(first, "");
    buildCause.setMaterialRevisions(first);
    PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfigWithStages("pipe1", "build");
    pipelineConfig.materialConfigs().clear();
    pipelineConfig.materialConfigs().add(materialConfig);
    pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(materialConfig, "plug"), "revision2"));
    try {
        buildCause.assertPipelineConfigAndMaterialRevisionMatch(pipelineConfig);
    } catch (BuildCauseOutOfDateException ex) {
        // good
        return;
    }
    fail("should have thrown");
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) BuildCauseOutOfDateException(com.thoughtworks.go.domain.buildcause.BuildCauseOutOfDateException) Test(org.junit.Test)

Example 52 with RepoConfigOrigin

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

the class BuildCauseTest method shouldNotThrowWhenMaterialAndConfigOriginRevisionDontMatch_WhenManualTrigger.

@Test
public void shouldNotThrowWhenMaterialAndConfigOriginRevisionDontMatch_WhenManualTrigger() {
    SvnMaterial material = MaterialsMother.svnMaterial();
    MaterialConfig materialConfig = material.config();
    MaterialRevisions first = new MaterialRevisions(new MaterialRevision(material, oneModifiedFile("revision1")));
    BuildCause buildCause = BuildCause.createManualForced();
    buildCause.setMaterialRevisions(first);
    PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfigWithStages("pipe1", "build");
    pipelineConfig.materialConfigs().clear();
    pipelineConfig.materialConfigs().add(materialConfig);
    pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(materialConfig, "plug"), "revision2"));
    buildCause.assertPipelineConfigAndMaterialRevisionMatch(pipelineConfig);
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) Test(org.junit.Test)

Example 53 with RepoConfigOrigin

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

the class PipelineConfigTest method shouldReturnConfigRepoOriginDisplayNameWhenOriginIsRemote.

@Test
public void shouldReturnConfigRepoOriginDisplayNameWhenOriginIsRemote() {
    PipelineConfig pipelineConfig = new PipelineConfig();
    pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(MaterialConfigsMother.gitMaterialConfig(), "plugin"), "revision1"));
    assertThat(pipelineConfig.getOriginDisplayName(), is("AwesomeGitMaterial at revision1"));
}
Also used : ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) Test(org.junit.Test)

Example 54 with RepoConfigOrigin

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

the class PipelineConfigTest method shouldReturnFalseWhenOneOfPipelineMaterialsIsNotTheSameAsConfigOrigin.

@Test
public void shouldReturnFalseWhenOneOfPipelineMaterialsIsNotTheSameAsConfigOrigin() {
    PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfig("pipeline", "stage", "build");
    MaterialConfig material = new GitMaterialConfig("http://git");
    pipelineConfig.setOrigin(new RepoConfigOrigin(new ConfigRepoConfig(material, "plugin"), "1233"));
    assertThat(pipelineConfig.isConfigOriginSameAsOneOfMaterials(), is(false));
}
Also used : GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) PluggableSCMMaterialConfig(com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) AbstractMaterialConfig(com.thoughtworks.go.config.materials.AbstractMaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) PackageMaterialConfig(com.thoughtworks.go.config.materials.PackageMaterialConfig) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) Test(org.junit.Test)

Example 55 with RepoConfigOrigin

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

the class PipelineGroupsTest method shouldGetLocalPartsWhenOriginIsMixed.

@Test
public void shouldGetLocalPartsWhenOriginIsMixed() {
    PipelineConfigs localGroup = createGroup("defaultGroup", createPipelineConfig("pipeline1", "stage1"));
    localGroup.setOrigins(new FileConfigOrigin());
    PipelineConfigs remoteGroup = createGroup("defaultGroup", createPipelineConfig("pipeline2", "stage1"));
    remoteGroup.setOrigins(new RepoConfigOrigin());
    MergePipelineConfigs mergePipelineConfigs = new MergePipelineConfigs(localGroup, remoteGroup);
    PipelineGroups groups = new PipelineGroups(mergePipelineConfigs);
    assertThat(groups.getLocal().size(), is(1));
    assertThat(groups.getLocal(), hasItem(localGroup));
}
Also used : MergePipelineConfigs(com.thoughtworks.go.config.merge.MergePipelineConfigs) FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) MergePipelineConfigs(com.thoughtworks.go.config.merge.MergePipelineConfigs) 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