Search in sources :

Example 66 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 67 with SvnMaterial

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

the class SvnTestRepo method createMaterial.

public SvnMaterial createMaterial(String repo, String folder) {
    SvnMaterial material = MaterialsMother.svnMaterial(urlFor(repo), folder);
    material.setAutoUpdate(true);
    return material;
}
Also used : SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial)

Example 68 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 69 with SvnMaterial

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

the class MaterialRevisionTest method shouldNotConsiderChangedFlagAsPartOfEqualityAndHashCodeCheck.

@Test
public void shouldNotConsiderChangedFlagAsPartOfEqualityAndHashCodeCheck() {
    Modification modification = oneModifiedFile("revision1");
    SvnMaterial material = MaterialsMother.svnMaterial();
    MaterialRevision notChanged = new MaterialRevision(material, false, modification);
    MaterialRevision changed = new MaterialRevision(material, true, modification);
    changed.markAsChanged();
    assertThat(changed, is(notChanged));
    assertThat(changed.hashCode(), is(notChanged.hashCode()));
}
Also used : SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) DependencyMaterialRevision(com.thoughtworks.go.domain.materials.dependency.DependencyMaterialRevision) Test(org.junit.Test)

Example 70 with SvnMaterial

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

the class MaterialCheckerTest method shouldSkipLatestRevisionsForMaterialsThatWereAlreadyChecked.

@Test
public void shouldSkipLatestRevisionsForMaterialsThatWereAlreadyChecked() throws Exception {
    DependencyMaterial dependencyMaterial = new DependencyMaterial(new CaseInsensitiveString("pipeline-name"), new CaseInsensitiveString("stage-name"));
    SvnMaterial svnMaterial = new SvnMaterial("svnUrl", null, null, false);
    Stage passedStage = StageMother.passedStageInstance("stage-name", "job-name", "pipeline-name");
    Modification dependencyModification = new Modification("Unknown", "Unknown", null, passedStage.completedDate(), "pipeline-name/1[LABEL-1]/stage-name/0");
    Modification svnModification = new Modification("user", "commend", "em@il", new Date(), "1");
    Mockito.when(materialRepository.findLatestModification(svnMaterial)).thenReturn(revisions(dependencyMaterial, svnModification));
    materialChecker.findLatestRevisions(new MaterialRevisions(new MaterialRevision(dependencyMaterial, dependencyModification)), new Materials(dependencyMaterial, svnMaterial));
    Mockito.verify(materialRepository, never()).findLatestModification(dependencyMaterial);
    Mockito.verify(materialRepository).findLatestModification(svnMaterial);
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) Materials(com.thoughtworks.go.config.materials.Materials) Stage(com.thoughtworks.go.domain.Stage) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) MaterialRevision(com.thoughtworks.go.domain.MaterialRevision) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Date(java.util.Date) Test(org.junit.Test)

Aggregations

SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)140 Test (org.junit.Test)111 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)44 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)39 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)22 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)21 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)20 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)20 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)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 Materials (com.thoughtworks.go.config.materials.Materials)13 Date (java.util.Date)11 Username (com.thoughtworks.go.server.domain.Username)10 P4Material (com.thoughtworks.go.config.materials.perforce.P4Material)9 File (java.io.File)8 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)8 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)7 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)7