Search in sources :

Example 1 with SvnMaterialInstance

use of com.thoughtworks.go.domain.materials.svn.SvnMaterialInstance in project gocd by gocd.

the class MaterialRepositoryIntegrationTest method shouldBeAbleToPersistAMaterial.

@Test
public void shouldBeAbleToPersistAMaterial() throws Exception {
    MaterialInstance original = new SvnMaterialInstance("url", "username", UUID.randomUUID().toString(), true);
    repo.saveOrUpdate(original);
    MaterialInstance loaded = repo.find(original.getId());
    assertThat(loaded, is(original));
}
Also used : PackageMaterialInstance(com.thoughtworks.go.domain.materials.packagematerial.PackageMaterialInstance) PluggableSCMMaterialInstance(com.thoughtworks.go.domain.materials.scm.PluggableSCMMaterialInstance) SvnMaterialInstance(com.thoughtworks.go.domain.materials.svn.SvnMaterialInstance) SvnMaterialInstance(com.thoughtworks.go.domain.materials.svn.SvnMaterialInstance) Test(org.junit.Test)

Example 2 with SvnMaterialInstance

use of com.thoughtworks.go.domain.materials.svn.SvnMaterialInstance in project gocd by gocd.

the class MaterialRepositoryIntegrationTest method shouldPersistModifiedFiles.

@Test
public void shouldPersistModifiedFiles() throws Exception {
    MaterialInstance original = new SvnMaterialInstance("url", "username", UUID.randomUUID().toString(), true);
    Modification modification = new Modification("user", "comment", "email", new Date(), ModificationsMother.nextRevision());
    modification.createModifiedFile("file1", "folder1", ModifiedAction.added);
    modification.createModifiedFile("file2", "folder2", ModifiedAction.deleted);
    repo.saveOrUpdate(original);
    MaterialInstance loaded = repo.find(original.getId());
    assertThat(loaded, is(original));
}
Also used : PackageMaterialInstance(com.thoughtworks.go.domain.materials.packagematerial.PackageMaterialInstance) PluggableSCMMaterialInstance(com.thoughtworks.go.domain.materials.scm.PluggableSCMMaterialInstance) SvnMaterialInstance(com.thoughtworks.go.domain.materials.svn.SvnMaterialInstance) SvnMaterialInstance(com.thoughtworks.go.domain.materials.svn.SvnMaterialInstance) Date(java.util.Date) Test(org.junit.Test)

Example 3 with SvnMaterialInstance

use of com.thoughtworks.go.domain.materials.svn.SvnMaterialInstance in project gocd by gocd.

the class PipelineMaterialRevisionTest method modification.

private Modification modification(Date date, String s, String label, Long id) {
    Modification latestModification = new Modification(date, s, label, id);
    latestModification.setMaterialInstance(new SvnMaterialInstance("url", "loser", "ufo", true));
    return latestModification;
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) SvnMaterialInstance(com.thoughtworks.go.domain.materials.svn.SvnMaterialInstance)

Example 4 with SvnMaterialInstance

use of com.thoughtworks.go.domain.materials.svn.SvnMaterialInstance in project gocd by gocd.

the class ModificationTest method shouldCopyConstructor.

@Test
public void shouldCopyConstructor() {
    Modification modification = new Modification("user", "comment", "foo@bar.com", new Date(), "pipe/1/stage/2");
    Map<String, String> additionalData = new HashMap<>();
    additionalData.put("a1", "v1");
    additionalData.put("a2", "v2");
    modification.setAdditionalData(new Gson().toJson(additionalData));
    MaterialInstance original = new SvnMaterialInstance("url", "username", UUID.randomUUID().toString(), true);
    modification.setMaterialInstance(original);
    assertThat(new Modification(modification), is(modification));
    modification = new Modification(new Date(), "rev", "label", 121L);
    Modification copiedModification = new Modification(modification);
    assertThat(copiedModification, is(modification));
    assertThat(copiedModification.getAdditionalDataMap(), is(modification.getAdditionalDataMap()));
}
Also used : HashMap(java.util.HashMap) Gson(com.google.gson.Gson) SvnMaterialInstance(com.thoughtworks.go.domain.materials.svn.SvnMaterialInstance) MaterialInstance(com.thoughtworks.go.domain.MaterialInstance) Date(java.util.Date) SvnMaterialInstance(com.thoughtworks.go.domain.materials.svn.SvnMaterialInstance) Test(org.junit.Test)

Example 5 with SvnMaterialInstance

use of com.thoughtworks.go.domain.materials.svn.SvnMaterialInstance in project gocd by gocd.

the class MaterialRepositoryIntegrationTest method shouldPersistModificationsWithMaterials.

@Test
public void shouldPersistModificationsWithMaterials() throws Exception {
    MaterialInstance original = new SvnMaterialInstance("url", "username", UUID.randomUUID().toString(), false);
    repo.saveOrUpdate(original);
    MaterialInstance loaded = repo.find(original.getId());
    assertThat(loaded, is(original));
}
Also used : PackageMaterialInstance(com.thoughtworks.go.domain.materials.packagematerial.PackageMaterialInstance) PluggableSCMMaterialInstance(com.thoughtworks.go.domain.materials.scm.PluggableSCMMaterialInstance) SvnMaterialInstance(com.thoughtworks.go.domain.materials.svn.SvnMaterialInstance) SvnMaterialInstance(com.thoughtworks.go.domain.materials.svn.SvnMaterialInstance) Test(org.junit.Test)

Aggregations

SvnMaterialInstance (com.thoughtworks.go.domain.materials.svn.SvnMaterialInstance)6 Test (org.junit.Test)5 PackageMaterialInstance (com.thoughtworks.go.domain.materials.packagematerial.PackageMaterialInstance)3 PluggableSCMMaterialInstance (com.thoughtworks.go.domain.materials.scm.PluggableSCMMaterialInstance)3 Modification (com.thoughtworks.go.domain.materials.Modification)2 Date (java.util.Date)2 Gson (com.google.gson.Gson)1 ScmMaterial (com.thoughtworks.go.config.materials.ScmMaterial)1 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)1 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)1 MaterialInstance (com.thoughtworks.go.domain.MaterialInstance)1 Material (com.thoughtworks.go.domain.materials.Material)1 Modifications (com.thoughtworks.go.domain.materials.Modifications)1 HashMap (java.util.HashMap)1