Search in sources :

Example 31 with SvnMaterial

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

the class MaterialDatabaseSvnWithExternalsUpdaterTest method shouldUpdateModificationsForExternals.

@Test
public void shouldUpdateModificationsForExternals() throws Exception {
    updater.updateMaterial(material);
    testRepoWithExternal.checkInExternalFile("foo_bar", "foo bar quux");
    updater.updateMaterial(material);
    MaterialRevisions materialRevisions = materialRepository.findLatestModification(material);
    assertThat(materialRevisions.numberOfRevisions(), is(2));
    SvnMaterial externalMaterial = testRepoWithExternal.externalMaterial();
    MaterialRevision revisionForExternal = materialRevisions.findRevisionFor(externalMaterial);
    assertThat(revisionForExternal.getModification(0).getComment(), is("foo bar quux"));
}
Also used : MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) MaterialRevision(com.thoughtworks.go.domain.MaterialRevision) Test(org.junit.Test)

Example 32 with SvnMaterial

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

the class MaterialDatabaseSvnWithExternalsUpdaterTest method shouldNotTryToSaveModificationForAnExternalThathasAlreadyBeenSaved.

@Test
public void shouldNotTryToSaveModificationForAnExternalThathasAlreadyBeenSaved() throws Exception {
    updater.updateMaterial(material);
    SvnTestRepoWithExternal otherRepo = new SvnTestRepoWithExternal(testRepoWithExternal.externalRepositoryUrl(), temporaryFolder);
    SvnMaterial otherMaterial = new SvnMaterial(otherRepo.projectRepositoryUrl(), null, null, true);
    updater.updateMaterial(otherMaterial);
    MaterialRevisions materialRevisions = materialRepository.findLatestModification(otherMaterial);
    assertThat(materialRevisions.numberOfRevisions(), is(2));
}
Also used : MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) SvnTestRepoWithExternal(com.thoughtworks.go.helper.SvnTestRepoWithExternal) Test(org.junit.Test)

Example 33 with SvnMaterial

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

the class MaterialRepositoryIntegrationTest method findLatestModifications_shouldQueryIfNotEnoughElementsInCache_Integration.

@Test
public void findLatestModifications_shouldQueryIfNotEnoughElementsInCache_Integration() {
    SvnMaterial material = MaterialsMother.svnMaterial();
    MaterialRevision mod = saveOneScmModification(material, "user2", "file3");
    goCache.clear();
    Modification modification = repo.findLatestModification(repo.findMaterialInstance(material));
    assertEquals(mod.getLatestModification(), modification);
}
Also used : SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) Test(org.junit.Test)

Example 34 with SvnMaterial

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

the class MaterialRepositoryIntegrationTest method shouldBeAbleToFindModificationsSinceAPreviousChange.

@Test
public void shouldBeAbleToFindModificationsSinceAPreviousChange() throws Exception {
    SvnMaterial original = MaterialsMother.svnMaterial();
    MaterialRevision originalRevision = saveOneScmModification(original, "user1", "file1");
    MaterialRevision later = saveOneScmModification(original, "user2", "file2");
    List<Modification> modifications = repo.findModificationsSince(original, originalRevision);
    assertEquals(later.getLatestModification(), modifications.get(0));
}
Also used : SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) Test(org.junit.Test)

Example 35 with SvnMaterial

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

the class MaterialRepositoryIntegrationTest method shouldFindNoModificationsSinceLatestChange.

@Test
public void shouldFindNoModificationsSinceLatestChange() throws Exception {
    SvnMaterial original = MaterialsMother.svnMaterial();
    MaterialRevision originalRevision = saveOneScmModification(original, "user", "file1");
    List<Modification> modifications = repo.findModificationsSince(original, originalRevision);
    assertThat(modifications.size(), is(0));
}
Also used : SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) 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