Search in sources :

Example 16 with SvnTestRepo

use of com.thoughtworks.go.helper.SvnTestRepo in project gocd by gocd.

the class BuildRepositoryServiceIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    dbHelper.onSetUp();
    config.onSetUp();
    config.usingCruiseConfigDao(goConfigDao);
    goConfigService.forceNotifyListeners();
    svnTestRepo = new SvnTestRepo("testsvnrepo");
    svnRepo = new SvnCommand(null, svnTestRepo.projectRepositoryUrl());
    config.addPipeline(PIPELINE_NAME, DEV_STAGE, svnRepo, "foo");
    mingle = config.addStageToPipeline(PIPELINE_NAME, FT_STAGE, "bar");
    config.addAgent(HOSTNAME, AGENT_UUID);
    pipeline = dbHelper.newPipelineWithAllStagesPassed(mingle);
    goCache.clear();
}
Also used : SvnTestRepo(com.thoughtworks.go.helper.SvnTestRepo) SvnCommand(com.thoughtworks.go.domain.materials.svn.SvnCommand)

Example 17 with SvnTestRepo

use of com.thoughtworks.go.helper.SvnTestRepo in project gocd by gocd.

the class BuildCauseProducerServiceIntegrationTest method should_NOT_markAsChangedWhenMaterialIsReIntroducedWithSameRevisionsToPipeline.

@Test
public void should_NOT_markAsChangedWhenMaterialIsReIntroducedWithSameRevisionsToPipeline() throws Exception {
    SvnMaterial svn1 = SvnMaterial.createSvnMaterialWithMock(repository);
    svn1.setFolder("another_repo");
    mingleConfig = configHelper.replaceMaterialForPipeline(MINGLE_PIPELINE_NAME, svn1.config());
    runAndPassWith(svn1, "foo.c", svnRepository);
    SvnTestRepo svn2Repository = new SvnTestRepo("testSvnRepo2");
    Subversion repository2 = new SvnCommand(null, svn2Repository.projectRepositoryUrl());
    SvnMaterial svn2 = SvnMaterial.createSvnMaterialWithMock(repository2);
    svn2.setFolder("boulder");
    checkinFile(svn2, "bar.c", svn2Repository);
    mingleConfig = configHelper.addMaterialToPipeline(MINGLE_PIPELINE_NAME, svn2.config());
    scheduleHelper.autoSchedulePipelinesWithRealMaterials(MINGLE_PIPELINE_NAME);
    assertThat(pipelineScheduleQueue.toBeScheduled().keySet(), hasItem(MINGLE_PIPELINE_NAME));
    BuildCause mingleBuildCause = pipelineScheduleQueue.toBeScheduled().get(MINGLE_PIPELINE_NAME);
    verifyChanged(svn2, mingleBuildCause, true);
    //this should not have changed, as foo.c was already built in the previous instance
    verifyChanged(svn1, mingleBuildCause, false);
    runAndPass(mingleBuildCause.getMaterialRevisions());
    mingleConfig = configHelper.replaceMaterialForPipeline(MINGLE_PIPELINE_NAME, svn1.config());
    scheduleHelper.autoSchedulePipelinesWithRealMaterials(MINGLE_PIPELINE_NAME);
    assertThat(pipelineScheduleQueue.toBeScheduled().keySet(), hasItem(MINGLE_PIPELINE_NAME));
    mingleBuildCause = pipelineScheduleQueue.toBeScheduled().get(MINGLE_PIPELINE_NAME);
    //this should not have changed, as foo.c was already built in the previous instance
    verifyChanged(svn1, mingleBuildCause, false);
    runAndPassWith(svn1, "baz.c", svnRepository);
    mingleConfig = configHelper.addMaterialToPipeline(MINGLE_PIPELINE_NAME, svn2.config());
    checkinFile(svn1, "quux.c", svnRepository);
    scheduleHelper.autoSchedulePipelinesWithRealMaterials(MINGLE_PIPELINE_NAME);
    assertThat(pipelineScheduleQueue.toBeScheduled().keySet(), hasItem(MINGLE_PIPELINE_NAME));
    mingleBuildCause = pipelineScheduleQueue.toBeScheduled().get(MINGLE_PIPELINE_NAME);
    verifyChanged(svn2, mingleBuildCause, false);
    verifyChanged(svn1, mingleBuildCause, true);
}
Also used : Subversion(com.thoughtworks.go.domain.materials.svn.Subversion) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) SvnTestRepo(com.thoughtworks.go.helper.SvnTestRepo) SvnCommand(com.thoughtworks.go.domain.materials.svn.SvnCommand) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) Test(org.junit.Test)

Example 18 with SvnTestRepo

use of com.thoughtworks.go.helper.SvnTestRepo in project gocd by gocd.

the class BuildCauseProducerServiceIntegrationSvnTest method shouldCreateBuildCauseWithModifications.

@Test
public void shouldCreateBuildCauseWithModifications() throws Exception {
    repositoryForMaterial(new SvnTestRepo("svnTestRepo"));
    prepareAPipelineWithHistory();
    checkInFiles("foo");
    ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
    materialDatabaseUpdater.updateMaterial(svnMaterial);
    buildCauseProducerService.autoSchedulePipeline(CaseInsensitiveString.str(mingleConfig.name()), result, 123);
    assertThat(result.canContinue(), is(true));
    BuildCause mingleBuildCause = pipelineScheduleQueue.toBeScheduled().get(CaseInsensitiveString.str(mingleConfig.name()));
    MaterialRevisions materialRevisions = mingleBuildCause.getMaterialRevisions();
    assertThat(materialRevisions.getRevisions().size(), is(1));
    Materials materials = materialRevisions.getMaterials();
    assertThat(materials.size(), is(1));
    assertThat(materials.get(0), is(svnMaterial));
}
Also used : MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) Materials(com.thoughtworks.go.config.materials.Materials) SvnTestRepo(com.thoughtworks.go.helper.SvnTestRepo) ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) BuildCause(com.thoughtworks.go.domain.buildcause.BuildCause) Test(org.junit.Test)

Aggregations

SvnTestRepo (com.thoughtworks.go.helper.SvnTestRepo)18 SvnCommand (com.thoughtworks.go.domain.materials.svn.SvnCommand)9 Before (org.junit.Before)9 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)5 HgTestRepo (com.thoughtworks.go.helper.HgTestRepo)5 Test (org.junit.Test)5 RunIf (com.googlecode.junit.ext.RunIf)3 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)3 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)3 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)3 TestRepo (com.thoughtworks.go.helper.TestRepo)3 GoConfigFileHelper (com.thoughtworks.go.util.GoConfigFileHelper)3 File (java.io.File)3 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)2 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)2 EnvironmentConfig (com.thoughtworks.go.config.EnvironmentConfig)1 StageConfig (com.thoughtworks.go.config.StageConfig)1 Filter (com.thoughtworks.go.config.materials.Filter)1 IgnoredFiles (com.thoughtworks.go.config.materials.IgnoredFiles)1 Materials (com.thoughtworks.go.config.materials.Materials)1