Search in sources :

Example 71 with Material

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

the class SvnMaterialTest method shouldBeEqualWhenUrlSameForSvnMaterial.

@Test
public void shouldBeEqualWhenUrlSameForSvnMaterial() throws Exception {
    final Material material1 = MaterialsMother.defaultSvnMaterialsWithUrl("url1").get(0);
    final Material material = MaterialsMother.defaultSvnMaterialsWithUrl("url1").get(0);
    assertComplementaryEquals(material1, material, true);
}
Also used : Material(com.thoughtworks.go.domain.materials.Material) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) Test(org.junit.Test)

Example 72 with Material

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

the class TfsMaterialInstanceTest method shouldPassFolderAlong.

@Test
public void shouldPassFolderAlong() {
    TfsMaterialInstance instance1 = new TfsMaterialInstance("http://foo.com", "username", "CORPORATE", "some_project_path", "blah");
    Material material = instance1.toOldMaterial("", "some_folder", "password");
    assertThat(material.getFolder(), is("some_folder"));
}
Also used : Material(com.thoughtworks.go.domain.materials.Material) Test(org.junit.Test)

Example 73 with Material

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

the class PipelineMaterialRevisionTest method shouldUsePassedInFROMRevisionWhenSCMMaterial.

@Test
public void shouldUsePassedInFROMRevisionWhenSCMMaterial() {
    Material material = new HgMaterial("http://some_server/repo", null);
    Modification latestModification = modification(new Date(), "123", null, null);
    Modification earlierModification = modification(new Date(), "23", null, null);
    PipelineMaterialRevision pmr = new PipelineMaterialRevision(9, new MaterialRevision(material, latestModification, earlierModification), null);
    Modification earlierThatEarlyModification = modification(new Date(), "13", null, null);
    pmr.useMaterialRevision(new MaterialRevision(material, latestModification, earlierThatEarlyModification));
    assertThat(pmr.getToModification(), is(latestModification));
    assertThat(pmr.getFromModification(), is(earlierThatEarlyModification));
    Modification laterThanLatestModification = modification(new Date(), "1234", null, null);
    pmr.useMaterialRevision(new MaterialRevision(material, laterThanLatestModification, earlierThatEarlyModification));
    assertThat(pmr.getToModification(), is(laterThanLatestModification));
    assertThat(pmr.getFromModification(), is(earlierThatEarlyModification));
    pmr.useMaterialRevision(new MaterialRevision(material, laterThanLatestModification, earlierModification));
    assertThat(pmr.getToModification(), is(laterThanLatestModification));
    assertThat(pmr.getFromModification(), is(earlierModification));
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) Material(com.thoughtworks.go.domain.materials.Material) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) Date(java.util.Date) Test(org.junit.Test)

Example 74 with Material

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

the class PipelineHistoryMother method pipelineHistory.

public static PipelineInstanceModels pipelineHistory(PipelineConfig pipelineConfig, Date scheduleDate, Date modificationDate, String revision, String committer, String commitMessage, String commiterEmail, String commitedFileName, String dirModified, String label) {
    PipelineInstanceModels history = PipelineInstanceModels.createPipelineInstanceModels();
    Modification modification = new Modification(committer, commitMessage, commiterEmail, modificationDate, revision);
    modification.createModifiedFile(commitedFileName, dirModified, ModifiedAction.added);
    MaterialRevisions revisions = new MaterialRevisions();
    Material material = new MaterialConfigConverter().toMaterial(pipelineConfig.materialConfigs().first());
    material.setId(10);
    revisions.addRevision(material, modification);
    BuildCause buildCause = BuildCause.createManualForced(revisions, Username.ANONYMOUS);
    PipelineInstanceModel item = PipelineInstanceModel.createPipeline(CaseInsensitiveString.str(pipelineConfig.name()), -1, label, buildCause, stageHistory(pipelineConfig, scheduleDate));
    item.setCounter(1);
    item.setId(1);
    item.setComment("build comment");
    history.add(item);
    return history;
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) Material(com.thoughtworks.go.domain.materials.Material) MaterialConfigConverter(com.thoughtworks.go.server.service.MaterialConfigConverter) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause)

Example 75 with Material

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

the class MaterialUpdateListener method onMessage.

public void onMessage(MaterialUpdateMessage message) {
    final Material material = message.getMaterial();
    try {
        mduPerformanceLogger.pickedUpMaterialForMDU(message.trackingId(), material);
        bombIf(diskSpaceMonitor.isLowOnDisk(), "Cruise server is too low on disk to continue with material update");
        updater.updateMaterial(material);
        mduPerformanceLogger.postingMessageAboutMDUCompletion(message.trackingId(), material);
        // This should happen only if the transaction is committed.
        topic.post(new MaterialUpdateSuccessfulMessage(material, message.trackingId()));
    } catch (Exception e) {
        topic.post(new MaterialUpdateFailedMessage(material, message.trackingId(), e));
        mduPerformanceLogger.postingMessageAboutMDUFailure(message.trackingId(), material);
    }
}
Also used : Material(com.thoughtworks.go.domain.materials.Material)

Aggregations

Material (com.thoughtworks.go.domain.materials.Material)95 Test (org.junit.Test)59 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)39 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)39 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)23 Modification (com.thoughtworks.go.domain.materials.Modification)20 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)18 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)16 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)14 ScmMaterial (com.thoughtworks.go.config.materials.ScmMaterial)14 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)14 Materials (com.thoughtworks.go.config.materials.Materials)11 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)10 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)9 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)9 PluggableSCMMaterial (com.thoughtworks.go.config.materials.PluggableSCMMaterial)8 Date (java.util.Date)8 HashSet (java.util.HashSet)8 P4Material (com.thoughtworks.go.config.materials.perforce.P4Material)7 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)7