Search in sources :

Example 1 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 2 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 3 with RepoConfigOrigin

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

the class BasicPipelineConfigsTest method shouldReturnNullGetLocalPartsWhenOriginIsRepo.

@Test
public void shouldReturnNullGetLocalPartsWhenOriginIsRepo() {
    PipelineConfigs pipelineConfigs = createEmpty();
    pipelineConfigs.setOrigins(new RepoConfigOrigin());
    assertNull(pipelineConfigs.getLocal());
}
Also used : RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) PipelineConfigs(com.thoughtworks.go.config.PipelineConfigs) BasicPipelineConfigs(com.thoughtworks.go.config.BasicPipelineConfigs) Test(org.junit.Test)

Example 4 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 5 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)

Aggregations

RepoConfigOrigin (com.thoughtworks.go.config.remote.RepoConfigOrigin)89 Test (org.junit.Test)63 ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)32 PartialConfig (com.thoughtworks.go.config.remote.PartialConfig)28 FileConfigOrigin (com.thoughtworks.go.config.remote.FileConfigOrigin)20 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)14 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)13 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)11 StringContains.containsString (org.hamcrest.core.StringContains.containsString)11 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)10 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)10 File (java.io.File)9 IOException (java.io.IOException)8 HashMap (java.util.HashMap)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 GoConfigInvalidException (com.thoughtworks.go.config.exceptions.GoConfigInvalidException)6