Search in sources :

Example 1 with SvnMaterial

use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.

the class MaterialRevisionTest method shouldDetectChangedRevision.

@Test
public void shouldDetectChangedRevision() {
    Modification modification1 = oneModifiedFile("revision1");
    Modification modification2 = oneModifiedFile("revision2");
    SvnMaterial material = MaterialsMother.svnMaterial();
    MaterialRevision materialRevision1 = new MaterialRevision(material, modification1);
    MaterialRevision materialRevision2 = new MaterialRevision(material, modification2);
    assertThat(materialRevision1.hasChangedSince(materialRevision2), is(true));
}
Also used : SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) DependencyMaterialRevision(com.thoughtworks.go.domain.materials.dependency.DependencyMaterialRevision) Test(org.junit.Test)

Example 2 with SvnMaterial

use of com.thoughtworks.go.config.materials.svn.SvnMaterial 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 3 with SvnMaterial

use of com.thoughtworks.go.config.materials.svn.SvnMaterial 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 4 with SvnMaterial

use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.

the class ModificationBuildCauseTest method shouldBeValidWithExternalMaterials.

@Test
public void shouldBeValidWithExternalMaterials() {
    SvnMaterial mainRepo = MaterialsMother.svnMaterial("mainRepo");
    MaterialRevisions revisions = new MaterialRevisions();
    revisions.addRevision(mainRepo, multipleModificationList());
    revisions.addRevision(MaterialsMother.svnMaterial("externalRepo"), multipleModificationList());
    buildCause = BuildCause.createWithModifications(revisions, "");
    buildCause.assertMaterialsMatch(new MaterialConfigs(mainRepo.config()));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) Test(org.junit.Test)

Example 5 with SvnMaterial

use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.

the class ModificationBuildCauseTest method shouldBeInvalidWhenMaterialsFromConfigAreNotInBuildCause.

@Test
public void shouldBeInvalidWhenMaterialsFromConfigAreNotInBuildCause() {
    SvnMaterial mainRepo = MaterialsMother.svnMaterial("mainRepo");
    SvnMaterial extRepo = MaterialsMother.svnMaterial("externalRepo");
    MaterialRevisions revisions = new MaterialRevisions();
    revisions.addRevision(mainRepo, multipleModificationList());
    buildCause = BuildCause.createWithModifications(revisions, "");
    try {
        buildCause.assertMaterialsMatch(new MaterialConfigs(mainRepo.config(), extRepo.config()));
        fail("All the materials from config file should be in build cause");
    } catch (Exception expected) {
    }
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) Test(org.junit.Test)

Aggregations

SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)136 Test (org.junit.Test)113 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)44 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)37 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)21 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)20 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)19 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)19 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)18 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)17 Material (com.thoughtworks.go.domain.materials.Material)16 Modification (com.thoughtworks.go.domain.materials.Modification)16 Date (java.util.Date)14 Materials (com.thoughtworks.go.config.materials.Materials)13 Username (com.thoughtworks.go.server.domain.Username)9 File (java.io.File)9 P4Material (com.thoughtworks.go.config.materials.perforce.P4Material)8 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)8 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)7 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)7