Search in sources :

Example 51 with MaterialRevisions

use of com.thoughtworks.go.domain.MaterialRevisions in project gocd by gocd.

the class BuildCauseProducerServiceWithFlipModificationTest method preparePipelineWithMaterial.

private void preparePipelineWithMaterial() throws Exception {
    SvnMaterial svnMaterial = SvnMaterial.createSvnMaterialWithMock(repository);
    ReflectionUtil.setField(svnMaterial, ScmMaterialConfig.FOLDER, "asc");
    ReflectionUtil.invoke(svnMaterial, "resetCachedIdentityAttributes");
    MaterialConfigs materialConfigs = new MaterialConfigs();
    materialConfigs.add(svnMaterial.config());
    configHelper.addPipeline("cruise", STAGE_NAME, materialConfigs, "unit", "functional");
    MaterialRevisions materialRevisions = new MaterialRevisions();
    materialRevisions.addRevision(svnMaterial, svnMaterial.latestModification(null, subprocessExecutionContext));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial)

Example 52 with MaterialRevisions

use of com.thoughtworks.go.domain.MaterialRevisions in project gocd by gocd.

the class BuildCauseProducerServiceWithFlipModificationTest method buildCause.

private BuildCause buildCause() {
    MaterialRevisions materialRevisions = new MaterialRevisions();
    SvnMaterial svnMaterial = SvnMaterial.createSvnMaterialWithMock(repository);
    materialRevisions.addRevision(svnMaterial, svnMaterial.latestModification(null, subprocessExecutionContext));
    return BuildCause.createWithModifications(materialRevisions, "");
}
Also used : MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial)

Example 53 with MaterialRevisions

use of com.thoughtworks.go.domain.MaterialRevisions in project gocd by gocd.

the class ChangeMaterialsTest method shouldManualScheduleWithLatestModificationFromNewMaterialAfterChangedMaterial.

// TODO: CS&DY Revisit this test to use materials properly
@Test
public void shouldManualScheduleWithLatestModificationFromNewMaterialAfterChangedMaterial() throws Exception, StageAlreadyBuildingException {
    cruiseConfig.replaceMaterialWithHgRepoForPipeline(PIPELINE_NAME, hgTestRepo.projectRepositoryUrl());
    scheduleHelper.manuallySchedulePipelineWithRealMaterials(PIPELINE_NAME, username);
    scheduleService.autoSchedulePipelinesFromRequestBuffer();
    Pipeline mostRecent = pipelineService.mostRecentFullPipelineByName(PIPELINE_NAME);
    assertThat("Should schedule new instance after changed material", mostRecent.getId(), is(not(pipeline.getId())));
    MaterialRevisions materialRevisions = mostRecent.getBuildCause().getMaterialRevisions();
    assertEquals(hgTestRepo.latestModifications().get(0).getModifiedTime(), materialRevisions.getDateOfLatestModification());
}
Also used : MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) Pipeline(com.thoughtworks.go.domain.Pipeline)

Example 54 with MaterialRevisions

use of com.thoughtworks.go.domain.MaterialRevisions in project gocd by gocd.

the class MaterialDatabaseGitWithSubmodulesUpdaterTest method shouldUpdateModificationsForExternalsAsWell.

@Test
public void shouldUpdateModificationsForExternalsAsWell() throws Exception {
    updater.updateMaterial(material);
    MaterialRevisions materialRevisions = materialRepository.findLatestModification(material);
    assertThat(materialRevisions.numberOfRevisions(), is(1));
}
Also used : MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) Test(org.junit.Test)

Example 55 with MaterialRevisions

use of com.thoughtworks.go.domain.MaterialRevisions 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)

Aggregations

MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)212 Test (org.junit.Test)166 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)111 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)68 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)55 Date (java.util.Date)49 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)46 Modification (com.thoughtworks.go.domain.materials.Modification)38 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)33 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)33 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)31 PipelineConfigDependencyGraph (com.thoughtworks.go.server.domain.PipelineConfigDependencyGraph)31 Materials (com.thoughtworks.go.config.materials.Materials)27 Pipeline (com.thoughtworks.go.domain.Pipeline)20 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)19 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)17 Material (com.thoughtworks.go.domain.materials.Material)16 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)15 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)14 File (java.io.File)12